Hi,
this might be another small bug in SA. It shows up when an Sqlite db
is composed of multiple sub-DBs via the 'attach' statement. This is
useful for mimicking schemata and allows tables to be addressed like
<schema>.<table> (using common dot-syntax).
To make the following work run this statement in your sqlite3 shell /
db:
> attach "master.db" as master;
The following table definition is used in SA:
sa_table = Table('project', metadata,
Column('project_id', Integer,
Sequence('seq_project_id', schema='master'), primary_key=True),
Column('name', String(20), nullable=False),
Column('owner_id', Integer,
ForeignKey('master.owner.owner_id')),
owner='master', schema='master')
which leads to a statement (through "metadata.create_all(engine)")
CREATE TABLE master.project (
project_id INTEGER NOT NULL,
owner_id INTEGER,
PRIMARY KEY (project_id),
FOREIGN KEY(owner_id) REFERENCES master.owner (owner_id)
);
However this fails. The problem is REFERENCES master.owner where
sqlite complains about the dot in the referenced table name.
The solution could be to use square brackets (i.e. REFERENCES
[master.owner] ) or quotes (i.e. REFERENCES "master.owner" ) for
sqlite.
Unfortunately both solutions seem to be somehow unique to sqlite, they
fail e.g. with postgres. I haven't tried other DBs.
Any idea how to solve this?
Ciao ciao
Ralph
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.