def query_schema_ownership(conn, schema_name):
    'Function to verify whether the current database schema ownership is correct.'
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        cur.execute('SELECT rolname\n                         FROM pg_roles\n                         JOIN pg_namespace\n                              ON (pg_namespace.nspowner = pg_roles.oid)\n                        WHERE nspname = %s', [schema_name])
        res = cur.fetchone()
        if (res is None):
            logger.warn('Failed to determing owner for current_schema')
            return None
        return res[0]
Function to verify whether the current database schema ownership is correct.
def query_schema_ownership(conn, schema_name):
    
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        cur.execute('SELECT rolname\n                         FROM pg_roles\n                         JOIN pg_namespace\n                              ON (pg_namespace.nspowner = pg_roles.oid)\n                        WHERE nspname = %s', [schema_name])
        res = cur.fetchone()
        if (res is None):
            logger.warn('Failed to determing owner for current_schema')
            return None
        return res[0]