From f99a67aa306e05f59aff95a53079d77378c0a00e Mon Sep 17 00:00:00 2001 From: Devanathan Sabapathy <123671658+DevanathanSabapathy1@users.noreply.github.com> Date: Mon, 5 Feb 2024 10:31:26 -0800 Subject: [PATCH] fixing a bug in logging an extract run (#139) --- core/extract/extract.py | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/core/extract/extract.py b/core/extract/extract.py index b15bf1ee..d2ace40d 100644 --- a/core/extract/extract.py +++ b/core/extract/extract.py @@ -63,25 +63,27 @@ def main(): sys.exit("Failed to load driver") # setting application name for tracking - application = "WorkloadReplicator-Extract" - - host = config.get("source_cluster_endpoint").split(".")[0] - port = int(config.get("source_cluster_endpoint").split(":")[-1].split("/")[0]) - DbUser = config.get("master_username") - DbName = config.get("source_cluster_endpoint").split("/")[-1] - region = config.get("region") - endpoint = config.get('source_cluster_endpoint').split(":")[0] - - response = aws_service_helper.redshift_get_cluster_credentials( - user=DbUser, - database_name=DbName, - cluster_id=host, - region=region) - db_connect(host=endpoint, - port=port, - database=DbName, - password=response['DbPassword'], - username=response['DbUser'], app_name=application) + if config.get("source_cluster_endpoint"): + application = "WorkloadReplicator-Extract" + + host = config.get("source_cluster_endpoint").split(".")[0] + port = int(config.get("source_cluster_endpoint").split(":")[-1] + .split("/")[0]) + DbUser = config.get("master_username") + DbName = config.get("source_cluster_endpoint").split("/")[-1] + region = config.get("region") + endpoint = config.get('source_cluster_endpoint').split(":")[0] + + response = aws_service_helper.redshift_get_cluster_credentials( + user=DbUser, + database_name=DbName, + cluster_id=host, + region=region) + db_connect(host=endpoint, + port=port, + database=DbName, + password=response['DbPassword'], + username=response['DbUser'], app_name=application) # Run extract job (