src/dirbs/utils.py
def verify_hll_schema(conn):
    """
    Function used to check whether HLL schema exists and that extension is installed correctly.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if HLL schema is not created or db search path does not include hll or
                                 hll extension is not installed
    """
    logger = logging.getLogger('dirbs.db')
    if not query_schema_existence(conn, 'hll'):
        logger.error("Schema \'hll\' does not exist. Please ensure the hll extension is installed and run the "
                     'following as a superuser whilst connected to this DB: '
                     '\n\t1. CREATE SCHEMA hll;'
                     '\n\t2. GRANT USAGE ON SCHEMA hll TO dirbs_core_base;'
                     '\n\t3. CREATE EXTENSION hll SCHEMA hll;')
        raise DatabaseSchemaException('HLL schema not created!')

    # Check if extension installed correctly by looking for hll.hll_print
    with conn.cursor() as cursor:
        try:
            cursor.execute("SELECT pg_get_functiondef(\'hll.hll_print(hll.hll)\'::regprocedure)")
        except psycopg2.ProgrammingError:
            logger.error('The HLL extension is not installed correctly. Please issue the following as a superuser '
                         'whilst connected to this DB: '
                         '\n\tCREATE EXTENSION hll SCHEMA hll;')
            raise DatabaseSchemaException('DB search_path does not include hll or extension not installed!')

    Function used to check whether HLL schema exists and that extension is installed correctly.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if HLL schema is not created or db search path does not include hll or
                                 hll extension is not installed
    
Function used to check whether HLL schema exists and that extension is installed correctly.
Function used to check whether HLL schema exists and that extension is installed correctly .
def verify_hll_schema(conn):
    logger = logging.getLogger('dirbs.db')
    if not query_schema_existence(conn, 'hll'):
        logger.error("Schema \'hll\' does not exist. Please ensure the hll extension is installed and run the "
                     'following as a superuser whilst connected to this DB: '
                     '\n\t1. CREATE SCHEMA hll;'
                     '\n\t2. GRANT USAGE ON SCHEMA hll TO dirbs_core_base;'
                     '\n\t3. CREATE EXTENSION hll SCHEMA hll;')
        raise DatabaseSchemaException('HLL schema not created!')
    with conn.cursor() as cursor:
        try:
            cursor.execute("SELECT pg_get_functiondef(\'hll.hll_print(hll.hll)\'::regprocedure)")
        except psycopg2.ProgrammingError:
            logger.error('The HLL extension is not installed correctly. Please issue the following as a superuser '
                         'whilst connected to this DB: '
                         '\n\tCREATE EXTENSION hll SCHEMA hll;')
            raise DatabaseSchemaException('DB search_path does not include hll or extension not installed!')
def verify_hll_schema ( conn ) : logger = logging . getLogger ( 'dirbs.db' ) if not query_schema_existence ( conn , 'hll' ) : logger . error ( "Schema \'hll\' does not exist. Please ensure the hll extension is installed and run the " 'following as a superuser whilst connected to this DB: ' '\n\t1. CREATE SCHEMA hll;' '\n\t2. GRANT USAGE ON SCHEMA hll TO dirbs_core_base;' '\n\t3. CREATE EXTENSION hll SCHEMA hll;' ) raise DatabaseSchemaException ( 'HLL schema not created!' ) with conn . cursor ( ) as cursor : try : cursor . execute ( "SELECT pg_get_functiondef(\'hll.hll_print(hll.hll)\'::regprocedure)" ) except psycopg2 . ProgrammingError : logger . error ( 'The HLL extension is not installed correctly. Please issue the following as a superuser ' 'whilst connected to this DB: ' '\n\tCREATE EXTENSION hll SCHEMA hll;' ) raise DatabaseSchemaException ( 'DB search_path does not include hll or extension not installed!' )
Function used to check whether HLL schema exists and that extension is installed correctly.
Function used to check whether HLL schema exists and that extension is installed correctly .
"""
    Function used to check whether HLL schema exists and that extension is installed correctly.

    Arguments:
        conn: dirbs db connection object
    Raises:
        DatabaseSchemaException: if HLL schema is not created or db search path does not include hll or
                                 hll extension is not installed
    """ # Check if extension installed correctly by looking for hll.hll_print
if HLL schema is not created or db search path does not include hll or
hll extension is not installed
if HLL schema is not created or db search path does not include hll or hll extension is not installed
DatabaseSchemaException
conn
dirbs db connection object
dirbs db connection object