diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-12-14 10:29:46 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-12-14 10:29:46 -0500 |
commit | 850e881ce2cadd1cac58e7e1dfa5e3fbb2db4faf (patch) | |
tree | bc0c2db35660365bce3d84c21e10e3658edbdaad /test/dialect/test_sqlite.py | |
parent | ce3333a65c128d873a5c963a71d5c6961a42a3e8 (diff) | |
download | sqlalchemy-850e881ce2cadd1cac58e7e1dfa5e3fbb2db4faf.tar.gz |
More adjustment to this SQLite related issue which was released in
0.7.9, to intercept legacy SQLite quoting characters when reflecting
foreign keys. In addition to intercepting double quotes, other
quoting characters such as brackets, backticks, and single quotes
are now also intercepted. [ticket:2568]
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r-- | test/dialect/test_sqlite.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index 96171f4f7..97962a54a 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -401,7 +401,7 @@ class DialectTest(fixtures.TestBase, AssertsExecutionResults): meta.drop_all() @testing.provide_metadata - def test_quoted_identifiers_one(self): + def test_quoted_identifiers_functional_one(self): """Tests autoload of tables created with quoted column names.""" metadata = self.metadata @@ -427,7 +427,7 @@ class DialectTest(fixtures.TestBase, AssertsExecutionResults): == table2.c.id) @testing.provide_metadata - def test_quoted_identifiers_two(self): + def test_quoted_identifiers_functional_two(self): """"test the edgiest of edge cases, quoted table/col names that start and end with quotes. @@ -462,6 +462,30 @@ class DialectTest(fixtures.TestBase, AssertsExecutionResults): #assert j.onclause.compare(table1.c['"id"'] # == table2.c['"aid"']) + def test_legacy_quoted_identifiers_unit(self): + dialect = sqlite.dialect() + dialect._broken_fk_pragma_quotes = True + + + for row in [ + (0, 'target', 'tid', 'id'), + (0, '"target"', 'tid', 'id'), + (0, '[target]', 'tid', 'id'), + (0, "'target'", 'tid', 'id'), + (0, '`target`', 'tid', 'id'), + ]: + fks = {} + fkeys = [] + dialect._parse_fk(fks, fkeys, *row) + eq_(fkeys, [{ + 'referred_table': 'target', + 'referred_columns': ['id'], + 'referred_schema': None, + 'name': None, + 'constrained_columns': ['tid'] + }]) + + def test_attached_as_schema(self): cx = testing.db.connect() try: |