diff options
| author | Alex Schofield <git@ajschof.me> | 2024-08-27 16:00:29 +0100 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2024-08-27 16:00:29 +0100 |
| commit | cbfc98a9f43b5a0dae95337057c18c9dc2a298e3 (patch) | |
| tree | 7762d15b0334be026dc4e3ba206b45b63f7d6611 /src/load_lambda.py | |
| parent | 843f11c302a2a9089c3726342cd1231015f074f7 (diff) | |
| download | de-project-bentley-cbfc98a9f43b5a0dae95337057c18c9dc2a298e3.tar.gz de-project-bentley-cbfc98a9f43b5a0dae95337057c18c9dc2a298e3.zip | |
wip: update TestLambdaHandler & lambda_handler function
Diffstat (limited to 'src/load_lambda.py')
| -rw-r--r-- | src/load_lambda.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/load_lambda.py b/src/load_lambda.py index 11d1d70..39fa27d 100644 --- a/src/load_lambda.py +++ b/src/load_lambda.py @@ -23,18 +23,21 @@ logging.getLogger("botocore").setLevel(logging.INFO) def lambda_handler(event, context): try: uploaded_tables = upload_dfs_to_database() - if not uploaded_tables["uploaded"]: + if uploaded_tables["not_uploaded"]: return { "statusCode": 200, "body": json.dumps("No dataframes were uploaded."), } - return { - "statusCode": 200, - "body": json.dumps( - f"""The following dataframes were uploaded successfully: - {uploaded_tables["uploaded"]} .""" - ), - } + + if uploaded_tables["uploaded"]: + return { + "statusCode": 200, + "body": json.dumps( + f"""The following dataframes were uploaded successfully: + {uploaded_tables["uploaded"]} .""" + ), + } + except Exception as e: logger.error(f"Error: {e}", exc_info=True) return {"statusCode": 500, "body": json.dumps("Internal server error.")} |
