Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.25 KB

README.md

File metadata and controls

33 lines (24 loc) · 1.25 KB

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.