[Tutor] MySQL

Szilard Bokros szilard@int.com
Wed, 17 Oct 2001 15:44:11 -0500


Hello,
I would like to write a python script that reads two strings from a
MySQL table,
creates a directory with the second name, copies in a file,
overwrites the first  name in the database with the second name.
My script looks like this:

As a first step it would be eenough if I could just manipulate the
database.
Open it, get something fromit, overwrite something in it, etc...
right now I reduced the script to a minimal version that does not work,
somewhere here must be an error:

#!/usr/local/python
import MySQLdb
db = MySQL.connect('localhost', 'eval', 'abrakadabra', 'Rumit')
#sofar it seems to be OK
result= db.query("""SELECT * FROM MyTableName""")

which gives back an error message.
So I have to do something before or after the result = ... line,
or should I import something else?
According to the O'Reilly MySQL book there is no need to set any cursor
to execute querys.

Sincere thanks for any clue.
I know: there should be an examples directory in the MySQLdb mod I
downloaded.
There isn't.
So thats it about clues from the author.

Szilard