From 2c8ecc4ef2d5a465802d3367ca07fa50aa9cf126 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 30 Jul 2017 13:00:05 +0100 Subject: [PATCH] Make alembic use our db connection instead of their own --- alembic.ini | 2 -- migrations/env.py | 9 +++++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/alembic.ini b/alembic.ini index 1efc2f6..aeba60c 100644 --- a/alembic.ini +++ a/alembic.ini @@ -29,8 +29,6 @@ # are written from script.py.mako # output_encoding = utf-8 -sqlalchemy.url = postgresql://dave:dave@127.0.0.1/dave - # Logging configuration [loggers] keys = root,sqlalchemy,alembic diff --git a/migrations/env.py b/migrations/env.py index 724c1df..ebe8a83 100644 --- a/migrations/env.py +++ a/migrations/env.py @@ -1,6 +1,6 @@ from __future__ import with_statement from alembic import context -from sqlalchemy import engine_from_config, pool +from sqlalchemy import pool from logging.config import fileConfig import os import sys @@ -9,7 +9,7 @@ parent_dir = os.path.abspath(os.path.join(basepath, "..")) sys.path.append(parent_dir) -from dave.config import config as dave_config +from dave.config import db, config as dave_config # this is the Alembic Config object, which provides # access to the values within the .ini file in use. @@ -58,10 +58,7 @@ and associate a connection with the context. """ - connectable = engine_from_config( - config.get_section(config.config_ini_section), - prefix='sqlalchemy.', - poolclass=pool.NullPool) + connectable = db with connectable.connect() as connection: context.configure( -- rgit 0.1.3