aws-psycopg2
aws-psycopg2 copied to clipboard
ModuleNotFoundError in AWS Python 3.12 images
When using aws-psycopg2 in the AWS public.ecr.aws/lambda/python:3.12
image the error ModuleNotFoundError: No module named 'psycopg2._psycopg'
is produced when using the sqlalchemy
package.
@bassicallychris Without offering a solution using this library, when using public.ecr.aws/lambda/python:3.12
I just use the psycopg2-binary
Thanks for the response @alexandreczg. According to the psycopg2 documentation psycopg2-binary isn't meant for production use.
If you are the maintainer of a published package depending on psycopg2 you shouldn’t use psycopg2-binary as a module dependency. For production use you are advised to use the source distribution.
Ideally we are able to leverage a version of psycopg2 for aws-lambdas that is based on the source distribution.
ah, that's good to know, haven't read that advisory. I guess gotta find a way to build it myself, seems like this lib here has lost support.