Guest User

Untitled

a guest
Oct 19th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import os
  2. import csv
  3. import psycopg2
  4. import time
  5. conn = psycopg2.connect (host="xxxx", database="xxxx",
  6. user="xxxx" ,password="xxxx", port="xxxx")
  7.  
  8. delete="ALTER Table highloading_qgis DROP COLUMN geom;"
  9. tem_delete="DELETE FROM public.highloading_qgis;"
  10.  
  11. tem_carrier="copy highloading_qgis
  12. FROM'/home/ftpuser/Report/highloading_new.csv' With DELIMITER ',' CSV
  13. HEADER;"
  14.  
  15. add_col="ALTER TABLE highloading_qgis ADD COLUMN geom geometry;"
  16.  
  17.  
  18. update_gpis="UPDATE highloading_qgis SET geom =
  19. (ST_MakePolygon(ST_GeomFromText('LINESTRING ('Easting'
  20. 'Northing','Easting_2' 'Northing_2','Easting_3'
  21. 'Northing_3','Easting_4''Northing_4')')));"
  22. cursor = conn.cursor()
  23. cursor.execute(delete)
  24. cursor.execute(tem_delete)
  25. cursor.execute(tem_carrier)
  26. cursor.execute(add_col)
  27. cursor.execute(update_gpis)
  28. cursor.close()
  29. conn.commit()
  30. conn.close()
  31.  
  32. File "C:PCCWQGIS_projectHigh_Loading_Projectupdate_3G_pg.py", line
  33. 68, in <module>
  34. cursor.execute(update_gpis)
  35. ProgrammingError: syntax error at or near "Easting"
  36. LINE 1: ...m = (ST_MakePolygon(ST_GeomFromText('LINESTRING ('Easting' '...
  37. ^
Add Comment
Please, Sign In to add comment