Database schema migration tool that works in SQL
This tool helps you to keep track and evolve your database schema (SQL).
It works like this. Whenever you make changes to the database schema you put them into a “migration” - simply an .sql file with a sequence of SQL statements. Sqlturk keeps track of which migrations have been applied and runs them in a guaranteed order.
There are plenty of tools to approach the problem of database schema migration. Here is how sqlturk is different:
- one-way migrations. There is no way to “rollback” a migration. In my experience, “downgrade” scripts are almost never used yet writing them adds considerable burden onto the developer. Their presense may add a false sense of security – since they used so rarely there is a big chance they will not work properly anyway.
- Python-agnostic. Sqlturk operates in terms of SQL DDL. It does not work in terms of SQLAlchemy ORM models or Django’s and thus it can be used in a much wider context. Plain SQL also means that a competent DBA who knows nothing about Python can author these scripts. Or they could be generated automatically by another tool.
- no magic. I wanted a tool that works in an obvious, easy-to-understand way. Changing database schema can have big consequences so it is important to be able to see what’s going on.
>>> from sqlturk.migration import MigrationTool >>> tool = MigrationTool('sqlite:///:memory:', migration_dir='testmigrations') >>> tool.install() # create a database table to track schema changes >>> tool.find_migrations() ['1_foobar', '2_foobar_data', '10_foobar_delete'] >>> tool.run_migrations() >>> tool.find_migrations() # check that all migrations have been applied 
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|sqlturk-0.9.1-py2.5.egg (7.7 kB) Copy SHA256 hash SHA256||Egg||2.5|
|sqlturk-0.9.1-py2.6.egg (8.1 kB) Copy SHA256 hash SHA256||Egg||2.6|
|sqlturk-0.9.1.tar.gz (4.2 kB) Copy SHA256 hash SHA256||Source||None|