question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New model for alembic

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frolcommented, Apr 20, 2018

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).

0reactions
luisdemarchicommented, Apr 20, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found