Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
Created February 7, 2013 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lambdamusic/4734358 to your computer and use it in GitHub Desktop.
Save lambdamusic/4734358 to your computer and use it in GitHub Desktop.
Python: MySQL-Python library #python #sql
import MySQLdb
conn = MySQLdb.connect(host=\"localhost\", user=\"root\", passwd=\"nobodyknow\", db=\"amit\")
cursor = conn.cursor()
stmt = \"SELECT * FROM overflows\"
cursor.execute(stmt)
# Fetch and output
result = cursor.fetchall()
print result
# get the number of rows
numrows = int(cursor.rowcount)
# Close connection
conn.close()
@isahilchanna
Copy link

is it workingg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment