2

I'm trying to abstract some functionality from my models into a Mixin, and I don't actually want to change any tables — I just want to check to make sure I've done this correctly.

How can I see what changes alembic detects without creating a revisions file? Or is my only option to run alembic revision --autogenerate -m "...", then delete the file?

Jesse
  • 860
  • 1
  • 11
  • 13
  • 1
    I think creating a revision and deleting it is the only option. Is there a reason you didn't want to do that? – Jessie Mar 23 '22 at 18:56
  • Not really, just wondering if there might be a quicker way (also one that doesn't have the risk that you forget to delete the revision and end up somewhere you don't want to be). – Jesse Mar 23 '22 at 18:59
  • 1
    Certainly you could generate the revision file and then immediately move it out of the `versions` folder so you don't accidentally leave it "lying around". – Gord Thompson Mar 23 '22 at 19:52

1 Answers1

1

Alembic v1.9.0 (https://alembic.sqlalchemy.org/en/latest/changelog.html#change-1.9.0) introduced a new check command:

Added new Alembic command alembic check. This performs the widely requested feature of running an “autogenerate” comparison between the current database and the MetaData that’s currently set up for autogenerate, returning an error code if the two do not match, based on current autogenerate settings. Pull request courtesy Nathan Louie.

bmakan
  • 332
  • 3
  • 11