can someone tell me how to reset Alembic back to the state of my DB

10,277 views
Skip to first unread message

dewey

unread,
Dec 30, 2014, 8:49:03 PM12/30/14
to sqlal...@googlegroups.com
I first installed Alembic and while practicing, I created a first revision.

I made some changes in my Declarative models in code
And then I used SA to blow away my DB and recreate the whole schema new again

And then I made a few more changes to my models  (oops)  AND loaded a bunch of data

Now, I can't figure out how to get Alembic back into parity....

Can I point it at the DB to get it's "base" and then point it at my models to create a brand-new, first revision??

I'm kind of stumped.....

As a worst case, I've used SA to create a new parallel schema (in sync with current models) and I can select all the old data into it but I still need to know how to tell Alembic to forget (delete) all prior revisions and start over.

Thanks for any tips!!
Dewey

dewey

unread,
Dec 30, 2014, 9:01:24 PM12/30/14
to sqlal...@googlegroups.com
Ok, I went ahead and just copied all the data into the clean new schema.
So now my actual DB is in sync with my SA declarative models.

How do I get Alembic to start tracking fresh from this point  (ie delete any old revisions or old history)??

Thanks,
D

AM

unread,
Dec 30, 2014, 9:47:38 PM12/30/14
to sqlal...@googlegroups.com
Blow away the alembic versions table from the database and the folder
with the versions file and patches files on disk and you should be good
to go.

HTH
AM
> --
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlalchemy+...@googlegroups.com
> <mailto:sqlalchemy+...@googlegroups.com>.
> To post to this group, send email to sqlal...@googlegroups.com
> <mailto:sqlal...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

dewey

unread,
Dec 31, 2014, 10:13:01 AM12/31/14
to sqlal...@googlegroups.com
Excellent!!  Thank you.
D
Reply all
Reply to author
Forward
0 new messages