diff options
Diffstat (limited to 'lib/sqlalchemy/mapping/mapper.py')
-rw-r--r-- | lib/sqlalchemy/mapping/mapper.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/sqlalchemy/mapping/mapper.py b/lib/sqlalchemy/mapping/mapper.py index 6af044fbb..01dfd05d3 100644 --- a/lib/sqlalchemy/mapping/mapper.py +++ b/lib/sqlalchemy/mapping/mapper.py @@ -602,8 +602,8 @@ class Mapper(object): if not no_sort: if self.order_by: order_by = self.order_by - elif self.table.rowid_column is not None: - order_by = [self.table.rowid_column] + elif self.table.oid_column is not None: + order_by = [self.table.oid_column] else: order_by = None else: @@ -611,8 +611,8 @@ class Mapper(object): if self._should_nest(**kwargs): s2 = sql.select(self.table.primary_key, whereclause, use_labels=True, **kwargs) - if not kwargs.get('distinct', False) and self.table.rowid_column is not None: - s2.order_by(self.table.rowid_column) + if not kwargs.get('distinct', False) and self.table.oid_column is not None: + s2.order_by(self.table.oid_column) s3 = s2.alias('rowcount') crit = [] for i in range(0, len(self.table.primary_key)): @@ -627,12 +627,12 @@ class Mapper(object): if order_by is not None and kwargs.get('order_by', None) is None: statement.order_by(*order_by) # for a DISTINCT query, you need the columns explicitly specified in order - # to use it in "order_by" - in the case we added the rowid column in, + # to use it in "order_by" - in the case we added the oid column in, # add that to the column list # TODO: this idea should be handled by the SELECT statement itself, insuring # that order_by cols are in the select list if DISTINCT is selected - if kwargs.get('distinct', False) and self.table.rowid_column is not None and order_by == [self.table.rowid_column]: - statement.append_column(self.table.rowid_column) + if kwargs.get('distinct', False) and self.table.oid_column is not None and order_by == [self.table.oid_column]: + statement.append_column(self.table.oid_column) # plugin point |