sqlite3 error

John Salerno johnjsal at NOSPAMgmail.com
Wed Sep 27 14:26:49 EDT 2006


Here's my script:

import sqlite3

con = sqlite3.connect('labdb')
cur = con.cursor()
cur.executescript('''
DROP TABLE IF EXISTS Researchers;
CREATE TABLE Researchers (
     researcherID varchar(9) PRIMARY KEY NOT NULL,
     birthYear int(4) DEFAULT NULL,
     birthMonth int(2) DEFAULT NULL,
     birthDay int(2) DEFAULT NULL,
     birthCountry varchar(50) DEFAULT NULL,
     birthState char(2) DEFAULT NULL,
     birthCity varchar(50) DEFAULT NULL,
     nameFirst varchar(50) NOT NULL,
     nameLast varchar(50) NOT NULL,
     nameGiven varchar(255) DEFAULT NULL,
);
''')

And here's the error:

Traceback (most recent call last):
   File "C:\Python25\myscripts\labdb\dbtest.py", line 19, in <module>
     ''')
OperationalError: near ")": syntax error
 >>>

My script looks just like the example in the docs, so I'm not sure what 
I'm doing wrong. The error message seems like it should be easy to 
figure out, but all I did was close the triple quotes and then close the 
parentheses, just like the example.

Hope someone can shed some light on this! :)



More information about the Python-list mailing list