Skip to content

jupyter

jupyter

Dataflow → Jupyter workspace search route operations.

generate_search_dataflows_to_jupyter_workspaces_body

generate_search_dataflows_to_jupyter_workspaces_body(
    filter_body: dict | None = None,
    dataflow_id: int | None = None,
) -> dict

Ensure the DATA_FLOW_ID filter exists in filter_body and append the given dataflow_id to it (only if it's not already present).

Parameters:

Name Type Description Default
filter_body dict

e.g. {"filters":[{"type":"DATA_FLOW_ID","values":[116]}]}

None
dataflow_id int

ID to add under the DATA_FLOW_ID filter

None
Source code in src/crew_dcs/routes/dataflow/jupyter.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
def generate_search_dataflows_to_jupyter_workspaces_body(
    filter_body: dict | None = None, dataflow_id: int | None = None
) -> dict:
    """
    Ensure the DATA_FLOW_ID filter exists in filter_body and append the given dataflow_id to it
    (only if it's not already present).

    Args:
        filter_body (dict): e.g. {"filters":[{"type":"DATA_FLOW_ID","values":[116]}]}
        dataflow_id (int): ID to add under the DATA_FLOW_ID filter
    """

    filter_body = filter_body or {}

    if not dataflow_id:
        return filter_body

    # 1. Make sure there's a filters list
    filters = filter_body.setdefault("filters", [])

    # 2. Try to find an existing DATA_FLOW_ID filter
    for f in filters:
        if f.get("type") == "DATA_FLOW_ID":
            # append if it's new
            if dataflow_id not in f["values"]:
                f["values"].append(dataflow_id)
            break
    else:
        # 3. If we never broke out, no filter existed—create it
        filters.append({"type": "DATA_FLOW_ID", "values": [dataflow_id]})

    return filter_body

search_dataflows_to_jupyter_workspaces async

search_dataflows_to_jupyter_workspaces(
    auth: DomoAuth,
    dataflow_id: int | None = None,
    return_raw: bool = False,
    filter_body: dict | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Endpoint

  • POST /datascience/v1/search/notebooks

Called by

Source code in src/crew_dcs/routes/dataflow/jupyter.py
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_dataflows_to_jupyter_workspaces(
    auth: DomoAuth,
    dataflow_id: int | None = None,
    return_raw: bool = False,
    filter_body: dict | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    filter_body = generate_search_dataflows_to_jupyter_workspaces_body(
        filter_body=filter_body, dataflow_id=dataflow_id
    )

    res = await gd.get_data(
        url=f"https://{auth.domo_instance}.domo.com/api/datascience/v1/search/notebooks",
        auth=auth,
        method="POST",
        body=filter_body,
        context=context,
    )

    if return_raw:
        return res

    if not res.is_success:
        raise RouteError(res=res)

    res.response = res.response["notebooks"]

    if dataflow_id:
        if not res.response:
            raise RouteError(
                res=res,
                entity_id=dataflow_id,
                message="unable to retrieve jupyter notebook data for dataflow",
            )

        res.response = res.response[-1]

    return res

See also

Domo Knowledge Base categories

  • Transform Data (Magic ETL, DataFlows, SQL)