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

Miles Thompson milesthompson at sprint.ca
Tue Mar 7 07:35:22 EST 2000


Dear All,

Please be patient with me, if I've done something incredibly dumb. I've
workekd with FoxPro, Access, SQl Server for years, but the Python/MySQL
combination is new to me. My query results disappear and all I get is a
count of the records retrieved.

Here's what I've done. (Explore is the database, and table Test has 5
records.)

>>> import Mysqldb
>>>conn = Mysqldb.mysqldb('explore')
>>>conn
<Mysqldb.Connection instance at 810ea08>
#
# here's my first attempt at a select
#
>>>conn.execute("Select * from test;")
5
#
# wasn't what I wanted, so then I did this
#
>>>curs = conn.cursor()
>>>curs.execute("Select * from test;")
5
#
# Nope. Try assigning to a variable?
#
>>>data = curs.execute("Select * from test;")
>>>data
5
#
# and at this point it was 11:30, and over the past two days I'd
# hammered myself through the Python tutorial, various Python docs,
# set up MySQL and played with it interactively, reinstalled a new
version
# of Python (1.5.2) and the Python module for MySQL.
# I used python-MySQLmodule-1.4.0-7.i386.rpm
# So  I went to bed.

I must be close, but the documentation is "scanty" and short on
examples. Suggestions, or a pointer to a web site that answers the
question, has examples, will be welcome.

TIA - Miles Thompson
milesthompson at sprint.ca





More information about the Python-list mailing list