Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
def getDbDSN():
    config.loadConfig()
    return DB_DSN_FORMAT % dict(config.items("repository"))
Esempio n. 4
0
def getDbDSN():
    config.loadConfig()
    return DB_DSN_FORMAT % dict(config.items("repository"))