summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/visitors.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-04-22 19:43:31 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-04-22 19:43:31 -0400
commit713a4e19fa6c4397191dd7311152c6c69c37535e (patch)
treecc73d61aa1275e65378f0c618ee3756836ac943e /lib/sqlalchemy/sql/visitors.py
parent02e8d401fea0c77a60efcdd1138cf29b30384219 (diff)
parent35adeb95bf917330e1366f8a7252999419819fb1 (diff)
downloadsqlalchemy-713a4e19fa6c4397191dd7311152c6c69c37535e.tar.gz
- merged #1401 branch from bitbucket
- resolved some serious speed hits I missed, we need to ensure only deannotated columns are used in the local/remote collections and soforth so that hash lookups against mapped columns don't dig into __eq__() - fix some other parity mismatches regarding stuff from [ticket:2453], including finding another case where _deep_annotate() was doing the wrong thing, new tests. - [feature] Major rewrite of relationship() internals now allow join conditions which include columns pointing to themselves within composite foreign keys. A new API for very specialized primaryjoin conditions is added, allowing conditions based on SQL functions, CAST, etc. to be handled by placing the annotation functions remote() and foreign() inline within the expression when necessary. Previous recipes using the semi-private _local_remote_pairs approach can be upgraded to this new approach. [ticket:1401]
Diffstat (limited to 'lib/sqlalchemy/sql/visitors.py')
-rw-r--r--lib/sqlalchemy/sql/visitors.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py
index 5354fbcbb..8a06982fc 100644
--- a/lib/sqlalchemy/sql/visitors.py
+++ b/lib/sqlalchemy/sql/visitors.py
@@ -242,13 +242,13 @@ def cloned_traverse(obj, opts, visitors):
if elem in stop_on:
return elem
else:
- if elem not in cloned:
- cloned[elem] = newelem = elem._clone()
+ if id(elem) not in cloned:
+ cloned[id(elem)] = newelem = elem._clone()
newelem._copy_internals(clone=clone)
meth = visitors.get(newelem.__visit_name__, None)
if meth:
meth(newelem)
- return cloned[elem]
+ return cloned[id(elem)]
if obj is not None:
obj = clone(obj)
@@ -260,16 +260,16 @@ def replacement_traverse(obj, opts, replace):
replacement by a given replacement function."""
cloned = util.column_dict()
- stop_on = util.column_set(opts.get('stop_on', []))
+ stop_on = util.column_set([id(x) for x in opts.get('stop_on', [])])
def clone(elem, **kw):
- if elem in stop_on or \
+ if id(elem) in stop_on or \
'no_replacement_traverse' in elem._annotations:
return elem
else:
newelem = replace(elem)
if newelem is not None:
- stop_on.add(newelem)
+ stop_on.add(id(newelem))
return newelem
else:
if elem not in cloned: