initial stage

This commit is contained in:
Giambattista Bloisi 2024-06-10 09:23:18 +02:00
parent 5fceeb8b61
commit d7e3e7a1b7
1 changed files with 5 additions and 2 deletions

View File

@ -37,8 +37,11 @@ def s3_untar():
s3_obj = hook.get_key(context["params"]["src_key"], bucket_name=context["params"]["src_bucket"])
with tarfile.open(fileobj=s3_obj.get()["Body"], mode='r|') as tar:
for member in tar:
hook.load_file_obj(tar.extractfile(member.name),
context["params"]["dst_key_prefix"] + member.name,
dst_key = context["params"]["dst_key_prefix"] + member.name
dst_key = dst_key.replace('//', '/')
print(f"Extracting {member.name} to {dst_key}")
hook.load_file_obj(tar.extractfile(member),
dst_key,
context["params"]["dst_bucket"],
replace=True)