Skip to content

Instantly share code, notes, and snippets.

@mvaz
Created December 27, 2010 11:19
Show Gist options
  • Save mvaz/756057 to your computer and use it in GitHub Desktop.
Save mvaz/756057 to your computer and use it in GitHub Desktop.
Using MySQLdb
import MySQLdb
conn = MySQLdb.Connect(host="localhost", port=3306, user="mvaz", passwd="whatever", db="trades")
cursor = conn.cursor()
sql = "select * from Users"
cursor.execute(sql)
rows = cursor.fetchall()
for row in rows:
print row
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment