diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-02-20 19:45:08 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-02-20 19:45:08 +0000 |
commit | bec1b4f92ea23e41eebe90d184acff9c2918b175 (patch) | |
tree | 6b7426683d6edc33a3cf1b9f484b9ba989a8b0c6 /lib/sqlalchemy/schema.py | |
parent | 6811d3c8524e092e6f2dcf2d1eb85df5ae38cf4a (diff) | |
download | sqlalchemy-bec1b4f92ea23e41eebe90d184acff9c2918b175.tar.gz |
merged eager loading overhaul rev 1001:1009
this includes:
sql.Alias object keeps track of the immediate thing it aliased as well
as the ultimate non-aliased (usually a Table) object, so that proxied columns can have
a "parent" attribute
some cleanup to SelectBaseMixin.order_by_clause to allow easier access, needs more cleanup
engine has been making two ResultProxies all this time, added "return_raw" quickie flag to
disable that
some cleanup to _get_col_by_original so that it also works for oid columns, new eager load stuff
more aggressively aliaseses orderby's so this was needed
EagerLoader now makes "chains" of unique aliased eager loaders in all cases. no need for
use_alias/selectalias anymore since it aliases every time.
properly detects recursive eager loads and terminates them with a lazyloader, instead of
raising an exception. totally simplified setup() and init() is more straightforward and has
a single codepath now instead of two or three.
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 12b3c7707..857fc3cf7 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -248,10 +248,12 @@ class Column(SchemaItem): self.default = kwargs.pop('default', None) self.foreign_key = None self._orig = None + self._parent = None if len(kwargs): raise ArgumentError("Unknown arguments passed to Column: " + repr(kwargs.keys())) original = property(lambda s: s._orig or s) + parent = property(lambda s:s._parent or s) engine = property(lambda s: s.table.engine) def __repr__(self): @@ -307,6 +309,7 @@ class Column(SchemaItem): c = Column(name or self.name, self.type, fk, self.default, key = name or self.key, primary_key = self.primary_key, nullable = self.nullable, hidden = self.hidden) c.table = selectable c._orig = self.original + c._parent = self if not c.hidden: selectable.columns[c.key] = c if self.primary_key: @@ -369,7 +372,7 @@ class ForeignKey(SchemaItem): def references(self, table): """returns True if the given table is referenced by this ForeignKey.""" - return table._get_col_by_original(self.column) is not None + return table._get_col_by_original(self.column, False) is not None def _init_column(self): # ForeignKey inits its remote column as late as possible, so tables can |