Python/MySQL Where do "SELECT ..." results go?

Miles Thompson milesthompson at sprint.ca
Wed Mar 8 14:29:31 CET 2000


Where did I get it?  I was either looking through the modules, or picked it
"experitentially" <g>.
Miles

Boudewijn Rempt wrote:

> Miles Thompson <milesthompson at sprint.ca> wrote:
>
> >>>> import Mysqldb
>
> Where did you get this? I know of MySQLdb and MySQL (and mySQL)
> as Python modules, but I haven't heard of Mysqldb before. If you
> were using MySQLdb, you would be using the DB-API II api, which
> ought to be portable to other databases (but are there any other
> database modules that conform to this api?)
>
> >>> import MySQLdb
> >>> conn=MySQLdb.connect(host='localhost',user='boud',db='lng',passwd='')
> >>> curs=conn.cursor()
> >>> curs.execute('select * from lng_parameter');
> >>> print curs.fetchall()
> [('testvalue', 'TEST')]
> >>>
>
> So, judging from your output, I'd try a curs.fetchall(), too.
>
> --
>
> Boudewijn Rempt  | http://www.valdyas.org




More information about the Python-list mailing list