From ec04620f1fe609881ed2ad4a3d5b2fe313f4efa4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 3 Jun 2013 16:40:59 -0400 Subject: 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] --- test/engine/test_reflection.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/engine') 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()) + ) + -- cgit v1.2.1