Hi,
I would like to create set of thin wrappers on top of the alembic since we
need some customization. So first thing for me to solve is how to set
*target_metadata* programatically. What I realized by reading documentation
and code is that I need something like:
alembic_cfg = Config("alembic.ini")
alembic_cfg.set_main_option("sqlalchemy.url",
"postgres://user:pass@localhost/testdb")
script = ScriptDirectory.from_config(alembic_cfg)
engine = create_engine(config.db_uri)
with engine.connect() as connection:
env_ctx = EnvironmentContext(config=alembic_cfg, script=script)
env_ctx.configure(connection=connection, target_metadata=Base.metadata)
ctx = env_ctx.get_context()
Next, I want to call *revision* with autogenerate set to True, but I am not
sure how?
Thank you in advance.
Kindest regards
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/bed8e0d1-f6c9-4ada-97eb-efc05936d5fan%40googlegroups.com.