def teardown(): global engine, connection, _setup_stack _setup_stack -= 1 if _setup_stack > 0: return drop_db_model(connection) connection.close() engine = None connection = None
def teardown(): global engine, connection, _setup_stack _setup_stack -= 1 if _setup_stack != 0: return assert isinstance(connection, Connection) connection.commit() # necessary to apply e.g. pending triggers drop_db_model(connection) connection.close() engine = None connection = None
def setup(): global engine, connection, _setup_stack _setup_stack += 1 if _setup_stack > 1: return try: uri = os.environ['PYCROFT_DB_URI'] except KeyError: raise RuntimeError("Environment variable PYCROFT_DB_URI must be " "set to an SQLalchemy connection string.") engine = create_engine(uri, poolclass=SingletonThreadPool) connection = engine.connect() drop_db_model(connection) create_db_model(connection)
def setup(): global engine, connection, _setup_stack if _setup_stack > 0: return try: uri = os.environ['PYCROFT_DB_URI'] except KeyError: raise RuntimeError("Environment variable PYCROFT_DB_URI must be " "set to an SQLalchemy connection string.") engine = create_engine(uri, poolclass=SingletonThreadPool, future=True) connection = engine.connect() drop_db_model(connection) create_db_model(connection) connection.commit() DeferredReflection.prepare(engine) _setup_stack += 1
def setUpClass(cls): session.reinit_session("sqlite://") drop_db_model() create_db_model() cls.fixture = make_fixture()
def dropDB(): model.drop_db_model() session.flush()
def setUpClass(cls): session.reinit_session("sqlite://") model.drop_db_model() model.create_db_model() cls.host = host.UserHost(user_id = 1) session.session.commit()
def setUpClass(cls): session.reinit_session("sqlite://") model.drop_db_model() model.create_db_model() cls.host = host.UserHost(user_id=1) session.session.commit()
# Copyright (c) 2012 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. from legacy import convert from pycroft import model if __name__ == "__main__": print "drop old db model" model.drop_db_model() print "create new db model" model.create_db_model() print "convert data" convert.do_convert() print "complete"