Albert Wagner wrote: > > I can find no docs for MySQLdb, so I am just guessing how to get going. I > got this far by trial and error: > > >>> import _mysql > >>> from _mysql import * > >>> connection = connect('myhostname', 'mypassword') > >>> > MySQLdb is very poorly documented. But if you browse through the dbtrainer files in the doc/ directory you'll come across something like this: import MySQLdb # Establish a connection: db=MySQLdb.connect(host='myhost',db='mydatabase',user='itsme',passwd='wonttellyou') # Fetch a table list c = db.cursor() c.execute('show tables') print c.fetchall() # fetchall() is bad for huge results. # use fetchmany() or fetchone() c.execute('select * from a_huge_table') while 1: rows = c.fetchmany(10) if not rows: break for row in rows: print row db.close() cg.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4