src/dirbs/utils.py
def query_schema_ownership(conn, schema_name):
    """
    Function to verify whether the current database schema ownership is correct.

    Arguments:
        conn: dirbs db connection object
        schema_name: name of the schema to verify
    Returns:
        bool for confirmation
    """
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        cur.execute("""SELECT rolname
                         FROM pg_roles
                         JOIN pg_namespace
                              ON (pg_namespace.nspowner = pg_roles.oid)
                        WHERE nspname = %s""", [schema_name])
        res = cur.fetchone()
        if res is None:
            logger.warning('Failed to determing owner for current_schema')
            return None
        return res[0]

    Function to verify whether the current database schema ownership is correct.

    Arguments:
        conn: dirbs db connection object
        schema_name: name of the schema to verify
    Returns:
        bool for confirmation
    
Function to verify whether the current database schema ownership is correct.
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
                         FROM pg_roles
                         JOIN pg_namespace
                              ON (pg_namespace.nspowner = pg_roles.oid)
                        WHERE nspname = %s""", [schema_name])
        res = cur.fetchone()
        if res is None:
            logger.warning('Failed to determing owner for current_schema')
            return None
        return res[0]
def query_schema_ownership ( conn , schema_name ) : logger = logging . getLogger ( 'dirbs.db' ) with conn . cursor ( ) as cur : cur . execute ( """SELECT rolname
                         FROM pg_roles
                         JOIN pg_namespace
                              ON (pg_namespace.nspowner = pg_roles.oid)
                        WHERE nspname = %s""" , [ schema_name ] ) res = cur . fetchone ( ) if res is None : logger . warning ( 'Failed to determing owner for current_schema' ) return None return res [ 0 ]
Function to verify whether the current database schema ownership is correct.
Function to verify whether the current database schema ownership is correct .
"""
    Function to verify whether the current database schema ownership is correct.

    Arguments:
        conn: dirbs db connection object
        schema_name: name of the schema to verify
    Returns:
        bool for confirmation
    """
bool for confirmation
bool for confirmation
conn
dirbs db connection object
dirbs db connection object
schema_name
name of the schema to verify
name of the schema to verify