예제 #1
0
파일: tests.py 프로젝트: bourivouh/djonet
def destroy_database(name):
    control = monetdb.control.Control(MONETDB_HOST, MONETDB_PORT, MONETDB_PASSPHRASE)
    try:
        control.stop(name)
    except monetdb.exceptions.OperationalError:
        pass
    control.destroy(name)
예제 #2
0
파일: populate.py 프로젝트: hughbg/tkp
def recreate(dbconfig):
    """
    Destroys and creates a new database.

    :param options: a argparse namespace generated with tkp.management

    WARNING: this will DESTROY your database!

    Note: this will raise an Exception ONLY when the creation of the database
          fails
    """
    params = {'username': dbconfig['user'],
              'password': dbconfig['password'],
              'database': dbconfig['database'],
              'host': dbconfig['host']
              }
    if dbconfig['engine'] == 'monetdb':
        import monetdb.sql
        import monetdb.control
        control = monetdb.control.Control(dbconfig['host'], dbconfig['port'],
                                          dbconfig['passphrase'])

        database = dbconfig['database']
        print("stopping %s" % database)
        try:
            control.stop(database)
        except monetdb.sql.OperationalError, e:
            print("database not running")
        print "destroying %s" % database
        try:
            control.destroy(database)
        except monetdb.sql.OperationalError, e:
            print("can't destroy database: %s" % str(e))
예제 #3
0
def destroy_database(name):
    control = monetdb.control.Control(MONETDB_HOST, MONETDB_PORT,
                                      MONETDB_PASSPHRASE)
    try:
        control.stop(name)
    except monetdb.exceptions.OperationalError:
        pass
    control.destroy(name)