ensuring that table.all() works without id column (fixes #8)

This commit is contained in:
Gregor Aisch 2013-04-30 00:18:06 +02:00
parent 310b9abd81
commit cfe4a0bef6

View File

@ -267,6 +267,7 @@ class Table(object):
self._check_dropped()
if isinstance(order_by, (str, unicode)):
order_by = [order_by]
order_by = filter(lambda o: o in self.table.columns, order_by)
order_by = [self._args_to_order_by(o) for o in order_by]
args = self._args_to_clause(filter)
@ -276,6 +277,10 @@ class Table(object):
rp = self.database.engine.execute(count_query)
total_row_count = rp.fetchone()[0]
if total_row_count > _step and len(order_by) == 0:
_step = total_row_count
log.warn("query cannot be broken into smaller sections because it is unordered")
queries = []
for i in count():