On Feb 21, 2012, at 12:57 PM, Chris Withers wrote:

> Hi Mike,
> 
> I've been reading the Alembic docs, and the following popped out:
> 
> - The "partial guid" approach is nice for machines, but a nightmare for 
> humans, looking at a folder full of these can't be fun. Since it's the link 
> in the file that's important, could the files be given friendly names by 
> humans?

The current release does this:

http://alembic.readthedocs.org/en/latest/tutorial.html#the-migration-environment
http:/alembic.readthedocs.org/en/latest/tutorial.html#editing-the-ini-file (see 
"file_template")

> 
> - Curious about this phrase:
> 
> "This means a migration script that pulls some rows into memory via a SELECT 
> statement will not work in --sql mode."
> 
> Why not? The sql will still eventually be executed in the context of a 
> database connection, right?

er well in the context of a connection, but not one where there is any 
application code prepared to receive result rows.     Think "cat myscript.sql | 
psql".

There are ways to declare variables in SQL and assign results to those, so 
those methods are still doable.

If you built a system whereby you were going to read the results of a generated 
SQL script, split the lines back into individual statements, then executed them 
in the context of an application, then you can get results back...but still, 
how is that useful ?   You'd need to execute some subsequent line from the 
script in terms of those results, and to do that you'd need to invent some kind 
of template system within the migration system.

When doing really big table migrations, you sometimes need to create temp 
tables, do big "INSERT ... SELECT" types of operations.   SQLAlchemy has a 
greater need for the "insert from select" construct now.


> 
> - Is there any support for just adding raw lumps of sql as migration steps?

sure just use execute():

op.execute("my raw lump of SQL")

http://alembic.readthedocs.org/en/latest/ops.html#alembic.operations.Operations.execute

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to