3 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: sqlite and named con...| From | Sent On | Attachments |
|---|---|---|
| Eric Ongerth | 28 May 2007 00:28 | |
| Michael Bayer | 28 May 2007 13:45 | |
| Eric Ongerth | 28 May 2007 18:42 |
| Subject: | [sqlalchemy] Re: sqlite and named constraints![]() |
|---|---|
| From: | Michael Bayer (mike...@zzzcomputing.com) |
| Date: | 05/28/2007 01:45:05 PM |
| List: | com.googlegroups.sqlalchemy |
On May 28, 2007, at 3:28 AM, Eric Ongerth wrote:
Just to get this into the searchable domain in case anyone else runs into the same errors...
sqlalchemy docs indicate that sqlite "parses foreign key constraints, but does not enforce them". So far, so good. But it doesn't mention (nor could I find any reference to this in sqlite3's own docs) that although *named* foreign key constraints do get passed on through, they will also cause sqlite errors if ill-formed.
test Table definition:
widget_table = Table('widgets', metadata, Column('foo', Integer, primary_key=True), Column('bar', Integer), Column('mergatroid', Integer), ForeignKeyConstraint( ['bar', 'mergatroid'], ['othertable.bar', 'othertable.mergatroid'], name='constraint name of several words'))
^ this will bring Syntax Errors from sqlite. At first I thought it was just the length of the name, but it turns out to be the presence of spaces in the name. Remove the spaces or replace them with underscores, and sqlite lets it through. Of course it's still not enforcing the constraints; but at least it doesn't complain.
I didn't test much farther than that, but I also found that forward- slash characters were not accepted in constraint names.
Obviously a minor concern, and why am I even bothering? Because i'm stuck in sqlite until I can get psycopg2 working in order to migrate to postgresql so I can actually USE these constraints.
I find it unusual that Postgres would allow constraint names with spaces in them, as well as that anyone would ever think to name a constraint with spaces in it. SQL is generally extremely intolerant of spaces in identifier names.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




