I am trying to reverse engineer an existing Oracle schema into some declarative SQLAlchemy models. My problem is that when I use MetaData.reflect , it does not find the tables in my schema, but just a global tempo table. However, I can query other tables.
I am using SQLAlchemy 0.7.8, CentOS 6.2 x86_64, python 2.6, cx_Oracle 5.1.2 and Oracle 11.2.0.2 Express Edition. Here is a brief example of what I'm talking about:
>>> import sqlalchemy >>> engine = sqlalchemy.create_engine('oracle+cx_oracle://user: pass@localhost /xe') >>> md = sqlalchemy.MetaData(bind=engine) >>> md.reflect() >>> md.tables immutabledict({u'my_gtt': Table(u'my_gtt', MetaData(bind=Engine(oracle+cx_oracle://user: pass@localhost /xe)), Column(u'id', NUMBER(precision=15, scale=0, asdecimal=False), table=<my_gtt>), Column(u'parent_id', NUMBER(precision=15, scale=0, asdecimal=False), table=<my_gtt>), Column(u'query_id', NUMBER(precision=15, scale=0, asdecimal=False), table=<my_gtt>), schema=None)}) >>> len(engine.execute('select * from my_regular_table').fetchall()) 4
source share