Re: [Sqlalchemy-tickets] [sqlalchemy] #2728: potential glitch in schema calcs for metadata.reflect
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-06-02 00:30:31
|
#2728: potential glitch in schema calcs for metadata.reflect
------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.8.xx
Component: schema | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+-------------------------------
Changes (by zzzeek):
* priority: medium => high
Comment:
the bug is with same-named tables in different schemas:
{{{
#!python
from sqlalchemy import *
m = MetaData()
t1 = Table('t', m, Column('id', Integer, primary_key=True))
t2 = Table('t', m,
Column('id1', ForeignKey('t.id')),
schema="test_schema"
)
e = create_engine("postgresql://scott:tiger@localhost/test")
m.create_all(e)
try:
m2 = MetaData()
m2.reflect(e, schema="test_schema")
m3 = MetaData()
m3.reflect(e)
m3.reflect(e, schema="test_schema")
print [(t.name, t.schema) for t in m2.tables.values()]
print [(t.name, t.schema) for t in m3.tables.values()]
finally:
m.drop_all(e)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2728#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|