Skip to content

Instantly share code, notes, and snippets.

@ddbs
Last active December 14, 2020 23:17
Show Gist options
  • Save ddbs/36416c36e182dd215320 to your computer and use it in GitHub Desktop.
Save ddbs/36416c36e182dd215320 to your computer and use it in GitHub Desktop.
python, sqlalchemy

Python & SQLAlchemy

Sessions

To get started, create a new project in a directory, and cd into it. Then initialize and activate a virtual environment:

sudo apt-get update
sudo apt-get install python3.4-venv
python3 -m venv env
source env/bin/activate

Next, install SQLAlchemy and psycopg2 using

pip install sqlalchemy psycopg2

Then create a new Postgres database for the project by running:

createdb tbay
sudo apt-get install python3-sqlalchemy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment