Open 300LiterPropofol opened 2 years ago
I wasn't able to resolve the issues I was having with this, but I was able to set up psycopg2 using klayers.
Klayers is a compilation of python packages built for lambda. They're given as ARNs - to add them, you can scroll to the bottom of your Lambda function in the Lambda console to Layers, click 'Add Layer' in the top-right, select 'Specify an ARN', then paste the ARN for the package you want.
You can find them in this repo: Klayers Repo
Or you can get a simple list by pasting the API link in your browser:
https://api.klayers.cloud//api/v2/{YOUR PYTHON VERSION}/layers/latest/{YOUR AWS REGION}/html
Enter the version of python in the form p0.0 (e.g. p3.8) and the region in the aws shortform (e.g. eu-west-1).
Hello!
This has been an awesome package and has solved so many issues for me until now.
Currently I am using an AWS lambda which needs
psycopg2
as a required package to connect to a timescaledb in the cloud. I always encounter this error and my code can not work:My code is as below:
I tried the same code when running locally in a terminal and it works without any problem, can create the hypertable and the retention policy in my timescale db in cloud. I also tried
pip3 install psycopg2-binary -t ~/some_local_folder
and paste all installed folders to my lambda function directory and deploy to AWS Lambda together, but that didn't work either and gave the same error.I wonder is this
create_hypertable
andadd_retention_policy
SQL something specifically not supported by AWS lambda platform? I couldn't find any related reports online. It will be really appreciated if you can shine some lights on this. Thank you very much!