diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-08 15:26:43 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-08-08 15:26:43 +0000 |
commit | 491f6796f869d597922018660cc491441a878543 (patch) | |
tree | 309449629921c591ce24d9b597a62560d4163a85 /lib/sqlalchemy/orm/session.py | |
parent | b365cc839698c847a9df3c08b53dd5603a2d901c (diff) | |
download | sqlalchemy-491f6796f869d597922018660cc491441a878543.tar.gz |
- turned on auto-returning for oracle, some errors
- added make_transient() [ticket:1052]
- ongoing refactor of compiler _get_colparams() (more to come)
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index d3d653de4..fdf679a42 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1593,6 +1593,22 @@ def _state_for_unknown_persistence_instance(instance): return state +def make_transient(instance): + """Make the given instance 'transient'. + + This will remove its association with any + session and additionally will remove its "identity key", + such that it's as though the object were newly constructed, + except retaining its values. + + """ + state = attributes.instance_state(instance) + s = _state_session(state) + if s: + s._expunge_state(state) + del state.key + + def object_session(instance): """Return the ``Session`` to which instance belongs, or None.""" |