SQLAlchemyGrate Publisher's description
from Andrey Petrov
This is my silly (yet effective) migration framework built on SQLAlchemy вЂ” the best database abstraction library in the universe.
This is my silly (yet effective) migration framework built on SQLAlchemy вЂ” the best database abstraction library in the universe. Grate doesn't do fancy things like track schema versions and do step-through upgrade/downgrade paths or testing. Buuut, you can create a wrapper around it to do all these things using the upgrade command.
One thing grate does well out of the box is a stupid row-by-row re-insert from one SQLAlchemy target engine to another. This means you can make changes to your SQLAlchemy schema as you please, then to port your data you create another database and do a row-by-row re-insert from the old dataset into the new. You can even provide a conversion function that will transform the data when necessary.
Warning: Consider this beta quality. There is a lack of error checking so you may get rogue exceptions raised. More features and helpers are being added.
Usage: grate COMMAND [ARGS ...]
Really silly schema migration framework, built for SQLAlchemy.
migrate ENGINE_FROM ENGINE_TO
Migrate schema or data from one engine to another.
upgrade ENGINE UPGRADE_FN
Perform in-place upgrade of a schema in an engine.
grate migrate "mysql://foo:bar@localhost/baz" "sqlite:///:memory:"
--metadata model.meta:metadata --verbose
grate upgrade "mysql://foo:bar@localhost/baz" migration.001_change_fancy_column:upgrade
Hint: The upgrade command can also be used to downgrade, just point it
to the relevant downgrade function. For extra awesomeness, use schema-altering
DDLs provided by sqlalchemy-migrate.
-h, --help show this help message and exit
-v, --verbose Enable verbose output. Use twice to enable debug
--show-sql Echo SQLAlchemy queries.
Only perform migration on the given tables. (comma-
separated table names)
Skip migration on the given tables. (comma-separated
--limit=LIMIT Number to select per insert loop. (default: 100000)
MetaData object bound to the target schema definition.
--convert=FN (Optional) Convert function to run data through.
System Requirements:No special requirements.
Program Release Status:
Program Install Support: Install and Uninstall