ensuring that table.all() works without id column (fixes #8)
This commit is contained in:
parent
310b9abd81
commit
cfe4a0bef6
@ -267,6 +267,7 @@ class Table(object):
|
|||||||
self._check_dropped()
|
self._check_dropped()
|
||||||
if isinstance(order_by, (str, unicode)):
|
if isinstance(order_by, (str, unicode)):
|
||||||
order_by = [order_by]
|
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]
|
order_by = [self._args_to_order_by(o) for o in order_by]
|
||||||
|
|
||||||
args = self._args_to_clause(filter)
|
args = self._args_to_clause(filter)
|
||||||
@ -276,6 +277,10 @@ class Table(object):
|
|||||||
rp = self.database.engine.execute(count_query)
|
rp = self.database.engine.execute(count_query)
|
||||||
total_row_count = rp.fetchone()[0]
|
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 = []
|
queries = []
|
||||||
|
|
||||||
for i in count():
|
for i in count():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user