sqlite3 error
Tim Chase
python.list at tim.thechases.com
Wed Sep 27 14:45:16 EDT 2006
> 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! :)
My guess would be the extra comma on the nameGiven line...most
SQL engines I've used would choke on that
- nameGiven varchar(255) DEFAULT NULL,
+ nameGiven varchar(255) DEFAULT NULL
-tkc
More information about the Python-list
mailing list