Pyramid scheme migration

I use "vanilla" Pyramid 1.4 under Gentoo, and I want to make changes to my tables and commit them without deleting the table (and all its data), and then re-creating it. I heard that the solution to this is circuit migration.

As a long-term user of Django, I used django-south , but now I'm using Pyramid. I cannot find a way to handle migrations. I read about sqlalchemy-migrate , which looks really good, but I'm not sure how to make it work with Pyramid.

Is there a way to handle schema migrations in Pyramid 1.4? And if using sqlalchemy-migrate is a smart option, how do I get it to work with Pyramid?

Greetings.

+4
source share
2 answers

Although this does not directly answer your question: instead, did you look at Alembic , the new SQLAlchemy migration tool by Mike Bayer (author of SQLAlchemy)? The development on sqlalchemy-migrate seems to have stopped in January, while Alembic is quite active.

+12
source

As Martin says, I would suggest going with Alembic for your migrations. This is from the creator of SqlAlchemy and should be constantly in sync with any changes to SqlAlchemy.

As for connecting to your infrastructure, then you. I installed it in Bookie, updating env.py in Alembic to download the Pyini file. Here you can see the changes in the code:

https://github.com/mitechie/Bookie/blob/develop/dbversions/env.py#L8

It also loads models so you can use automatic change generation.

Then I manage the migrations through the helpers in my Makefile, which allow me to generate, update, etc.

https://github.com/mitechie/Bookie/blob/develop/Makefile#L67

Perhaps this could be turned into pyramidal p * commands, but I did not. http://pyramid.readthedocs.org/en/latest/narr/commandline.html#writing-a-script

+6
source

Source: https://habr.com/ru/post/1439494/


All Articles