tracktolib 0.47.1__py3-none-any.whl → 0.48.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.
- tracktolib/pg_sync.py +5 -2
- tracktolib/s3/s3.py +32 -4
- {tracktolib-0.47.1.dist-info → tracktolib-0.48.0.dist-info}/METADATA +1 -1
- {tracktolib-0.47.1.dist-info → tracktolib-0.48.0.dist-info}/RECORD +6 -6
- {tracktolib-0.47.1.dist-info → tracktolib-0.48.0.dist-info}/LICENSE +0 -0
- {tracktolib-0.47.1.dist-info → tracktolib-0.48.0.dist-info}/WHEEL +0 -0
tracktolib/pg_sync.py
CHANGED
|
@@ -126,9 +126,12 @@ def insert_csv(
|
|
|
126
126
|
exclude_columns: Iterable[str] | None = None,
|
|
127
127
|
delimiter: LiteralString = ",",
|
|
128
128
|
block_size: int = 1000,
|
|
129
|
+
on_conflict: LiteralString = "ON CONFLICT DO NOTHING",
|
|
129
130
|
):
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
_columns = cast(LiteralString, csv_path.open().readline())
|
|
132
|
+
_tmp_table, _tmp_query, _insert_query = get_tmp_table_query(
|
|
133
|
+
schema, table, columns=_columns.split(","), on_conflict=on_conflict
|
|
134
|
+
)
|
|
132
135
|
_query: Query = query or cast(
|
|
133
136
|
LiteralString,
|
|
134
137
|
f"""
|
tracktolib/s3/s3.py
CHANGED
|
@@ -51,12 +51,40 @@ async def download_file(client: AioBaseClient, bucket: str, path: str) -> BytesI
|
|
|
51
51
|
return _file
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
async def delete_file(client: AioBaseClient, bucket: str, path: str) ->
|
|
54
|
+
async def delete_file(client: AioBaseClient, bucket: str, path: str) -> dict:
|
|
55
55
|
"""
|
|
56
|
-
Delete a file from
|
|
57
|
-
|
|
56
|
+
Delete a file from an S3 bucket.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
client (AioBaseClient): The client to interact with the S3 service.
|
|
60
|
+
bucket (str): The name of the S3 bucket.
|
|
61
|
+
path (str): The path to the file within the S3 bucket.
|
|
62
|
+
|
|
63
|
+
Return:
|
|
64
|
+
dict: The response from the S3 service after attempting to delete the file.
|
|
65
|
+
This typically includes metadata about the operation, such as HTTP status code,
|
|
66
|
+
any errors encountered, and information about the deleted object.
|
|
67
|
+
"""
|
|
68
|
+
return await client.delete_object(Bucket=bucket, Key=path) # type:ignore
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
async def delete_files(client: AioBaseClient, bucket: str, paths: list[str], quiet: bool = True) -> dict:
|
|
72
|
+
"""
|
|
73
|
+
Delete multiple files from an S3 bucket.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
client (AioBaseClient): The client to interact with the S3 service.
|
|
77
|
+
bucket (str): The name of the S3 bucket.
|
|
78
|
+
paths (str): The paths to the files to delete within the S3 bucket.
|
|
79
|
+
quiet (bool): Whether to suppress printing messages to stdout (default: True).
|
|
80
|
+
|
|
81
|
+
Return:
|
|
82
|
+
dict: The response from the S3 service after attempting to delete the files.
|
|
83
|
+
This typically includes metadata about the operation, such as HTTP status code,
|
|
84
|
+
any errors encountered, and information about the deleted object.
|
|
58
85
|
"""
|
|
59
|
-
|
|
86
|
+
delete_request = {"Objects": [{"Key": path} for path in paths], "Quiet": quiet}
|
|
87
|
+
return await client.delete_objects(Bucket=bucket, Delete=delete_request) # type:ignore
|
|
60
88
|
|
|
61
89
|
|
|
62
90
|
class S3Item(TypedDict):
|
|
@@ -6,14 +6,14 @@ tracktolib/logs.py,sha256=enezPjBU4v2s8knG_V6kIbQsoyxfNIKEpKVSSkr_2U8,2212
|
|
|
6
6
|
tracktolib/pg/__init__.py,sha256=32kKBJzIDyppszZMAOSMgM3ggz7Ow0TaNKiMs740gyw,333
|
|
7
7
|
tracktolib/pg/query.py,sha256=cOmMhAjCDvcNJpIDh2OJP3AQK-Ax-dZQpNj5nZTk06Y,13600
|
|
8
8
|
tracktolib/pg/utils.py,sha256=cL24KEt4SWJQ7LJPzaO3c8Xg0ZLmjhn22DtTWg86nwc,6324
|
|
9
|
-
tracktolib/pg_sync.py,sha256=
|
|
9
|
+
tracktolib/pg_sync.py,sha256=pjeHuLmBAkof16FhPXfFyK4nfThEnsISF3US5lzBw-0,5105
|
|
10
10
|
tracktolib/pg_utils.py,sha256=8DDlZVSgfNie9M-zL7wilFufXMMvSPw5d7aIDs_pQCM,1976
|
|
11
11
|
tracktolib/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
tracktolib/s3/minio.py,sha256=JaRpHOM6NqpMieplp58Fpc7uTh7PItyP8On7jMXhB-Q,1234
|
|
13
|
-
tracktolib/s3/s3.py,sha256=
|
|
13
|
+
tracktolib/s3/s3.py,sha256=d0Q63Zb62ef4jAt05zQwpgYvAoxHC9kSQuHzzK90VvE,4825
|
|
14
14
|
tracktolib/tests.py,sha256=FS0uae3ShiiJOD7WE2WEv9h3QwRJCbLDHpe_8Ikc0j0,554
|
|
15
15
|
tracktolib/utils.py,sha256=usiUYVwMa43RvqpKJmQDmzhvfahSVMW0OAcyVWWfPkg,5323
|
|
16
|
-
tracktolib-0.
|
|
17
|
-
tracktolib-0.
|
|
18
|
-
tracktolib-0.
|
|
19
|
-
tracktolib-0.
|
|
16
|
+
tracktolib-0.48.0.dist-info/LICENSE,sha256=uUanH0X7SeZEPdsRTHegMSMTiIHMurt9H0jSwEwKE1Y,1081
|
|
17
|
+
tracktolib-0.48.0.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
|
|
18
|
+
tracktolib-0.48.0.dist-info/METADATA,sha256=TGeH5iSuqaYGes5t4WMhY6a78oWjWgT-9rtYOEnUCCU,3610
|
|
19
|
+
tracktolib-0.48.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|