def reset(offline=False): """ Reset the grok database; upon successful completion, the necessary schema are created, but the tables are not populated :param offline: False to execute SQL commands; True to just dump SQL commands to stdout for offline mode or debugging """ # Make sure we have the latest version of configuration config.loadConfig() dbName = config.get('repository', 'db') resetDatabaseSQL = ("DROP DATABASE IF EXISTS %(database)s; " "CREATE DATABASE %(database)s;" % { "database": dbName }) statements = resetDatabaseSQL.split(";") engine = getUnaffiliatedEngine() with engine.connect() as connection: for s in statements: if s.strip(): connection.execute(s) migrate(offline=offline)
def reset(offline=False): """ Reset the grok database; upon successful completion, the necessary schema are created, but the tables are not populated :param offline: False to execute SQL commands; True to just dump SQL commands to stdout for offline mode or debugging """ # Make sure we have the latest version of configuration config.loadConfig() dbName = config.get("repository", "db") resetDatabaseSQL = "DROP DATABASE IF EXISTS %(database)s; " "CREATE DATABASE %(database)s;" % {"database": dbName} statements = resetDatabaseSQL.split(";") engine = getUnaffiliatedEngine() with engine.connect() as connection: for s in statements: if s.strip(): connection.execute(s) migrate(offline=offline)
def getDbDSN(): config.loadConfig() return DB_DSN_FORMAT % dict(config.items("repository"))