I've been working with sqlalchemy/alembic for several years now, but just 
recently stumbled on an important issue.

Here is how I use to work:
1. Issue 
Base.metadata.create_all(engine)
to make sure that missing tables are created 

2. check the current revision by issuing
context.get_current_revision()

3. running 
command.stamp
or 
command.upgrade
if the revision is the latest or not respectively

This worked well up until the point where I needed to change a table name 
since create_all created a new table and then upgrade just failed.

Issuing create_all after the upgrade isn't an option also since changes to 
missing tables will also fail.

What is the proper way of doing this? Before I run to add a create_table in 
each revision I had, I wanted to check if there's a better way of handling 
things.

What's your opinion? If table rename is the only problem with my first 
take, is there a way to exclude a table from create_all using a 'filter' 
function? (that way, I could add a property to the model stating it's 
previous name as check for that property in the 'filter' function...

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to