SQLAlchemy: reflection in restricted DB?
I'm trying to mirror some tables from an old database (can't control how it's configured, can't change it). There are a ton of tables in the schema, most of which are not relevant to me and which I don't have access to. When I try to mirror tables, I have access to SQLAlchemy because it cannot SHOW command on some table, I don't care. For example:.
fooTable = Table('foo', meta)
insp = reflection.Inspector.from_engine(eng)
insp.reflecttable(fooTable, include_columns=("id", "name"))
sqlalchemy.exc.OperationalError: (OperationalError) (1142, "SHOW command denied to user 'xxx'@'yyy' for table 'bar'") 'SHOW CREATE TABLE `schema`.`bar`' ()
There is an FK in fooTable for barTable (not for id or name columns), but since I don't have read access or interest in barTable, I'd just prefer if SQLAlchemy can ignore it. Is it possible? I would be fine with a solution that doesn't try to load any relationships at all, since I just need to read the data in separate tables.
+3
source to share
No one has answered this question yet
Check out similar questions: