diff options
| author | Phillip Cloud <cpcloud@gmail.com> | 2018-07-16 10:10:55 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-07-18 10:48:27 -0400 |
| commit | 893eac06e511f3765c0c89bab76d7933d83ffccc (patch) | |
| tree | 440d7b625e6dfcc505d42b16a721395a50bf480d /test/dialect/test_sqlite.py | |
| parent | fb377229cd4c4e503bde9c44b78d30ad48f3cf7e (diff) | |
| download | sqlalchemy-893eac06e511f3765c0c89bab76d7933d83ffccc.tar.gz | |
Fix quoting schemas in _get_table_sql for the SQLite backend
Fixed issue where the "schema" name used for a SQLite database within table
reflection would not quote the schema name correctly. Pull request
courtesy Phillip Cloud.
Change-Id: I2770788c1f094a7743209250ec26b5ef5fb2d9e8
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/463
Diffstat (limited to 'test/dialect/test_sqlite.py')
| -rw-r--r-- | test/dialect/test_sqlite.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index 5e2535b30..9b1d5d7ea 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -1127,6 +1127,31 @@ class ReflectHeadlessFKsTest(fixtures.TestBase): assert b.c.id.references(a.c.id) +class KeywordInDatabaseNameTest(fixtures.TestBase): + __only_on__ = 'sqlite' + + @classmethod + def setup_class(cls): + with testing.db.begin() as conn: + conn.execute("ATTACH %r AS \"default\"" % conn.engine.url.database) + conn.execute('CREATE TABLE "default".a (id INTEGER PRIMARY KEY)') + + @classmethod + def teardown_class(cls): + with testing.db.begin() as conn: + try: + conn.execute('drop table "default".a') + except Exception: + pass + conn.execute('DETACH DATABASE "default"') + + def test_reflect(self): + with testing.db.begin() as conn: + meta = MetaData(bind=conn, schema='default') + meta.reflect() + assert 'default.a' in meta.tables + + class ConstraintReflectionTest(fixtures.TestBase): __only_on__ = 'sqlite' |
