MySQLmodule synthax error

Olivier Roche olivier at scripps.edu
Wed Mar 1 16:28:37 CET 2000


Hi,

I have just download the last version of MySQLmodule which compile with
MySQL 3.22.30, but i have still a slight problem with the synthax.

I would like to create several tables in a loop, but i raise a
MySQLmodule error.
Here is the failed script:

for lines in TextFile('/DB_scripts/complex.txt'):
 code = split(lines)[0]
 dock = code + '-dock'
 if dock in tables:
  DBH['drop table ' + dock]

 ## Create the table

 DBH["create table %s (Structure_ID VARCHAR(20) NOT NULL, \
 Rms REAL NOT NULL, Energy_charmm REAL NOT NULL)" % dock]

MySQL.error: You have an error in your SQL syntax near '-dock
(Structure_ID VARCHAR(20) NOT NULL,  Rms REAL NOT NULL, Energy_charmm
REAL' at line 1

I try also:

DBH["create table" + dock + " (Structure_ID VARCHAR(20) NOT NULL, \
 Rms REAL NOT NULL, Energy_charmm REAL NOT NULL)"]

Same error.

Any advices will be very welcome.

Thank you

Olivier




More information about the Python-list mailing list