Generating migrations as SQL scripts should not infer connection status

76 views
Skip to first unread message

Alexander Martin

unread,
Feb 27, 2015, 4:26:09 PM2/27/15
to sqlalchem...@googlegroups.com
A major capability of Alembic is to generate migrations as SQL scripts, instead of running them against the database - this is also referred to as offline mode.

I apologize if this seems pedantic, but I can't seem to understand why preferring a generated SQL script would infer being offline. 
Sure, one could be offline, but one could also be online... 
It would be nice to be able generate SQL while also obtaining the database's current version from the alembic_version table.

Michael Bayer

unread,
Feb 27, 2015, 11:25:52 PM2/27/15
to sqlalchem...@googlegroups.com



On Feb 27, 2015, at 4:26 PM, Alexander Martin <ama...@leadid.com> wrote:

A major capability of Alembic is to generate migrations as SQL scripts, instead of running them against the database - this is also referred to as offline mode.

I apologize if this seems pedantic, but I can't seem to understand why preferring a generated SQL script would infer being offline. 

Because the end result is a text file containing sql commands, not an invocation of sql commands against an active database connection.    This SQL script is also generated without the need to connect to the database at all.

Sure, one could be offline, but one could also be online... 
It would be nice to be able generate SQL while also obtaining the database's current version from the alembic_version table.

Simply call "alembic current" in order to obtain this information.  Easy enough to combine it into one line using the shell.


--
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-alem...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages