Skip to content

Commit

Permalink
Merge pull request #31 from clearcare/paginate-scan-limit
Browse files Browse the repository at this point in the history
Fix limit/Limit issue.
  • Loading branch information
pcraciunoiu authored Oct 17, 2016
2 parents 933c703 + dcd6e17 commit a7eae62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cc_dynamodb3/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,11 @@ def query_table(table_name_or_class, query_index=None, descending=False, limit=N
return _maybe_table_from_name(table_name_or_class).query(**query_kwargs)


def scan_table(table_name_or_class, exclusive_start_key=None, **scan_kwargs):
def scan_table(table_name_or_class, exclusive_start_key=None, limit=None, **scan_kwargs):
if exclusive_start_key:
scan_kwargs['ExclusiveStartKey'] = exclusive_start_key
if limit is not None:
scan_kwargs['Limit'] = limit
return _maybe_table_from_name(table_name_or_class).scan(**scan_kwargs)


Expand All @@ -280,8 +282,8 @@ def _retrieve_all_matching(query_or_scan_func, *args, **kwargs):
limit = kwargs.pop('limit', None)
paginate = kwargs.pop('paginate', False)
query_or_scan_kwargs = kwargs.copy()
if limit:
query_or_scan_kwargs['Limit'] = limit
if limit and paginate:
query_or_scan_kwargs['limit'] = limit

response = query_or_scan_func(*args, **query_or_scan_kwargs)
total_found = 0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'schematics==1.1.1',
],
tests_require=['pytest', 'mock', 'factory_boy', 'moto'],
version = '0.6.15',
version = '0.6.16',
description = 'A dynamodb common configuration abstraction',
author='Paul Craciunoiu',
author_email='[email protected]',
Expand Down

0 comments on commit a7eae62

Please sign in to comment.