From: Ian B. <ia...@co...> - 2003-11-26 17:38:00
|
On Nov 26, 2003, at 8:09 AM, Emanuele Olivetti wrote: > 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? A SQLObject problem I suppose, though it's because you have trivial classes. The only column in your A and B tables is the ID (which SQLite generates automatically on insert). So there's no values to insert, and there's no way to express an insert that doesn't insert anything (strictly speaking, it inserts an ID, but because it is implicit it doesn't show up in the SQL, and so the SQL is invalid). Add some columns to your classes and you should be okay. They won't be useful until you do that anyway. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |