diff --git a/cc_dynamodb3/table.py b/cc_dynamodb3/table.py index 842ebf5..e1c1bd3 100644 --- a/cc_dynamodb3/table.py +++ b/cc_dynamodb3/table.py @@ -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) @@ -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 diff --git a/setup.py b/setup.py index 1c2e4d8..dc8a9fc 100644 --- a/setup.py +++ b/setup.py @@ -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='pcraciunoiu@clearcareonline.com',