From 794ab5748f2dfd9cd9986451638e0ba7dbcb03e2 Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Fri, 29 Jan 2016 02:38:55 +0100 Subject: [PATCH] CLI: Move alembic imports inside the calling function Reduces execution time of "manage.py" a bit. An import of alembic.config takes a relatively long time and "manage.py" by itself is slow. --- ogn/commands/database.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ogn/commands/database.py b/ogn/commands/database.py index 0f7d0fc..c534044 100644 --- a/ogn/commands/database.py +++ b/ogn/commands/database.py @@ -1,6 +1,3 @@ -from alembic.config import Config -from alembic import command - from ogn.commands.dbutils import engine, session from ogn.model import Base, AddressOrigin from ogn.utils import get_ddb @@ -14,6 +11,9 @@ manager = Manager() def init(): """Initialize the database.""" + from alembic.config import Config + from alembic import command + Base.metadata.create_all(engine) alembic_cfg = Config("alembic.ini") command.stamp(alembic_cfg, "head")