Runtime Inspection API — SQLAlchemy 2.0.0b1 documentation
From Get docs
Sqlalchemy/docs/latest/core/inspection
Runtime Inspection API
Available Inspection Targets
Below is a listing of many of the most common inspection targets.
Connectable(i.e._engine.Engine,_engine.Connection) - returns an_reflection.Inspectorobject._expression.ClauseElement- all SQL expression components, including_schema.Table,_schema.Column, serve as their own inspection objects, meaning any of these objects passed to_sa.inspect()return themselves.object- an object given will be checked by the ORM for a mapping - if so, anInstanceStateis returned representing the mapped state of the object. TheInstanceStatealso provides access to per attribute state via theAttributeStateinterface as well as the per-flush “history” of any attribute via theHistoryobject.type(i.e. a class) - a class given will be checked by the ORM for a mapping - if so, a_orm.Mapperfor that class is returned.- mapped attribute - passing a mapped attribute to
_sa.inspect(), such asinspect(MyClass.some_attribute), returns aQueryableAttributeobject, which is the descriptor associated with a mapped class. This descriptor refers to aMapperProperty, which is usually an instance ofColumnPropertyorRelationshipProperty, via itsQueryableAttribute.propertyattribute. AliasedClass- returns anAliasedInspobject.