Last active
August 29, 2015 14:08
-
-
Save mapcentia/da750c3209022dab0770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, csv | |
args =sys.argv | |
filesource = args[1] | |
with open(filesource, 'rb') as f: | |
reader = csv.reader(f, delimiter=';', quotechar='"') | |
for row in reader: | |
statement = "INSERT INTO " + args[2] + " " + \ | |
"(" +\ | |
"id," + \ | |
"value," + \ | |
"sensor_id," + \ | |
"location" +\ | |
") " + \ | |
"VALUES (%s,%s,%s,ST_geomfromtext('POINT(%s %s)',4326));" % (row[3],row[6],"1",row[5],row[4]) | |
print statement |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment