def query_db_schema_version(conn):
    'Function to fetch the DB version number from the database.'
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        try:
            cur.execute('SELECT MAX(version) FROM schema_version')
            return cur.fetchone()[0]
        except psycopg2.ProgrammingError as ex:
            logger.error(str(ex).strip())
            return None
Function to fetch the DB version number from the database.
def query_db_schema_version(conn):
    
    logger = logging.getLogger('dirbs.db')
    with conn.cursor() as cur:
        try:
            cur.execute('SELECT MAX(version) FROM schema_version')
            return cur.fetchone()[0]
        except psycopg2.ProgrammingError as ex:
            logger.error(str(ex).strip())
            return None