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

    Arguments:
        conn: dirbs db connection object
    Returns:
        bool for confirmation
    """
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        cur.execute("""SELECT rolname
                         FROM pg_roles
                         JOIN pg_database
                              ON (pg_database.datdba = pg_roles.oid)
                        WHERE datname = current_database()""")
        res = cur.fetchone()
        if res is None:
            logger.warning('Failed to determing DB owner for current_database')
            return None
        return res[0]

    Function to verify whether the current database ownership is correct.

    Arguments:
        conn: dirbs db connection object
    Returns:
        bool for confirmation
    
Function to verify whether the current database ownership is correct.
Function to verify whether the current database ownership is correct .
def query_db_ownership(conn):
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        cur.execute("""SELECT rolname
                         FROM pg_roles
                         JOIN pg_database
                              ON (pg_database.datdba = pg_roles.oid)
                        WHERE datname = current_database()""")
        res = cur.fetchone()
        if res is None:
            logger.warning('Failed to determing DB owner for current_database')
            return None
        return res[0]
def query_db_ownership ( conn ) : logger = logging . getLogger ( 'dirbs.db' ) with conn . cursor ( ) as cur : cur . execute ( """SELECT rolname
                         FROM pg_roles
                         JOIN pg_database
                              ON (pg_database.datdba = pg_roles.oid)
                        WHERE datname = current_database()""" ) res = cur . fetchone ( ) if res is None : logger . warning ( 'Failed to determing DB owner for current_database' ) return None return res [ 0 ]
Function to verify whether the current database ownership is correct.
Function to verify whether the current database ownership is correct .
"""
    Function to verify whether the current database ownership is correct.

    Arguments:
        conn: dirbs db connection object
    Returns:
        bool for confirmation
    """
bool for confirmation
bool for confirmation
conn
dirbs db connection object
dirbs db connection object