Skip to content

Instantly share code, notes, and snippets.

@skyowen
Last active January 3, 2016 17:08
Show Gist options
  • Save skyowen/8493401 to your computer and use it in GitHub Desktop.
Save skyowen/8493401 to your computer and use it in GitHub Desktop.
import pymysql, sys
try:
conn = pymysql.connect(host='igor.gold.ac.uk', port = 3306, user = 'co304so', passwd = '**********', db = 'co304so_LondonCrime')
cur = conn.cursor()
cur.execute("CREATE TABLE AprilNov2012(Date DATE, Westminster VARCHAR(11), HACKNEY VARCHAR(7), Tower_Hamlets VARCHAR(13))")
data = cur.fetchall()
print data
except Exception as e:
print "couldn't connect to database"
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment