def delete_db(settings):
    """Delete the old database."""
    engine = settings.DATABASE_ENGINE
    if engine == 'sqlite3':
        try:
            os.unlink(settings.DATABASE_NAME)
        except __HOLE__:
            pass
    elif engine == 'mysql':
        import _mysql
        s = _mysql.connect(host=settings.DATABASE_HOST,
                           user=settings.DATABASE_USER,
                           passwd=settings.DATABASE_PASSWORD)
        for cmd in ['drop database if exists %s',
                    'create database %s CHARACTER SET utf8 COLLATE utf8_general_ci']:
            s.query(cmd % settings.DATABASE_NAME)

    elif engine in ('postgresql', 'postgresql_psycopg2'):

        if settings.DATABASE_NAME == '':
            raise AssertionError("You must specify a value for DATABASE_NAME in local_settings.py.")
        if settings.DATABASE_USER == '':
            raise AssertionError("You must specify a value for DATABASE_USER in local_settings.py.")
        params=" --username=%s  --password" % settings.DATABASE_USER
        if settings.DATABASE_HOST:
            params += " --host=%s" % settings.DATABASE_HOST
        if settings.DATABASE_PORT:
            params += " --port=%s" % settings.DATABASE_PORT
        params += " %s" % settings.DATABASE_NAME
        print("""You will be prompted for the password for the user '%s' twice.
        Once to drop the existing database and then a second time to create
        the database.""" % settings.DATABASE_USER)
        for cmd in ['dropdb %s', 'createdb %s']:
            os.system(cmd % params)

    else:
        raise AssertionError("Unknown database engine %s" % engine)
dataset/ETHPy150Open dokterbob/satchmo/satchmo/projects/load_data.py/delete_db