Tutorial for SQLAlchemy as part of the PyDayBCN.
You need PostgreSQL 11 or newer and Python 3.7 or newer (3.6 should work but I have not tested it).
git clone https://github.com/bustawin/sqlalchemy-tutorial
cd sqlalchemy-tutorial
pip3 install -e . -r requirements.txtOptionally, you can have it inside a virtualenv.
We will use a test dummy database in Postgres. Creating this database differs from OS:
- Mac: Execute the
init-db.shfile that exists in this repo:sh init-db.sh. - Linux: As in Mac. However, in some distros like Debian, you will need
to switch to the Postgres user, like
sudo su postgres, to be able to write these commands, as your regular user doesn't have access to the whole PSQL database. - Windows: Add Postgres
/binfromProgram Filesinto the systemPATH. Copy and paste the commands of theinit-db.shfile in your CMD, adding the option-U <postgres-user>to each command, so the command executes with your postgres user. By default the postgres user ispostgresand you are asked to create a password for it during Postgres installation.
I will be available in class to help you with any problem regarding the installation, so don't worry :-). As a minimum, have Postgres, Python, and Git downloaded.
Important
Remember to git pull before the class to ensure you have the latest
version and re-execute pip3 install -e . -r requirements.txt