New model for alembic
See original GitHub issueI created a new model in the project, but it does not exist in the database. I modified the file “alembic.ini” with the following line:
sqlalchemy.url = sqlite: ////Volumes/MacHD/Git/project1/example.db
But when I type “autogenerate”, it presents the following error:
$ alembic revision --autogenerate -m "add intent table"
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
ERROR [alembic.util.messaging] Can't locate revision identified by '82184d7d1e88'
What do I need to do?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Auto Generating Migrations — Alembic 1.9.0 documentation
Alembic can view the status of the database and compare against the table metadata in the application, generating the “obvious” migrations based on...
Read more >How to get Alembic to recognise SQLModel database model?
One approach I've been looking at is to import the SQLalchemy model for Alembic but looking through the source code I can't find...
Read more >How to use alembic for your database migrations? - Medium
As shown above, we have to give the model base file to alembic env file. Now we are all set for our first...
Read more >FastAPI with Async SQLAlchemy, SQLModel, and Alembic
We'll also configure Alembic for handling database migrations. ... Create two new files in "project/app", db.py and models.py.
Read more >Schema migrations with Alembic, Python and PostgreSQL
Some migrations can be trivial if you just add a new table or a new ... Whenever you modify your models you create...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That is the responsibility of Alembic and databases, so there is nothing we can do here. By the way, the databases with transactions support (PostgreSQL, MySQL InnoDB engine only) work as you expected (the changes will be rolled back on failure).
@frol and @khorolets I got it. I made a new class and created automatically. But I think now I have a bug to report:
the “migrate” generated a table creation and a table change I made manually. But in the middle of the script an error was generated since the table being changed could not contain data. I set up and executed the script again. There he went on to make another mistake, because the first function that was to create a table had already been executed.
What I think is a bug: I think if the script went wrong midway, I should undo all the actions from the beginning.