src/dirbs/utils.py
def verify_db_roles_installed(conn):
    """Function used to verify whether roles have been installed in the DB.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if the core roles are not installed
    """
    # The below is not a guaranteed check, but a heuristic
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cursor:
        cursor.execute("SELECT 1 AS res FROM pg_roles WHERE rolname = \'dirbs_core_power_user\'")
        if cursor.fetchone() is None:
            logger.error("DIRBS Core roles have not been installed - run \'dirbs-db install_roles\' before "
                         "running \'dirbs-db install\'")
            raise DatabaseSchemaException('DIRBS Core database roles have not been installed')
Function used to verify whether roles have been installed in the DB.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if the core roles are not installed
    
Function used to verify whether roles have been installed in the DB.
Function used to verify whether roles have been installed in the DB .
def verify_db_roles_installed(conn):
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cursor:
        cursor.execute("SELECT 1 AS res FROM pg_roles WHERE rolname = \'dirbs_core_power_user\'")
        if cursor.fetchone() is None:
            logger.error("DIRBS Core roles have not been installed - run \'dirbs-db install_roles\' before "
                         "running \'dirbs-db install\'")
            raise DatabaseSchemaException('DIRBS Core database roles have not been installed')
def verify_db_roles_installed ( conn ) : logger = logging . getLogger ( 'dirbs.db' ) with conn . cursor ( ) as cursor : cursor . execute ( "SELECT 1 AS res FROM pg_roles WHERE rolname = \'dirbs_core_power_user\'" ) if cursor . fetchone ( ) is None : logger . error ( "DIRBS Core roles have not been installed - run \'dirbs-db install_roles\' before " "running \'dirbs-db install\'" ) raise DatabaseSchemaException ( 'DIRBS Core database roles have not been installed' )
Function used to verify whether roles have been installed in the DB.
Function used to verify whether roles have been installed in the DB .
"""Function used to verify whether roles have been installed in the DB.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if the core roles are not installed
    """ # The below is not a guaranteed check, but a heuristic
if the core roles are not installed
if the core roles are not installed
DatabaseSchemaException
conn
dirbs db connection object
dirbs db connection object