I should extract data from an oracle database.
How can I find out which schema are defined in the database?
When I do not define any schema in the description of Metadata(), I find no tables.
thanks for your help,
I should extract data from an oracle database. How can I find out which
Share
Default Oracle schema matches the username that was used in Oracle connection.
If you don’t see any tables – it means the tables are created in another schema.
Looks like you have two questions here:
1) about Oracle schemas – how to find schema and tables in Oracle
2) about SQLAlchemy reflections – how to specify Oracle schema for table
You can find answer for the first question in many places. I.e. here: https://stackoverflow.com/a/2247758/1296661
Answering second question:
Table class constructor has schema argument to specify table’s schema if it is different from default user’s schema. See more here
http://docs.sqlalchemy.org/en/rel_0_7/core/schema.html#sqlalchemy.schema.Table
Here is the python code to answer second question. You will need to setup db connection and table name values to match your case:
Good luck with using sqlschema and reflection feature – it is a lot of fun. You get your python program working with existing database almost without defining schema information in your program.
I’m using this feature with oracle db in production – the only thing I have to define were relations between tables explicitly setting foreign and primary keys.