Advertisement
Guest User

Untitled

a guest
Sep 12th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. >>> cp
  2. <qgis._core.QgsVectorLayer object at 0x7f541c0e0348>
  3.  
  4. >>> cp.source()
  5. u'dbname='work_viewtest' host=myhost port=5432 user='b' password='bxxxxxx' key='id' table="public"."v2_calculation_point" (the_geom) sql='
  6.  
  7. f = QgsFeature()
  8. f.setGeometry(QgsGeometry.fromPoint(QgsPoint(123, 456)))
  9. f.setAttributes([10, 100, "ref", -1])
  10. cp.dataProvider().addFeatures([f])
  11. (True, [<qgis._core.QgsFeature object at 0x7f539ffa33e0>])
  12. cp.updateExtents()
  13. cp.updateFields()
  14.  
  15. INSERT INTO v2_calculation_point (id, content_type_id
  16. , user_ref
  17. , calc_type
  18. , the_geom)
  19. VALUES
  20. (DEFAULT, 10, 'ref', -1, ST_GeomFromText('POINT(123 456)',28992))
  21. ;
  22.  
  23. ERROR: insert or update on table "v2_calculation_point" violates
  24. foreign key constraint "content_type_id_refs_id_522d7533"
  25.  
  26. cp.dataProvider().addFeatures([f])
  27. (True, [<qgis._core.QgsFeature object at 0x7fcece585a68>])
  28. f = QgsFeature()
  29. f.setGeometry(QgsGeometry.fromPoint(QgsPoint(123, 555)))
  30. f.setAttributes([77, 199, "ref-new", 5])
  31. cp.dataProvider().addFeatures([f])
  32. (True, [<qgis._core.QgsFeature object at 0x7fcece585b00>])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement