Giter Site home page Giter Site logo

aws-lambda-psycopg2's Introduction

AWS Lambda psycopg2 (python3)

AWS Linux compiled package for postgresql-10.2 and psycopg2-2.7.4

You can also make your own compiled psycopg2 package! To start you'll need access to an AWS Linux instance, the easiest ways to get access to this are via AWS EC2 OR Alternatively, via the offical AWS Linux Docker

Then, simply install your favourite python version i.e. 3.6 and install via: sudo yum install python36

The package itself can be compiled by the following procedure:

  1. Retrieve relevant source code, here it is for postgresql-10.2 and psycopg2-2.7.4 but can be replaced with other versions as needed:

    wget https://www.postgresql.org/ftp/source/v10.2/postgresql-10.2.tar.gz .

    wget http://initd.org/psycopg/tarballs/PSYCOPG-2-7/psycopg2-2.7.4.tar.gz .

  2. Unpack both archives:

    tar -xvzf /postgresql-10.2.tar.gz

    tar -xvzf /psycopg2-2.7.4.tar.gz

  3. Move into the postgres source directory:

    cd postgresql-10.2

    export POST_SRC=`pwd`

Run the following commands:

``` ./configure --prefix $POST_SRC --without-readline --without-zlib ```


```make```


```make install```
  1. Move to the psycopg2 directory:

    cd ../psycopg2-2.7.4

    Modify setup.cfg with the following:

    static_libpq=1

    pg_config=MY_POSTGRES_SRC/bin/pg_config

    where the value MY_POSTGRES_SRC has been replaced by the postgres directory location. This can be retrieved by running:

    echo $POST_SRC

  2. (python3). AWS Linux does not ship with the required python3 development package required here, run:

    yum search python3 | grep devel

    Select the desired python version development package and install, for example:

    sudo yum install -y python36-devel.x86_64

  3. Run python3 setup.py build

  4. Your desired build is now in the build/lib.linux-x86_64-3.6/psycopg2 directory.

aws-lambda-psycopg2's People

Contributors

rmliddle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.