Skip to main content

A aws psycopg2 package from psycopg2.

Project description

psycopg2 Python Library for AWS Lambda

This is a custom compiled psycopg2 C library for Python. 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.I am just using the follwing git source and uploaded to https://pypi.org/

Install and setup

pip install aws-psycopg2

Source code : https://github.com/jkehler/awslambda-psycopg2/tree/master/psycopg2

Instructions on compiling this package from scratch

Here was the process that was used to build this package. You will need to perform these steps if you want to build a newer version of the psycopg2 library.

  1. Download the PostgreSQL source code and extract into a directory.
  2. Download the psycopg2 source code and extract into a directory.
  3. Go into the PostgreSQL source directory and execute the following commands:
  • ./configure --prefix {path_to_postgresql_source} --without-readline --without-zlib
  • make
  • make install
  1. Go into the psycopg2 source directory and edit the setup.cfg file with the following:
  • pg_config={path_to_postgresql_source/bin/pg_config}
  • static_libpq=1
  1. Execute python setup.py build in the psycopg2 source directory.

After the above steps have been completed you will then have a build directory and the custom compiled psycopg2 library will be contained within it. Copy this directory into your AWS Lambda package and you will now be able to access PostgreSQL from within AWS Lambda using the psycopg2 library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

awslambda-psycopg2-1.0.2.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

awslambda_psycopg2-1.0.2-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file awslambda-psycopg2-1.0.2.tar.gz.

File metadata

  • Download URL: awslambda-psycopg2-1.0.2.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for awslambda-psycopg2-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8426f35ee860e787b0dd68bc1f12d47e051f1944e34cefc874d11e46fe446c2c
MD5 d3cc9fefe41bbafe1e1c9bbe62012be7
BLAKE2b-256 6fd829d5b4978f320b530071850ab5c00cdd5ffbf15cc6dad1adf6b9c3096ead

See more details on using hashes here.

File details

Details for the file awslambda_psycopg2-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: awslambda_psycopg2-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for awslambda_psycopg2-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a10d824b498c3fb9d7703eaaffbdf5c675b379f326a0fdb969252801e8a9731
MD5 714bb51680e6813a66043b4db268f669
BLAKE2b-256 2b00f4a787233ed55e7339f0f5450f40cc11e5db62e8b85f12d6deaaa1902151

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page