summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-04-04 17:33:35 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-04-04 17:33:35 -0400
commita68fdf0d2fc7a7e5118b996d7fbbcc9b0eda2d15 (patch)
tree1584beee147f2f2aec5c7b0b601963a9753a0446 /doc
parentaba956a85dc090affea2548a912891f2d9bbfff0 (diff)
downloadsqlalchemy-a68fdf0d2fc7a7e5118b996d7fbbcc9b0eda2d15.tar.gz
- add some docs for the instancestate linkage to the inspection system
Diffstat (limited to 'doc')
-rw-r--r--doc/build/orm/session.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/build/orm/session.rst b/doc/build/orm/session.rst
index a3870f35e..26c0b3f85 100644
--- a/doc/build/orm/session.rst
+++ b/doc/build/orm/session.rst
@@ -196,6 +196,28 @@ Knowing these states is important, since the
operations (such as trying to save the same object to two different sessions
at the same time).
+Getting the Current State of an Object
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The actual state of any mapped object can be viewed at any time using
+the :func:`.inspect` system::
+
+ >>> from sqlalchemy import inspect
+ >>> insp = inspect(my_object)
+ >>> insp.persistent
+ True
+
+.. seealso::
+
+ :attr:`.InstanceState.transient`
+
+ :attr:`.InstanceState.pending`
+
+ :attr:`.InstanceState.persistent`
+
+ :attr:`.InstanceState.detached`
+
+
.. _session_faq:
Session Frequently Asked Questions