Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brettclare/ce5837d1c131d652509d272ed775adab to your computer and use it in GitHub Desktop.
Save brettclare/ce5837d1c131d652509d272ed775adab to your computer and use it in GitHub Desktop.
Enter file contents hereimport pypyodbc
connection_string = ("Driver={SQL Server};Server=sql_xx_reporting;Database=xx;Trusted_Connection=Yes;")
connection = pypyodbc.connect(connection_string)
cur = connection.cursor()
#SQL=('SELECT * FROM tbl_twitter_stream')
SQL=("insert into tbl_twitter_stream(tweetID ,tweetText,tweetRetweetCt,tweetFavoriteCt,tweetSource,tweetCreated,userID,userScreen,userName ,userCreateDt,"
"userDesc,userFollowerCt,userFriendsCt,userLocation,userTimezone)Values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
Values=['723581579696607232','Breeeet Juice and they will send you...','0','0','Prospect street','2016-04-22 18:37:46','794315930',
'derekdoane55', 'Derek Doane','2012-08-31 17:31:26' ,'sc: derek_doane','242','9','San Diego, CA','Pacific Time (US & Canada)']
cur.execute(SQL,Values)
connection.commit()
#print(cur.fetchone())
cur.close()
connection.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment