1

For development purposes I am using sqlite, though I expect to use postgres in the production environment.

I see that alembic supports multiple databases.

What I am less clear on is whether the migration scripts for different database engines are the same -- in other words, can I use the same migration scripts for postgres and for sqlite, or should I maintain entirely separate alembic environments for them?

user2449525
  • 158
  • 8
  • Why don't you use postgresql for development/testing as well? – van Nov 16 '15 at 13:19
  • Because with multiple developers working on the project it's easier to work on the code without all of them having to have a local postgres running. – user2449525 Nov 17 '15 at 09:20
  • Possible duplicate of [SQLite in development, PostgreSQL in production—why not?](http://stackoverflow.com/questions/10859186/sqlite-in-development-postgresql-in-production-why-not) – iled Feb 09 '16 at 16:13
  • I'm marking this as a possible duplicate of http://stackoverflow.com/questions/10859186/sqlite-in-development-postgresql-in-production-why-not as this seems to be a generic question, valid for both python + sqlalchemy + whatever or ruby on rails + heroku (tags on that question). In fact, it has an even more possible duplicated, although with no answers: http://stackoverflow.com/questions/28870255/synchronize-schemas-in-both-development-and-deployment-using-alembic – iled Feb 09 '16 at 16:14
  • I'd argue that this question is not a duplicate as it asks whether the same migrations will work on multiple backends, not whether it's sensible to use a different database in dev than production. There are other scenarios where you might want migrations to work on multiple databases. – Stephen Paulger Apr 13 '17 at 15:31

1 Answers1

1

Alembic migrations are written with SQLAlchemy datatypes. SQLAlchemy has types that are generic and types that are vendor specific.

If you use vendor specific datatypes then your migrations won't work across multiple vendors. Otherwise they should.

For more information about types in SQLAlchemy check http://docs.sqlalchemy.org/en/rel_1_1/core/type_basics.html

Stephen Paulger
  • 5,204
  • 3
  • 28
  • 46