Stamp with engine #888
Unanswered
hyperknot
asked this question in
Usage Questions
Replies: 3 comments 6 replies
-
Created issue #889 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Well alembic needs a way of locating the version directory ect, so the ini file is still needed |
Beta Was this translation helpful? Give feedback.
2 replies
-
running commands with specific engines is illustrated at https://alembic.sqlalchemy.org/en/latest/cookbook.html#sharing-a-connection-with-a-series-of-migration-commands-and-environments my_metadata.create_all(engine)
alembic_cfg = Config()
alembic_cfg.attributes['engine'] = engine
command.stamp(alembic_cfg, "head") place this in your env.py: def run_migrations_online():
engine = config.attributes.get("engine", None)
if engine is None:
engine = engine_from_config(
config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)
... |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think mine is a super common use case, setting up db + stamping, so much that it's the #1 item in the cookbook:
https://alembic.sqlalchemy.org/en/latest/cookbook.html
I'd like to stamp using an engine. I believe it's typical to set up your DB server, extensions, views, create_all(), etc. all using an engine. Afterwards you'd need to stamp head.
Right now I cannot do this, as I'm setting up the engine programmatically and stamping requires an ini file.
Beta Was this translation helpful? Give feedback.
All reactions