Skip to content

Commit

Permalink
Unique files in S3 including pid of target snowflake
Browse files Browse the repository at this point in the history
  • Loading branch information
pslavov committed Aug 8, 2023
1 parent a67ccdc commit dcdd330
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions target_snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ def main():
if args.config:
with open(args.config, encoding="utf8") as config_input:
config = json.load(config_input)
config["s3_key_prefix"] = f"{config['s3_key_prefix']}pid_{str(os.getpid())}/"
else:
config = {}

Expand Down
2 changes: 1 addition & 1 deletion target_snowflake/upload_clients/s3_upload_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def upload_file(self, file, stream, temp_dir=None):
bucket = self.connection_config['s3_bucket']
s3_acl = self.connection_config.get('s3_acl')
s3_key_prefix = self.connection_config.get('s3_key_prefix', '')
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S-%f")
timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

s3_key = f"{s3_key_prefix}pipelinewise_{stream}_{timestamp}_{os.path.basename(file)}"
self.logger.info('Target S3 bucket: %s, local file: %s, S3 key: %s', bucket, file, s3_key)
Expand Down

0 comments on commit dcdd330

Please sign in to comment.