Hello,

I've been using the "Don’t Generate Empty Migrations with Autogenerate" 
cookbook snippet:

http://alembic.readthedocs.org/en/latest/cookbook.html#don-t-generate-empty-migrations-with-autogenerate

I'd now like to also use a rewriter:

writer1 = rewriter.Rewriter()

@writer1.rewrites(ops.CreateTableOp)
def create_table(context, revision, op):
    ...

I couldn't find a way to combine the two, though. I thought something like 
this could work, but it didn't:

writer2 = rewriter.Rewriter()
writer = writer1.chain(writer2)

@writer2.rewrites(ops.MigrationScript)
def process_revision_directives(context, revision, directives):
    ...

Didn't work with ops.MigrateOperation either. Both receive a 
MigrationScript object as third argument instead of the list that can be 
cleared that the cookbook function receives. Plus, 
process_revision_directives gets called 5 times with ops.MigrateOperations.

What am I missing? What's the proper way to both use a rewriter and prevent 
empty migrations from being generated?

Thanks,

Nicolas

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to