awsimple 3.9.1__py3-none-any.whl → 3.10.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 +1 -1
- awsimple/dynamodb.py +39 -0
- {awsimple-3.9.1.dist-info → awsimple-3.10.0.dist-info}/METADATA +1 -1
- {awsimple-3.9.1.dist-info → awsimple-3.10.0.dist-info}/RECORD +8 -8
- {awsimple-3.9.1.dist-info → awsimple-3.10.0.dist-info}/WHEEL +0 -0
- {awsimple-3.9.1.dist-info → awsimple-3.10.0.dist-info}/licenses/LICENSE +0 -0
- {awsimple-3.9.1.dist-info → awsimple-3.10.0.dist-info}/licenses/LICENSE.txt +0 -0
- {awsimple-3.9.1.dist-info → awsimple-3.10.0.dist-info}/top_level.txt +0 -0
awsimple/__version__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
__application_name__ = "awsimple"
|
|
2
2
|
__title__ = __application_name__
|
|
3
3
|
__author__ = "abel"
|
|
4
|
-
__version__ = "3.
|
|
4
|
+
__version__ = "3.10.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
|
@@ -17,6 +17,7 @@ from enum import Enum
|
|
|
17
17
|
import decimal
|
|
18
18
|
from decimal import Decimal
|
|
19
19
|
from functools import lru_cache
|
|
20
|
+
from collections.abc import Iterable
|
|
20
21
|
from logging import getLogger
|
|
21
22
|
|
|
22
23
|
|
|
@@ -858,6 +859,44 @@ class DynamoDBAccess(CacheAccess):
|
|
|
858
859
|
self.metadata_table.update_table_mtime()
|
|
859
860
|
return count
|
|
860
861
|
|
|
862
|
+
@typechecked()
|
|
863
|
+
def dump_to_csv(self, file_path: Path):
|
|
864
|
+
"""
|
|
865
|
+
Dump the table to a CSV file.
|
|
866
|
+
|
|
867
|
+
:param file_path: output CSV file path
|
|
868
|
+
"""
|
|
869
|
+
import csv
|
|
870
|
+
|
|
871
|
+
original_rows = self.scan_table()
|
|
872
|
+
if len(original_rows) == 0:
|
|
873
|
+
log.warning(f"table {self.table_name} is empty, not writing {file_path}")
|
|
874
|
+
return
|
|
875
|
+
|
|
876
|
+
# get all field names with simple data types (no iterables)
|
|
877
|
+
field_names_set = set()
|
|
878
|
+
filtered_rows = []
|
|
879
|
+
for original_row in original_rows:
|
|
880
|
+
filtered_row = {}
|
|
881
|
+
for key, value in original_row.items():
|
|
882
|
+
# only include "simple" data types (i.e. no lists, sets, dicts, etc.)
|
|
883
|
+
if not isinstance(value, Iterable) or isinstance(value, (str, bytes, bytearray)):
|
|
884
|
+
field_names_set.add(key)
|
|
885
|
+
filtered_row[key] = value
|
|
886
|
+
if len(filtered_row) > 0:
|
|
887
|
+
filtered_rows.append(filtered_row)
|
|
888
|
+
field_names = sorted(field_names_set)
|
|
889
|
+
|
|
890
|
+
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
891
|
+
with open(file_path, "w", newline="") as csvfile:
|
|
892
|
+
writer = csv.DictWriter(csvfile, fieldnames=field_names)
|
|
893
|
+
writer.writeheader()
|
|
894
|
+
for filtered_row in filtered_rows:
|
|
895
|
+
writer.writerow(dynamodb_to_dict(filtered_row))
|
|
896
|
+
|
|
897
|
+
log.info(f"wrote {len(filtered_rows)} rows to {file_path}")
|
|
898
|
+
|
|
899
|
+
|
|
861
900
|
|
|
862
901
|
metadata_table_name = f"__{__application_name__}_metadata__"
|
|
863
902
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
awsimple/__init__.py,sha256=yo9COyuJZonzuW_5h2yvsQOtTqnwh8e_iMsMBqQxir0,964
|
|
2
|
-
awsimple/__version__.py,sha256=
|
|
2
|
+
awsimple/__version__.py,sha256=7f2QtdJhuSXcZ0FT7TWbKMnjn0kMNBF-iRvyVI8FxF8,324
|
|
3
3
|
awsimple/aws.py,sha256=NbRu1v_J5j2-pcefNZ5Xggii3mM9nHpeHMz9L9K9r-U,7653
|
|
4
4
|
awsimple/cache.py,sha256=_LvPx76215t8KhAJOin6Pe2b4lWpB6kbKpdzgR4FeA4,7206
|
|
5
|
-
awsimple/dynamodb.py,sha256=
|
|
5
|
+
awsimple/dynamodb.py,sha256=07Qz9j0GB5de5k6-OraDR3YCxTzIJa72jKGu5XWG9aY,40674
|
|
6
6
|
awsimple/dynamodb_miv.py,sha256=4xPxQDYkIM-BVDGyAre6uqwJHsxguEbHbof8ztt-V7g,4645
|
|
7
7
|
awsimple/logs.py,sha256=s9FhdDFWjfxGCVDx-FNTPgJ-YN1AOAgz4HNxTVfRARE,4108
|
|
8
8
|
awsimple/mock.py,sha256=eScbnxFF9xAosOAsL-NZgp_P-fezB6StQMkb85Y3TNo,574
|
|
@@ -12,9 +12,9 @@ awsimple/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
12
12
|
awsimple/s3.py,sha256=ydYLDj51b38lYI6LsJlc4i0PDj2vnWBuSkzdRKcWAUg,23858
|
|
13
13
|
awsimple/sns.py,sha256=T_FyN8eSmBPo213HOfB3UBlMrvtBK768IaRo_ks-7do,3526
|
|
14
14
|
awsimple/sqs.py,sha256=9ZY7161CpmYpcxlCFIfW8bvMn9SGl4cgGR79I4MFLDk,17281
|
|
15
|
-
awsimple-3.
|
|
16
|
-
awsimple-3.
|
|
17
|
-
awsimple-3.
|
|
18
|
-
awsimple-3.
|
|
19
|
-
awsimple-3.
|
|
20
|
-
awsimple-3.
|
|
15
|
+
awsimple-3.10.0.dist-info/licenses/LICENSE,sha256=d956YAgtDaxgxQmccyUk__EfhORZyBjvmJ8pq6zYTxk,1093
|
|
16
|
+
awsimple-3.10.0.dist-info/licenses/LICENSE.txt,sha256=d956YAgtDaxgxQmccyUk__EfhORZyBjvmJ8pq6zYTxk,1093
|
|
17
|
+
awsimple-3.10.0.dist-info/METADATA,sha256=u4tpQmqUL8lZXkDPRbKC83mgZ_Sk8fcK5h7EFOdMNxU,6641
|
|
18
|
+
awsimple-3.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
awsimple-3.10.0.dist-info/top_level.txt,sha256=mwqCoH_8vAaK6iYioiRbasXmVCQM7AK3grNWOKp2VHE,9
|
|
20
|
+
awsimple-3.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|