sqlalchemy: SQLAlchemy Runtime Inspection API doesn't support `AsyncEngine`
The title pretty much describes this feature request. I would greatly appreciate if SQLAlchemy would support the Runtime Inspection API with a AsyncEngine much in the same way that it does with normal Engine objects. I know that the SQLAlchemy devs are very busy atm, so please don’t feel any pressure to implement this soon. Just wanted to let you guys know about this.
Have a nice day!
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 19 (11 by maintainers)
Hello @whg517,
As @zzzeek mentioned above the best solution would be to use the
run_sync()method. Consider the following example:Learn more about the
run_syncmethod here: https://docs.sqlalchemy.org/en/latest/orm/extensions/asyncio.html#sqlalchemy.ext.asyncio.AsyncConnection.run_syncUpdate:
I got the workaround…
or you can use it like this
Don’t create metadata and use it like.
This won’t work.
yeah there should be a little section on “using the inspector” and there also should be some notes on how the event hooks work for Core and ORM.
we can likely add this at some point and it can be sqlalchemy.ext.asyncio.reflection. it would cover the Inspector API using proxies and for per-dialect inspectors would use a
__getattr__scheme.for now using run_sync() is the workaround.
I need to load the existing table in memory using
MetaDataBut I’m getting an error
Inspect works fine, but it returns the name of the table. How to use the table returned from
Inspect??