Skip to content

Instantly share code, notes, and snippets.

@csabatini
Created March 9, 2015 19:39
Show Gist options
  • Save csabatini/29e55235ceab86d175c6 to your computer and use it in GitHub Desktop.
Save csabatini/29e55235ceab86d175c6 to your computer and use it in GitHub Desktop.
MySQL-python
import MySQLdb
db = MySQLdb.connect("localhost", "user", "pw", "census")
cursor = db.cursor()
sql = 'SELECT * FROM name'
cursor.execute(sql)
results = cursor.fetchall()
print len(results)
db.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment