Programmatically call revision with autogenerate True does not set context.cmd_options.autogenerate to True
ruben-janssens opened this issue · comments
Describe the bug
When attempting to programmatically generate a new revision of a database and placing a process_revision_directives function in the context in env.py
does not set context.cmd_options.autogenerate
to True
. In addition to this it does also not throw any error readable error. The program just gets in a 'stuck'.
Expected behavior
Throw an error so we know what the problem is or add more documentation regarding the command
module.
To Reproduce
Use the command module and call the revision command with autogenerate
set to True
. In your env.py
do something with config.cmd_opts.autogenerate
. The application will error and you can catch it with a try except but no readable error is given.
Versions.
- OS: Linux
- Python: 3.11
- Alembic: latest
- SQLAlchemy: latest
- Database: psql
hi -
cmd_options is only the command line options. if you dont have a command line then nothing there will be set. When calling programmatically, cmd_opts
is None, so there will not be anything to read.
to get help debugging your program including this "stuck" state, please open a discussion with more detail how you are calling these commands.