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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -