Advertisement
Guest User

Untitled

a guest
Apr 28th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. import pymssql
  2.  
  3. # connect to SQL Server instance
  4. conn = pymssql.connect(host='localhost', user='sa', password='sa', database='nosde')
  5.  
  6. # commits every transaction automatically and setup cursor
  7. conn.autocommit(True)
  8. cur = conn.cursor()
  9.  
  10. # !!Chunk of code stripped out on how I get my coords, unrelated to Q.
  11.  
  12. # Store projected coords in a GEOMETRY type field
  13. geom_type = "geometry::STPointFromText('POINT(%s %s)', 3857)" % (x, y)
  14. try:
  15. cur.execute("INSERT INTO tweets (geom) VALUES (%s)" % (geom_type))
  16. except TypeError:
  17. print "Could not INSERT", clean
  18.  
  19. conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement