[Sqlalchemy-tickets] Issue #3203: sqlite get_unique_constraints() does not work on temporary tables
Brought to you by:
zzzeek
|
From: Johannes E. <iss...@bi...> - 2014-09-17 14:44:24
|
New issue 3203: sqlite get_unique_constraints() does not work on temporary tables https://bitbucket.org/zzzeek/sqlalchemy/issue/3203/sqlite-get_unique_constraints-does-not Johannes Erdfelt: When attempting to use get_unique_constraints() on a temporary table in sqlite, it will fail with an exception similar to this: Traceback (most recent call last): File "test_sqlite_temporary.py", line 28, in <module> print insp.get_unique_constraints('test_temp_reflection') File "/home/johannes/openstack/sqlalchemy/lib/sqlalchemy/engine/reflection.py", line 410, in get_unique_constraints self.bind, table_name, schema, info_cache=self.info_cache, **kw) File "<string>", line 2, in get_unique_constraints File "/home/johannes/openstack/sqlalchemy/lib/sqlalchemy/engine/reflection.py", line 54, in cache ret = fn(self, con, *args, **kw) File "/home/johannes/openstack/sqlalchemy/lib/sqlalchemy/dialects/sqlite/base.py", line 1109, in get_unique_constraints table_data = c.fetchone()[0] The attached script shows that a non-temporary table works fine, but a temporary table fails. The bug is caused by the fact the sqlite implementation of get_unique_constraints() uses sqlite_master only, whereas code like get_indexes() does a union between sqlite_master and sqlite_temp_master. sqlite_temp_master being the version of sqlite_master that contains information on temporary tables. |