Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> cp
- <qgis._core.QgsVectorLayer object at 0x7f541c0e0348>
- >>> cp.source()
- u'dbname='work_viewtest' host=myhost port=5432 user='b' password='bxxxxxx' key='id' table="public"."v2_calculation_point" (the_geom) sql='
- f = QgsFeature()
- f.setGeometry(QgsGeometry.fromPoint(QgsPoint(123, 456)))
- f.setAttributes([10, 100, "ref", -1])
- cp.dataProvider().addFeatures([f])
- (True, [<qgis._core.QgsFeature object at 0x7f539ffa33e0>])
- cp.updateExtents()
- cp.updateFields()
- INSERT INTO v2_calculation_point (id, content_type_id
- , user_ref
- , calc_type
- , the_geom)
- VALUES
- (DEFAULT, 10, 'ref', -1, ST_GeomFromText('POINT(123 456)',28992))
- ;
- ERROR: insert or update on table "v2_calculation_point" violates
- foreign key constraint "content_type_id_refs_id_522d7533"
- cp.dataProvider().addFeatures([f])
- (True, [<qgis._core.QgsFeature object at 0x7fcece585a68>])
- f = QgsFeature()
- f.setGeometry(QgsGeometry.fromPoint(QgsPoint(123, 555)))
- f.setAttributes([77, 199, "ref-new", 5])
- cp.dataProvider().addFeatures([f])
- (True, [<qgis._core.QgsFeature object at 0x7fcece585b00>])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement