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.1.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: awslambda-psycopg2-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 85ff66a386be26d5857a2ebebc76ee7fa2856abe917738ae750d3518d306e754
MD5 9543a0cfebe4f9652aa498be7c0fbafe
BLAKE2b-256 e551d1b75e2f68274cf24093158c52aab0d0330dd89ae79bc59364cfcf8d292b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: awslambda_psycopg2-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 034bc328d2ad1425b99ec1ce2874e5843a5e1ec4a6bcbc74ee77ef2188c0abd7
MD5 7c9ac0c9d52b25574a4175992984bf8d
BLAKE2b-256 92bcfffa8c4c7823c2b0c3cc8df16385ca4f47812434a81ee5261d05fce64ae7

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