Skip to content
Discussion options

You must be logged in to vote

this is not built in and would not be that simple because we have things like post write hooks that look for a file.

so the best we could do here would be a recipe that extends on the existing recipe for dont generate empty migrations which adds a render step inside of the custom hook. we have a utility function for this which is render_python_code

this is not tested but it makes use of the x argument to add alembic revision --autogenerate -x print:

from alembic.autogenerate import render_python_code
from mako.template import Template
from alembic import util
from pathlib import Path

def process_revision_directives(context, revision, directives):
    if config.cmd_opts.autogenerate and c…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
2 replies
@CaselIT
Comment options

@ghost
Comment options

Comment options

You must be logged in to vote
5 replies
@zzzeek
Comment options

@ghost
Comment options

@zzzeek
Comment options

@CaselIT
Comment options

@ghost
Comment options

Comment options

You must be logged in to vote
2 replies
@odravison
Comment options

@zzzeek
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants