예제 #1
0
파일: __init__.py 프로젝트: bopopescu/what
def reset(offline=False):
    """
  Reset the YOMP 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)
예제 #2
0
파일: __init__.py 프로젝트: darian19/what
def reset(offline=False):
  """
  Reset the YOMP 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)
예제 #3
0
파일: __init__.py 프로젝트: darian19/what
def getDbDSN():
  config.loadConfig()
  return DB_DSN_FORMAT % dict(config.items("repository"))
예제 #4
0
파일: __init__.py 프로젝트: bopopescu/what
def getDbDSN():
    config.loadConfig()
    return DB_DSN_FORMAT % dict(config.items("repository"))