Skip to content

VSL functions

Various VSL functions have been exposed; they can be accessed via the following aliased import

import valsys.modeling.vsl as VSL

Execute a VSL query

This returns data from a query. Could be in the form of widgets.

VSL.execute_vsl_query(...)

Execute a VSL query

Parameters:

Name Type Description Default
query str

the VSL query string to be executed

required

Returns:

Type Description
VSLQueryResponse

The VSLQueryResponse object response

Source code in valsys/modeling/vsl.py
def execute_vsl_query(query: str) -> VSLQueryResponse:
    """ Execute a VSL query

        Args:
            query: the VSL query string to be executed

        Returns:
            The `VSLQueryResponse` object response
    """
    client = new_client()
    url = VSURL.VSL_QUERY
    payload = {
        Headers.QUERY: query,
    }
    resp = client.post(url, data=payload)
    check_success(resp, 'VSL query')
    return VSLQueryResponse.from_json(resp.get(Resp.DATA))

Execute a VSL selectors query

This returns selectors only.

VSL.execute_vsl_query_selectors(...)

Execute a VSL query

Parameters:

Name Type Description Default
query str

the VSL query string to be executed

required

Returns:

Type Description
VSLSelectorsResponse

The VSLSelectorsResponse object response

Source code in valsys/modeling/vsl.py
def execute_vsl_query_selectors(query: str) -> VSLSelectorsResponse:
    """ Execute a VSL query

        Args:
            query: the VSL query string to be executed

        Returns:
            The `VSLSelectorsResponse` object response
    """
    client = new_client()
    url = VSURL.VSL_QUERY
    payload = {
        Headers.QUERY: query,
    }
    resp = client.post(url, data=payload)
    check_success(resp, 'VSL query selectors')
    return VSLSelectorsResponse.from_json(resp.get(Resp.DATA))