コード例 #1
0
ファイル: __init__.py プロジェクト: sergius/numenta-apps
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)
コード例 #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)
コード例 #3
0
def getDbDSN():
    config.loadConfig()
    return DB_DSN_FORMAT % dict(config.items("repository"))
コード例 #4
0
ファイル: __init__.py プロジェクト: sergius/numenta-apps
def getDbDSN():
    config.loadConfig()
    return DB_DSN_FORMAT % dict(config.items("repository"))