Skip to content

pzmosquito/awslambda-psycopg2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

psycopg2 Python 3 Library for AWS Lambda

Why this fork?

psycopg2 library needs to be compiled in Amazon Linux using a specific Python version. I created the script to automatically compile the library using any Python version.

Due to AWS Lambda missing the required PostgreSQL libraries in the AMI image, we needed to compile psycopg2 with the PostgreSQL libpq.so library statically linked libpq library instead of the default dynamic link.

Prepare

  1. Install Docker.
  2. Download the PostgreSQL source code (.tar.gz), rename to postgresql.tar.gz and put it into sources folder.
  3. Download the psycopg2 source code (.tar.gz), rename to psycopg2.tar.gz and put it into sources folder.

Compile in MacOS/Linux

  • compile: make compile PYTHON=<version> (find available versions here).
  • compile with SSL support: make compile PYTHON=<version> SSL=1

custom compiled psycopg2 library is now ready in the build folder.

Compile in Windows

Makefile is not available on Windows, there're few options:

  • use WSL
  • run docker commands in makefile manually.

About

Python 3 + PostgreSQL 11 + psycopg2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 73.9%
  • Makefile 26.1%