Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import csv
- import psycopg2
- import time
- conn = psycopg2.connect (host="xxxx", database="xxxx",
- user="xxxx" ,password="xxxx", port="xxxx")
- delete="ALTER Table highloading_qgis DROP COLUMN geom;"
- tem_delete="DELETE FROM public.highloading_qgis;"
- tem_carrier="copy highloading_qgis
- FROM'/home/ftpuser/Report/highloading_new.csv' With DELIMITER ',' CSV
- HEADER;"
- add_col="ALTER TABLE highloading_qgis ADD COLUMN geom geometry;"
- update_gpis="UPDATE highloading_qgis SET geom =
- (ST_MakePolygon(ST_GeomFromText('LINESTRING ('Easting'
- 'Northing','Easting_2' 'Northing_2','Easting_3'
- 'Northing_3','Easting_4''Northing_4')')));"
- cursor = conn.cursor()
- cursor.execute(delete)
- cursor.execute(tem_delete)
- cursor.execute(tem_carrier)
- cursor.execute(add_col)
- cursor.execute(update_gpis)
- cursor.close()
- conn.commit()
- conn.close()
- File "C:PCCWQGIS_projectHigh_Loading_Projectupdate_3G_pg.py", line
- 68, in <module>
- cursor.execute(update_gpis)
- ProgrammingError: syntax error at or near "Easting"
- LINE 1: ...m = (ST_MakePolygon(ST_GeomFromText('LINESTRING ('Easting' '...
- ^
Add Comment
Please, Sign In to add comment