summaryrefslogtreecommitdiff
path: root/test/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-06-03 16:40:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-06-03 16:40:59 -0400
commitec04620f1fe609881ed2ad4a3d5b2fe313f4efa4 (patch)
treebab6132139ad4d8d169a88904c01bf08b5006d8a /test/engine
parentd993bdeac8674db88efb3c400b4a505c8f97af9e (diff)
downloadsqlalchemy-ec04620f1fe609881ed2ad4a3d5b2fe313f4efa4.tar.gz
Fixed bug whereby using :meth:`.MetaData.reflect` across a remote
schema as well as a local schema could produce wrong results in the case where both schemas had a table of the same name. [ticket:2728]
Diffstat (limited to 'test/engine')
-rw-r--r--test/engine/test_reflection.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/engine/test_reflection.py b/test/engine/test_reflection.py
index a562ef73b..eefa68728 100644
--- a/test/engine/test_reflection.py
+++ b/test/engine/test_reflection.py
@@ -1245,6 +1245,30 @@ class SchemaTest(fixtures.TestBase):
'test_schema.email_addresses'])
)
+ @testing.requires.schemas
+ @testing.provide_metadata
+ def test_reflect_all_schemas_default_overlap(self):
+ t1 = Table('t', self.metadata,
+ Column('id', Integer, primary_key=True))
+
+ t2 = Table('t', self.metadata,
+ Column('id1', sa.ForeignKey('t.id')),
+ schema="test_schema"
+ )
+
+ self.metadata.create_all()
+ m2 = MetaData()
+ m2.reflect(testing.db, schema="test_schema")
+
+ m3 = MetaData()
+ m3.reflect(testing.db)
+ m3.reflect(testing.db, schema="test_schema")
+
+ eq_(
+ set((t.name, t.schema) for t in m2.tables.values()),
+ set((t.name, t.schema) for t in m3.tables.values())
+ )
+