SQLAlchemy 2.0 models declared with DeclarativeBase not created (on sqlite) by Alembic #1189
Unanswered
alessandromannini
asked this question in
Usage Questions
Replies: 2 comments 6 replies
-
I would try printing out |
Beta Was this translation helpful? Give feedback.
6 replies
-
(moved to alembic since this is not a sqlalchemy issue) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
i defined some model (see attached txt) using the new declarative syntax of SQLAlchemy and tried to generate the first migration using Alembic (using Flask-Migrate) but I receive the message "No changes detected".
I've tried many solutions without success.
As suggested in the comment I also tried to alter env.py in this way:
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI'))
target_db = current_app.extensions['migrate'].db
from application import models
target_metadata = models.Base.metadata
If I put an "old style" (with Column) declaration in my models a create migration is generated.
Where i'm worng?
Thx
Alessandro
models.txt
Beta Was this translation helpful? Give feedback.
All reactions