From 0f695c6efb2eb086705943193bb40f1c77296299 Mon Sep 17 00:00:00 2001 From: James Ray Date: Thu, 5 Nov 2026 14:18:58 -0800 Subject: [PATCH] Name the psycopg2 dialect explicitly for the MetaTracker engine SQLAlchemy 2.1 (24 September 2026) made psycopg (v3) the default driver for plain "postgresql://" URLs. The image installs psycopg2-binary, so every processing image built since 7 October fails the MetaTracker step with "No module named 'psycopg'": the file is still calibrated and uploaded, but its metadata never reaches RDS. dev-padre has logged this since its 22 October image. Spell out "postgresql+psycopg2://" where the SQLAlchemy engine is built. The failed-file reprocessing query already uses psycopg2 directly with a libpq URL and is unaffected. Co-Authored-By: Claude Fable 5.1 --- lambda_function/src/file_processor/file_processor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lambda_function/src/file_processor/file_processor.py b/lambda_function/src/file_processor/file_processor.py index 6621f7e..b18366d 100755 --- a/lambda_function/src/file_processor/file_processor.py +++ b/lambda_function/src/file_processor/file_processor.py @@ -420,8 +420,12 @@ def _track_file_metatracker( client = session.client(service_name="secretsmanager") response = client.get_secret_value(SecretId=secret_arn) secret = json.loads(response["SecretString"]) + # Name the DBAPI explicitly. SQLAlchemy 2.1 made psycopg (v3) the + # default driver for plain "postgresql://" URLs, but this image + # installs psycopg2-binary, so a bare scheme fails with + # "No module named 'psycopg'" and the file is never tracked. connection_string = ( - f"postgresql://{secret['username']}:{secret['password']}@" + f"postgresql+psycopg2://{secret['username']}:{secret['password']}@" f"{secret['host']}:{secret['port']}/{secret['dbname']}" )