boto3-assist 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -372,6 +372,7 @@ class DynamoDB(DynamoDBConnection):
372
372
  do_projections: bool = False,
373
373
  ascending: bool = False,
374
374
  strongly_consistent: bool = False,
375
+ limit: Optional[int] = None,
375
376
  ) -> dict:
376
377
  """Helper function to list by criteria"""
377
378
 
@@ -391,6 +392,7 @@ class DynamoDB(DynamoDBConnection):
391
392
  expression_attribute_names=expression_attribute_names,
392
393
  ascending=ascending,
393
394
  strongly_consistent=strongly_consistent,
395
+ limit=limit,
394
396
  )
395
397
 
396
398
  return response
@@ -38,9 +38,11 @@ class DynamoDBImporter:
38
38
  raise FileNotFoundError(f"File not found: {json_file_path}")
39
39
  if json_file_path.endswith(".gz"):
40
40
  data = self.read_gzip_file(json_file_path)
41
- else:
41
+ elif json_file_path.endswith(".json"):
42
42
  with open(json_file_path, "r", encoding="utf-8") as json_file:
43
43
  data = json.load(json_file)
44
+ else:
45
+ raise ValueError(f"Unsupported file type: {json_file_path}")
44
46
 
45
47
  # table = self.db.dynamodb_resource.Table(self.table_name)
46
48
  # with table.batch_writer() as batch:
@@ -58,7 +60,22 @@ class DynamoDBImporter:
58
60
  def import_json_files(self, json_file_paths: list[str]) -> None:
59
61
  """Import multiple json files into the database"""
60
62
  for json_file_path in json_file_paths:
61
- self.import_json_file(json_file_path)
63
+ if os.path.exists(json_file_path) is False:
64
+ raise FileNotFoundError(f"File not found: {json_file_path}")
65
+ else:
66
+ if json_file_path.endswith(".gz") or json_file_path.endswith(".json"):
67
+ self.import_json_file(json_file_path)
68
+ else:
69
+ if os.path.isdir(json_file_path):
70
+ logger.warning(
71
+ f"Unsupported sub directory import {json_file_path}. "
72
+ "Skipping import on this file."
73
+ )
74
+ else:
75
+ logger.warning(
76
+ f"Unsupported file type: {json_file_path}. "
77
+ "Skipping import on this file. Files should end with .gz or .json"
78
+ )
62
79
 
63
80
  def read_gzip_file(self, file_path: str) -> List[dict]:
64
81
  """
boto3_assist/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.1.3'
1
+ __version__ = '0.1.5'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: boto3_assist
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Additional boto3 wrappers to make your life a little easier
5
5
  Author-email: Eric Wilson <boto3-assist@geekcafe.com>
6
6
  License-File: LICENSE-EXPLAINED.txt
@@ -1,12 +1,12 @@
1
1
  boto3_assist/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  boto3_assist/boto3session.py,sha256=J20E2lkqJOaey4Ohi-xRe2xABj7QsA8DrggzK29-5es,6415
3
3
  boto3_assist/connection_tracker.py,sha256=k59-7CdEvo5Slab80wwYz65sE1-sxVP1-wpQhZZXBZo,1632
4
- boto3_assist/version.py,sha256=uZsygMXMKRw-7qhWojAjnpm8GFPXU92xW6XA8O5GwFY,22
5
- boto3_assist/dynamodb/dynamodb.py,sha256=jU4R__5jjI1CmH9xVNUeU8PICD2dtbQ2CYUFKMRw0P0,14561
4
+ boto3_assist/version.py,sha256=DQiXHqQ3C29f_--ye7aVMDPnITrl9M0zMU42LYY48zE,22
5
+ boto3_assist/dynamodb/dynamodb.py,sha256=vV0HvFCESnVK6BcAfcrWsMsNxIIsctvDX_3xdzOVCT0,14623
6
6
  boto3_assist/dynamodb/dynamodb_connection.py,sha256=JMCmWOsMzy45rikGl3Z2xqlG2vUTEKSYqi6dpsfJ750,4418
7
7
  boto3_assist/dynamodb/dynamodb_connection_tracker.py,sha256=nTNQ99sIidDoLMhMbBju2umgLmcttsmnvmd_DMy_J9M,1582
8
8
  boto3_assist/dynamodb/dynamodb_helpers.py,sha256=ajpTJ5bJOm9PDgE2Zx9p2zkTRFV4xswqJRS81SOTn1s,12198
9
- boto3_assist/dynamodb/dynamodb_importer.py,sha256=8SlT2W03Dvb3LIs6xqtzXP4IShyv655PgMCDNr4kmPk,2559
9
+ boto3_assist/dynamodb/dynamodb_importer.py,sha256=nCKsyRQeMqDSf0Q5mQ_X_oVIg4PRnu0hcUzZnBli610,3471
10
10
  boto3_assist/dynamodb/dynamodb_index.py,sha256=LRQgSci222s-pU-JXgnaAoOa71ABX9h3uJPeCVPl1GE,6315
11
11
  boto3_assist/dynamodb/dynamodb_iservice.py,sha256=2AuaKxt7DUZbB-GpBBtPtPMpAlgZkumkAldm8vy7-sg,701
12
12
  boto3_assist/dynamodb/dynamodb_key.py,sha256=X3I3gUPx2T858vjRDi9SN8qn8ez5UJUo0vZiKBeeUWg,1776
@@ -23,8 +23,8 @@ boto3_assist/utilities/datetime_utility.py,sha256=TbqGQkJDTahqvaZAIV550nhYnW1Bsq
23
23
  boto3_assist/utilities/logging_utility.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  boto3_assist/utilities/serialization_utility.py,sha256=s_QQRIhtwIE7xN5nU13mNk2wtWyErBX_Sg7n0gbHj-M,4308
25
25
  boto3_assist/utilities/string_utility.py,sha256=w8l063UT3GE48tuJopETyZrjG4CgAzWkyDWMAYMg5Og,7432
26
- boto3_assist-0.1.3.dist-info/METADATA,sha256=xeuPDWUGFeqRDPD_rCtuZENt7b0-RU-e8SoPbZigwns,1804
27
- boto3_assist-0.1.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
28
- boto3_assist-0.1.3.dist-info/licenses/LICENSE-EXPLAINED.txt,sha256=WFREvTpfTjPjDHpOLADxJpCKpIla3Ht87RUUGii4ODU,606
29
- boto3_assist-0.1.3.dist-info/licenses/LICENSE.txt,sha256=PXDhFWS5L5aOTkVhNvoitHKbAkgxqMI2uUPQyrnXGiI,1105
30
- boto3_assist-0.1.3.dist-info/RECORD,,
26
+ boto3_assist-0.1.5.dist-info/METADATA,sha256=wZVHr-tGr80dNF5c-CNpe57FV3hLiDG7bw7zYZZlz2c,1804
27
+ boto3_assist-0.1.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
28
+ boto3_assist-0.1.5.dist-info/licenses/LICENSE-EXPLAINED.txt,sha256=WFREvTpfTjPjDHpOLADxJpCKpIla3Ht87RUUGii4ODU,606
29
+ boto3_assist-0.1.5.dist-info/licenses/LICENSE.txt,sha256=PXDhFWS5L5aOTkVhNvoitHKbAkgxqMI2uUPQyrnXGiI,1105
30
+ boto3_assist-0.1.5.dist-info/RECORD,,