[DB-SIG] Sample Code of Python/MySQL

Andy Dustman adustman@comstar.net
Tue, 20 Jul 1999 12:52:06 -0400 (EDT)


On Tue, 20 Jul 1999, Brad Stec wrote:

> Does anyone have any good sample Python source-code describing interfacing
> with mySQL?  
> 
> I'm exploring use of Andy Dustman's MySQLdb module and could use some
> reference.  I'm building up a MySQLdb API "cgi trainer" for my team with
> examples of how to exploit mySQL's basics through the module and could sure
> use some support.  

The basics would just be whatever is in the DB API 2.0 spec over at
www.python.org. Generally it's

db=MySQL.connect(host='host',user='user',passwd='password',db='dbname')
c=db.cursor()
c.execute(query)
l=c.fetchall()

> If all goes well and it passes inspection, I'll ask Andy if he'd like to
> include it with the module files.

I'll take a look, sure. 

-- 
andy dustman  | programmer/analyst |  comstar communications corporation
telephone: 770.485.6025 / 706.549.7689 | icq: 32922760 | pgp: 0xc72f3f1d