Hi Mike,
Thanks for the response.
I was trying something like
cfg = Config('my_alembic.ini')
cfg.set_main_option("timezone", "UTC")
cfg.set_main_option("truncate_slug_length", "40")
command.init(cfg, 'my_alembic')

and was expecting the generated my_alembic.ini file to include the
timezone and truncate_slug_length setting, which didn't happen.  I'll
use the approach you suggested.

Thanks for your help!


On Fri, Oct 9, 2020 at 8:30 PM Mike Bayer <mike...@zzzcomputing.com> wrote:
>
> hi there -
>
> this question lacks specifics.   There are no configuration options that are 
> relevant to the "alembic init" command in any case so it's not clear what 
> config settings you are seeing as "ignored"; init uses only the name of the 
> ini file given and this works:
>
> from alembic.config import Config
> from alembic import command
>
>
> alembic_cfg = Config("my_alembic_init.ini")
> command.init(alembic_cfg, "./my_test_init")
>
>
> output:
>
> Creating directory /home/classic/dev/alembic/my_test_init ...  done
>   Creating directory /home/classic/dev/alembic/my_test_init/versions ...  done
>   Generating /home/classic/dev/alembic/my_test_init/script.py.mako ...  done
>   Generating /home/classic/dev/alembic/my_test_init/README ...  done
>   File /home/classic/dev/alembic/my_alembic_init.ini already exists, skipping
>   Generating /home/classic/dev/alembic/my_test_init/env.py ...  done
>   Please edit configuration/connection/logging settings in 
> '/home/classic/dev/alembic/my_alembic_init.ini' before proceeding.
>
> Perhaps you're suggesting that the "my_alembic_init.ini" file should be 
> *written* to include the options that are present in the object?     We are 
> using Python stdlib configparser: 
> https://docs.python.org/3/library/configparser.html   and it is actually news 
> to me that this even includes an option to "write" the file.  I would suggest 
> running alembic.init(), then programmatically reading the .ini file that's 
> generated, as this depends upon lots of settings set up in templates like 
> alembic/templates/generic/alembic.ini.mako which are not otherwise present in 
> Alembic, then add the options you want, then write the file.   this will get 
> you that result, hope this helps.
>
>
>
> On Fri, Oct 9, 2020, at 5:39 PM, 'Car
> ol Guo' via sqlalchemy-alembic wrote:
>
> I noticed that the command.init api ignores any config settings set by 
> cfg.set_main_option or cfg.set_option. Is there any reasons that we could not 
> allow the init file generated by command.ini api to use those user config 
> settings?
>
>
> --
> 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-alembic+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy-alembic/76df5d17-a059-4e42-909d-4d81b132eb3en%40googlegroups.com.
>
>
> --
> You received this message because you are subscribed to a topic in the Google 
> Groups "sqlalchemy-alembic" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/sqlalchemy-alembic/n3Aq5a5y9NM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> sqlalchemy-alembic+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy-alembic/b88b8093-0f1f-4474-9847-f3a9c4ac9588%40www.fastmail.com.

-- 
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-alembic+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy-alembic/CAH1gAzoX9qvnTrJSJst8KpML1vn_C_FB_aiUwqS_cDPv_U5Hkw%40mail.gmail.com.

Reply via email to