SqlAlchemy: get object instance state -
this: intro object states lists 4 permutations of presence-in-db/presence-in-session:
transient, pending, persistent & detached
is there way of querying given object return of 4 states object in?
i tried rooting around in _sa_instance_state
couldn't find relevant.
thanks!
better use inspection api:
from sqlalchemy import inspect state = inspect(obj) # booleans state.transient state.pending state.detached state.persistent
Comments
Post a Comment