awsimple 2.2.7__py3-none-any.whl → 2.3.0__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.

Potentially problematic release.


This version of awsimple might be problematic. Click here for more details.

awsimple/__version__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  __application_name__ = "awsimple"
2
2
  __title__ = __application_name__
3
3
  __author__ = "abel"
4
- __version__ = "2.2.7"
4
+ __version__ = "2.3.0"
5
5
  __author_email__ = "j@abel.co"
6
6
  __url__ = "https://github.com/jamesabel/awsimple"
7
7
  __download_url__ = "https://github.com/jamesabel/awsimple"
awsimple/dynamodb.py CHANGED
@@ -193,6 +193,13 @@ class DBItemNotFound(AWSimpleException):
193
193
  return f"{self.key=} {self.message}"
194
194
 
195
195
 
196
+ class TableNotFound(AWSimpleException):
197
+ def __init__(self, table_name: str):
198
+ self.table_name = table_name
199
+ self.message = f'Table "{self.table_name}" not found'
200
+ super().__init__(self.message)
201
+
202
+
196
203
  @typechecked()
197
204
  def _is_valid_db_pickled_file(file_path: Path, cache_life: Union[float, int, None]) -> bool:
198
205
  is_valid = file_path.exists() and getsize(str(file_path)) > 0
@@ -513,13 +520,22 @@ class DynamoDBAccess(CacheAccess):
513
520
  @lru_cache()
514
521
  def get_primary_keys_dict(self) -> Dict[KeyType, str]:
515
522
  """
516
- Get the table's primary keys.
523
+ Get the table's primary keys. Raise TableNotFound if table does not exist.
517
524
 
518
525
  :return: a dict with the primary key partition key and (optionally) sort key
519
526
  """
520
527
 
521
528
  assert self.resource is not None
522
- return self._get_keys_from_schema(self.resource.Table(self.table_name).key_schema)
529
+ try:
530
+ table = self.resource.Table(self.table_name)
531
+ except ClientError as e:
532
+ if e.response["Error"]["Code"] == "ResourceNotFoundException":
533
+ raise TableNotFound(self.table_name)
534
+ else:
535
+ raise
536
+ key_schema = table.key_schema
537
+ keys = self._get_keys_from_schema(key_schema)
538
+ return keys
523
539
 
524
540
  @lru_cache()
525
541
  def get_primary_partition_key(self) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: awsimple
3
- Version: 2.2.7
3
+ Version: 2.3.0
4
4
  Summary: Simple AWS API for S3, DynamoDB, SNS, and SQS
5
5
  Home-page: https://github.com/jamesabel/awsimple
6
6
  Download-URL: https://github.com/jamesabel/awsimple
@@ -1,8 +1,8 @@
1
1
  awsimple/__init__.py,sha256=8NChv83C13WICTMbi89I78fAKSE3UQtcGq4YwXAl3OU,826
2
- awsimple/__version__.py,sha256=tpBmONFR_MjuaSt3LDsjvTmzAaVOd-Hx4KEAFGBlsxU,323
2
+ awsimple/__version__.py,sha256=ou_bUclq3bwRO56DBjSReyO_DcrTw2lpPq15hmhVUQw,323
3
3
  awsimple/aws.py,sha256=006liY2mXwbPu5kl3-nCgmkpMN7pBqEDetqM1eNbXWU,6365
4
4
  awsimple/cache.py,sha256=5dYf7bh1Dr_pFbkHck4Ym8zrffctv0ERhGJwieRHQH8,7137
5
- awsimple/dynamodb.py,sha256=QLU1vnxPcX5v4nSnf0itLcHRDjKR5KpQQbUSuD96qaA,34850
5
+ awsimple/dynamodb.py,sha256=zCinM2oE26Rtl8Vb9kp8UmgDV1HiVXzSfMiJO-XS8aA,35424
6
6
  awsimple/dynamodb_miv.py,sha256=FcbEn2VbrYxQcgQKqFoWFqVwAkoqJpwZ4Nr5guXgGXM,4619
7
7
  awsimple/logs.py,sha256=A2RmTT90pfFTthfENd7GSsEHSIBJXO8ICHPdA7sEsHY,4278
8
8
  awsimple/mock.py,sha256=32CNU656uC3PBhjCJ4R-WBTtHbSl6VNVkpN8G8XDvsQ,199
@@ -10,9 +10,9 @@ awsimple/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  awsimple/s3.py,sha256=uMEz6NN9hXOfsQNUNJ2YOuKGKlT2xqZ5btJ9zsCHBrY,23243
11
11
  awsimple/sns.py,sha256=LjKj-UxPdfRDQfN10jU_ULjnlEqLmHcuqfRIKX9lkZo,3266
12
12
  awsimple/sqs.py,sha256=yf8a9jGbYzdajeDU3rARFFYoMb3jQ-YJAVNvw4WscW8,13007
13
- awsimple-2.2.7.dist-info/LICENSE,sha256=d956YAgtDaxgxQmccyUk__EfhORZyBjvmJ8pq6zYTxk,1093
14
- awsimple-2.2.7.dist-info/LICENSE.txt,sha256=d956YAgtDaxgxQmccyUk__EfhORZyBjvmJ8pq6zYTxk,1093
15
- awsimple-2.2.7.dist-info/METADATA,sha256=G6NcEE7ZUWuM5OI5BHy4AwpzkAyHI720NbPA8MMCWx8,4815
16
- awsimple-2.2.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
17
- awsimple-2.2.7.dist-info/top_level.txt,sha256=mwqCoH_8vAaK6iYioiRbasXmVCQM7AK3grNWOKp2VHE,9
18
- awsimple-2.2.7.dist-info/RECORD,,
13
+ awsimple-2.3.0.dist-info/LICENSE,sha256=d956YAgtDaxgxQmccyUk__EfhORZyBjvmJ8pq6zYTxk,1093
14
+ awsimple-2.3.0.dist-info/LICENSE.txt,sha256=d956YAgtDaxgxQmccyUk__EfhORZyBjvmJ8pq6zYTxk,1093
15
+ awsimple-2.3.0.dist-info/METADATA,sha256=SQAOmvSYRqftTUXxK05S4BaUPKnpJmfragonG5oUfmM,4815
16
+ awsimple-2.3.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
17
+ awsimple-2.3.0.dist-info/top_level.txt,sha256=mwqCoH_8vAaK6iYioiRbasXmVCQM7AK3grNWOKp2VHE,9
18
+ awsimple-2.3.0.dist-info/RECORD,,