Closed kimko closed 4 years ago
Have you tried to use the latest stable v2.8.2?
You can build the latest version of this module yourself, with ease, just try this: https://gitlab.com/psyhomb/aws-psycopg2
Or you can use already prebuilt modules for python2.7 and python3.7 https://gitlab.com/psyhomb/aws-psycopg2#prebuilt-modules
Hello @psyhomb i hope you are fine ? Please can you help me to use psycopg2 on my lambda fonction with python3.6 ; I am new in aws and python. In hope to read you quickly , Thanks
Hey @iamadouhassane you have everything documented here, just follow the build steps, nothing else. The only prerequisite is Docker, you'll have to install it on the system where you plan to execute these commands.
Essentially you will have to execute:
git clone https://gitlab.com/psyhomb/aws-psycopg2.git
cd aws-psycopg2
export PSYCOPG_VERSION="2.8.2"
export POSTGRESQL_VERSION="9.6.9"
export PYTHON_VERSION="3.6"
export SSL_ENABLED="true"
./build.sh
Afterwards you will have to copy psycopg2
directory into your lambda project directory and that's basically it.
Hello jkehler, Sorry for my late.Thanks you very much for you reponse. Today , i will try to do it and tell you the result; Have a good dayIsmael NB: My english is very bad Le vendredi 31 mai 2019 à 18:40:33 UTC+2, Miloš Bunčić notifications@github.com a écrit :
Hey @iamadouhassane you have everything documented here, just follow the build steps, nothing else.
Essentially you will have to execute: Note: The only prerequisite is Docker has to be installed on the system where you're planning to execute these commands. git clone https://gitlab.com/psyhomb/aws-psycopg2.git cd aws-psycopg2
export PSYCOPG_VERSION="2.8.2" export POSTGRESQL_VERSION="9.6.9" export PYTHON_VERSION="3.6" export SSL_ENABLED="true"
./build.sh Afterwards you will have to copy psycopg2 directory into your lambda project directory and that's all.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
For what it is worth I got this same error on AWS by including psycopg2 dir in a zip file with my lambda function. It had been working for several months and I moved it to a new environment and had this problem. Solution: The initial zip file was created on my mac and the new environment was zipped from windows. By using the zip file from my mac solved the problem.
What's the proper way to solve this issue in 2022? My project was running well with psycopg2
but had to uninstall that and install psycopg2-binary
for it to work in AWS Lambda... That worked in the sense that my API was now running in Lambda, but I am not getting AttributeError: module 'psycopg2' has no attribute 'paramstyle'
having the same issue with AWS lambda as posted here https://github.com/jkehler/awslambda-psycopg2/issues/32 w Using sqlalchemy==1.2.14 I copied the exact same zip file to a linux image (ubuntu 18.04.1 and was not able to reproduce there)
any help appreciated!
module 'psycopg2' has no attribute 'paramstyle': AttributeError Traceback (most recent call last): File "/var/task/lambda_function.py", line 264, in lambda_handler create_sql_objects(ENV_VARS['db_connection']) File "/var/task/lambda_function.py", line 257, in create_sql_objects ENGINE = create_engine(engine_string) File "/var/task/sqlalchemy/engine/__init__.py", line 425, in create_engine return strategy.create(*args, **kwargs) File "/var/task/sqlalchemy/engine/strategies.py", line 89, in create dialect = dialect_cls(**dialect_args) File "/var/task/sqlalchemy/dialects/postgresql/psycopg2.py", line 549, in __init__ PGDialect.__init__(self, **kwargs) File "/var/task/sqlalchemy/dialects/postgresql/base.py", line 2212, in __init__ default.DefaultDialect.__init__(self, **kwargs) File "/var/task/sqlalchemy/engine/default.py", line 200, in __init__ self.paramstyle = self.dbapi.paramstyle AttributeError: module 'psycopg2' has no attribute 'paramstyle'