I expected that flask upgrade --sql generates only the diff SQL based on the last version, but I noticed that this doesn't happens. Is there any reason behind that? The migration purpose, I think, it's about differential, incremental changes. But I received the whole thing in the sql version.
By another hand, the alembic revision written in Python it's correct, it's differential. Hence, I suppose this is a problem of Flask-Migrate
BTW, I use the following requirements on my projec along python 3.6.12t:
"Flask==1.1.2",
"Flask-SQLAlchemy==2.4.4",
"Flask-Migrate==2.5.3",
Thank for your time.
The --sql option does not generate a diff from the current version. Have you read the Alembic docs for it? https://alembic.sqlalchemy.org/en/latest/offline.html.
The --sql option does not generate a diff from the current version. Have you read the Alembic docs for it? https://alembic.sqlalchemy.org/en/latest/offline.html.
Oh, my bad! You are right. Do you have any idea the motivation behind this? This is uncommon given the main usage of migrations
Oh! There is a way! Thanks for pointing the documentation. I did the trick using the range revision as:
alembic upgrade 1975ea83b712:ae1027a6acf --sql > migration.sql
By another hand, I think the documentation of Flask-Migrate could be more clear about that. I didn't found anything about that
@ryukinix Right, this is because Flask-Migrate is a wrapper for Alembic to make it more accessible to Flask, not an Alembic replacement. I feel I do not have to duplicate the Alembic documentation.
@ryukinix Right, this is because Flask-Migrate is a wrapper for Alembic to make it more accessible to Flask, not an Alembic replacement. I feel I do not have to duplicate the Alembic documentation.
Ok, that makes sense. I'll close this issue since this was resolved and a documentation modification is not wanted.
Most helpful comment
The
--sqloption does not generate a diff from the current version. Have you read the Alembic docs for it? https://alembic.sqlalchemy.org/en/latest/offline.html.