def verify_db_search_path(conn):
    'Function used to check whether db_search_path is correct by looking for objects.'
    logger = logging.getLogger('dirbs.db')
    is_search_path_valid = True
    with conn.cursor() as cursor:
        cursor.execute("SELECT to_regclass('schema_version')")
        res = cursor.fetchone()[0]
        if (res is None):
            is_search_path_valid = False
        try:
            cursor.execute("SELECT pg_get_functiondef('hll_print(hll)'::regprocedure)")
        except psycopg2.ProgrammingError:
            is_search_path_valid = False
        if (not is_search_path_valid):
            logger.error('The search_path for the database is not set correctly. Please issue the following whilst connected to this DB: \n\tALTER DATABASE <database> SET search_path TO core, hll;')
            raise DatabaseSchemaException('DB search_path not set correctly!')
Function used to check whether db_search_path is correct by looking for objects.
def verify_db_search_path(conn):
    
    logger = logging.getLogger('dirbs.db')
    is_search_path_valid = True
    with conn.cursor() as cursor:
        cursor.execute("SELECT to_regclass('schema_version')")
        res = cursor.fetchone()[0]
        if (res is None):
            is_search_path_valid = False
        try:
            cursor.execute("SELECT pg_get_functiondef('hll_print(hll)'::regprocedure)")
        except psycopg2.ProgrammingError:
            is_search_path_valid = False
        if (not is_search_path_valid):
            logger.error('The search_path for the database is not set correctly. Please issue the following whilst connected to this DB: \n\tALTER DATABASE <database> SET search_path TO core, hll;')
            raise DatabaseSchemaException('DB search_path not set correctly!')