aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2024-08-27 16:00:29 +0100
committerAlex Schofield <git@ajschof.me>2024-08-27 16:00:29 +0100
commitcbfc98a9f43b5a0dae95337057c18c9dc2a298e3 (patch)
tree7762d15b0334be026dc4e3ba206b45b63f7d6611 /src
parent843f11c302a2a9089c3726342cd1231015f074f7 (diff)
downloadde-project-bentley-cbfc98a9f43b5a0dae95337057c18c9dc2a298e3.tar.gz
de-project-bentley-cbfc98a9f43b5a0dae95337057c18c9dc2a298e3.zip
wip: update TestLambdaHandler & lambda_handler function
Diffstat (limited to 'src')
-rw-r--r--src/load_lambda.py19
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.")}
git.ajschof.me — hosted by ajschofield — powered by cgit