Skip to content

Getting Started with SQL Alchemy, and database schema versioning

Notifications You must be signed in to change notification settings

neilus/sqlAlchemy

Repository files navigation

This is where i get started with SQL Alchemy

Howto get started with this repo

  1. set up your python (virtual) environment

install sqlalchemy and sqlalchemy-migrate, you will also need psychopg

pip install SQLAlchemy sqlalchemy-migrate
sudo apt-get install python-psycopg2
  1. startup PostgreSQL with Vagrant
vagrant up

this will startup a virtual machine based on ubuntu/trusty64, update it and set up the latest PostgreSQL based on PostgreSQL-s Vagrantfile

The output of vagrant up (--provision) will print you how to access the database from CLI, in the python code this has been already set up.

  1. put the database under version control
python manage.py version_control

this will initialize version control over the schema (migrate_version table)

  1. test the change script
python manage.py test
  1. upgrade to the latest version
python manage.py upgrade
0 -> 1...
done

WTF is here?!?

This repo only contains a set of python scripts that i experiment with while getting started with sqlAlchemy and db Schema versioning with PostgreSQL.

  • The Vagrantfile is the PostgreSQL provided virtualized PostgreSQL setup for development.
  • sql_alchemy folder is the db schema versioning rumblings stuff based on this tutorial
  • sqlalchemy*.py_ scripts are simple sample scripts playing with the declarative system, nothing to do with the sql_alchemy repo from the tutorial

About

Getting Started with SQL Alchemy, and database schema versioning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published