Skip to content

core

core

DomoDataflow dataclass

DomoDataflow(
    auth: DomoAuth,
    id: str,
    raw: dict,
    name: str | None = None,
    owner: str | None = None,
    description: str | None = None,
    tags: list[str] | None = None,
    version_id: int | None = None,
    version_number: int | None = None,
    versions: list[dict[str, Any]] | None = None,
    jupyter_workspace_config: dict | None = None,
    Definition: DomoDataflow_Definition | None = None,
    History: DomoDataflow_History | None = None,
    JupyterWorkspace: DomoJupyterWorkspace | None = None,
)

Bases: DomoEntity_w_Lineage

Actions property

Actions

Shorthand for self.Definition.Actions.

Canvas property

Canvas

Shorthand for self.Definition.Canvas.

entity_name property

entity_name: str

Get the display name for this dataflow.

Dataflows use the 'name' field as their display name.

Returns:

Type Description
str

Dataflow name, or dataflow ID as fallback

optimize_canvas async

optimize_canvas(
    save: bool = True,
    add_sections: bool = True,
    debug_api: bool = False,
    session: AsyncClient | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
)

Fetch definition, optimize canvas layout, and optionally save.

Convenience method that ensures the definition is loaded, runs the layout optimizer, and optionally saves the result back to the Domo API.

Parameters:

Name Type Description Default
save bool

Whether to save after optimizing (default True).

True
add_sections bool

Whether to create auto-sections (default True).

True
debug_api bool

Enable debug logging for API calls.

False
session AsyncClient | None

Optional httpx client session.

None
context RouteContext | None

Optional RouteContext for the request.

None
**context_kwargs

Additional context parameters.

{}

Returns:

Type Description

The modified CanvasElements instance.

Example::

canvas = await dataflow.optimize_canvas(save=True, add_sections=True)
Source code in src/crew_dcs/classes/DomoDataflow/core.py
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
async def optimize_canvas(
    self,
    save: bool = True,
    add_sections: bool = True,
    debug_api: bool = False,
    session: httpx.AsyncClient | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    """Fetch definition, optimize canvas layout, and optionally save.

    Convenience method that ensures the definition is loaded, runs
    the layout optimizer, and optionally saves the result back to
    the Domo API.

    Args:
        save: Whether to save after optimizing (default True).
        add_sections: Whether to create auto-sections (default True).
        debug_api: Enable debug logging for API calls.
        session: Optional httpx client session.
        context: Optional RouteContext for the request.
        **context_kwargs: Additional context parameters.

    Returns:
        The modified CanvasElements instance.

    Example::

        canvas = await dataflow.optimize_canvas(save=True, add_sections=True)
    """
    if self.Definition is None:
        raise RuntimeError("Cannot optimize canvas: Definition not initialized")

    # Ensure definition is loaded
    await self.Definition.get(
        debug_api=debug_api,
        session=session,
        context=context,
        **context_kwargs,
    )

    # Run optimizer
    from .layout_optimizer import optimize_canvas as _optimize

    canvas = _optimize(self.Definition, add_sections=add_sections)

    # Optionally save
    if save:
        await self.Definition.save(
            debug_api=debug_api,
            session=session,
            version_note="Optimized canvas layout",
            context=context,
            **context_kwargs,
        )

    return canvas