summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative.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/ext/declarative.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/ext/declarative.py')
-rwxr-xr-xlib/sqlalchemy/ext/declarative.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py
index faf575da1..07a2a3b95 100755
--- a/lib/sqlalchemy/ext/declarative.py
+++ b/lib/sqlalchemy/ext/declarative.py
@@ -1398,6 +1398,10 @@ class _GetTable(object):
def _deferred_relationship(cls, prop):
def resolve_arg(arg):
import sqlalchemy
+ from sqlalchemy.orm import foreign, remote
+
+ fallback = sqlalchemy.__dict__.copy()
+ fallback.update({'foreign':foreign, 'remote':remote})
def access_cls(key):
if key in cls._decl_class_registry:
@@ -1407,7 +1411,7 @@ def _deferred_relationship(cls, prop):
elif key in cls.metadata._schemas:
return _GetTable(key, cls.metadata)
else:
- return sqlalchemy.__dict__[key]
+ return fallback[key]
d = util.PopulateDict(access_cls)
def return_cls():