From: Emanuele O. <oli...@it...> - 2003-11-26 14:10:15
|
Hi, first of all I'd like to say that SQLObject is a beautiful module and I'm using it with with very interesting results (with SQLite on a Linux box). I tried to run this, to try many-to-many relations: --- from SQLObject import * __connection__=SQLiteConnection('bug.sqlite', debug=1) class A(SQLObject): b=RelatedJoin('B') class B(SQLObject): a=RelatedJoin('A') A.createTable(ifNotExists=True) B.createTable(ifNotExists=True) a=A.new() b=B.new() --- I got an: "_sqlite.DatabaseError: near ")": syntax error" due to this SQL command: "INSERT INTO a () VALUES ()" Is it a pysqlite problem or SQLObject problem? In the following you can find the complete log (debug=1). Cheers, Emanuele --- log transcript --- /tmp 143>python bug-many-to-many.py 1/QueryOne: SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name = 'a' 1/COMMIT : auto 1/Query : CREATE TABLE a ( id INTEGER PRIMARY KEY ) 1/COMMIT : auto 1/QueryOne: SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name = 'a_b' 1/COMMIT : auto 1/Query : CREATE TABLE a_b ( a_id INT NOT NULL, b_id INT NOT NULL ) 1/COMMIT : auto 1/QueryOne: SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name = 'b' 1/COMMIT : auto 1/Query : CREATE TABLE b ( id INTEGER PRIMARY KEY ) 1/COMMIT : auto 1/QueryIns: INSERT INTO a () VALUES () Traceback (most recent call last): File "bug-many-to-many.py", line 14, in ? a=A.new() File "/opt/python2.3/lib/python2.3/site-packages/SQLObject/SQLObject.py", line 883, in new inst._SO_finishCreate(id) File "/opt/python2.3/lib/python2.3/site-packages/SQLObject/SQLObject.py", line 905, in _SO_finishCreate id, names, values) File "/opt/python2.3/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 160, in queryInsertID return self._runWithConnection(self._queryInsertID, table, idName, id, names, values) File "/opt/python2.3/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 72, in _runWithConnection val = meth(conn, *args) File "/opt/python2.3/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 717, in _queryInsertID c.execute(q) File "/opt/python2.3/lib/python2.3/site-packages/sqlite/main.py", line 244, in execute self.rs = self.con.db.execute(SQL) _sqlite.DatabaseError: near ")": syntax error ----------------------------------------------------------------- |