[Sqlalchemy-tickets] Issue #3244: sqlite inspection with get_unique_constraints doesn't pick up (al
Brought to you by:
zzzeek
|
From: Jon N. <iss...@bi...> - 2014-11-10 18:14:00
|
New issue 3244: sqlite inspection with get_unique_constraints doesn't pick up (all) UNIQUE constraints https://bitbucket.org/zzzeek/sqlalchemy/issue/3244/sqlite-inspection-with Jon Nelson: In sqlite you may *optionally* define a unique constraint without a name (and without CONSTRAINT): ``` #!sql CREATE TABLE foo (a int, b int, UNIQUE (a,b)) ``` As of 0.9.8, the as-supplied regex which does the constraint parsing will miss these. I'm using this: ``` #!python '(?!CONSTRAINT \w+)? UNIQUE \(([^\)]+)\)' ``` and some local code modifications, and it seems to work fine. Michael Bayer responded via email with: sqlite doesn’t supply any system of getting the unique constraints for a table, nor does it give an implicit name to any of them, and thus doesn’t match what all other relational databases do in this regard. We should probably return these with name=None, feel free to open a ticket, but this would be 1.0 only. In the meantime, if inspection of SQLite constraints are needed you should give them names. |