Skip to content

core

core

DomoVariable — a Domo dashboard variable (a function template with variable=True).

Variables share Domo's Functions API with beast modes (folder "Functions (Beast Modes and Variables)"). A variable IS a function template whose variable flag is true; it carries a name, a data type, and links to the cards/datasets it is used on. On a page, a variable is surfaced through a VARIABLE layout slot that references a variable control (see DomoVariableControl) — the control is the on-page widget, this is the underlying definition.

DomoVariable dataclass

DomoVariable(
    auth: DomoAuth,
    id: str,
    raw: dict,
    name: str = "",
    data_type: str = "STRING",
    is_global: bool = False,
    locked: bool = False,
    legacy_id: str = "",
)

Bases: DomoEntity

A Domo variable (function template with variable=True).

Usage

variables = await DomoVariables(auth=auth).search() v = await DomoVariable.get_by_id(auth=auth, id="100") print(v.name, v.data_type)

from_dict classmethod

from_dict(
    auth: DomoAuth, obj: dict[str, Any]
) -> DomoVariable

Build a DomoVariable from a functions/search or functions/template response.

Source code in src/crew_dcs/classes/DomoVariable/core.py
47
48
49
50
51
52
53
54
55
56
57
58
59
@classmethod
def from_dict(cls, auth: DomoAuth, obj: dict[str, Any]) -> DomoVariable:
    """Build a DomoVariable from a functions/search or functions/template response."""
    return cls(
        auth=auth,
        id=str(obj.get("id", "")),
        raw=obj,
        name=obj.get("name", ""),
        data_type=obj.get("dataType", "STRING"),
        is_global=obj.get("global", False),
        locked=obj.get("locked", False),
        legacy_id=str(obj.get("legacyId", "")),
    )

get_by_id async classmethod

get_by_id(
    auth: DomoAuth,
    id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> DomoVariable

Retrieve a single variable (function template) by id.

Source code in src/crew_dcs/classes/DomoVariable/core.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@classmethod
async def get_by_id(
    cls,
    auth: DomoAuth,
    id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> DomoVariable:
    """Retrieve a single variable (function template) by id."""
    context = RouteContext.build_context(context=context, **context_kwargs)
    res = await beastmode_routes.get_beastmode_by_id(
        auth=auth, beastmode_id=str(id), context=context
    )
    return cls.from_dict(auth=auth, obj=res.response)

get_entity_by_id async classmethod

get_entity_by_id(
    entity_id: str, auth: DomoAuth, **kwargs: Any
) -> DomoVariable

Internal wrapper used by the base refresh() machinery.

Source code in src/crew_dcs/classes/DomoVariable/core.py
77
78
79
80
81
82
@classmethod
async def get_entity_by_id(
    cls, entity_id: str, auth: DomoAuth, **kwargs: Any
) -> DomoVariable:
    """Internal wrapper used by the base refresh() machinery."""
    return await cls.get_by_id(auth=auth, id=entity_id, **kwargs)

DomoVariables dataclass

DomoVariables(auth: DomoAuth)

Manager for searching and listing Domo variables.

Usage

variables = await DomoVariables(auth=auth).search() named = await DomoVariables(auth=auth).search(name="Choose metric")

search async

search(
    name: str | None = None,
    filters: list[dict] | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs
) -> list[DomoVariable]

Search for variables across the instance.

Parameters:

Name Type Description Default
name str | None

Optional variable name to filter by.

None
filters list[dict] | None

Optional extra filter dictionaries.

None
context RouteContext | None

Optional RouteContext for request configuration.

None

Returns:

Type Description
list[DomoVariable]

List of DomoVariable instances.

Source code in src/crew_dcs/classes/DomoVariable/core.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
async def search(
    self,
    name: str | None = None,
    filters: list[dict] | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> list[DomoVariable]:
    """Search for variables across the instance.

    Args:
        name: Optional variable name to filter by.
        filters: Optional extra filter dictionaries.
        context: Optional RouteContext for request configuration.

    Returns:
        List of DomoVariable instances.
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    res = await beastmode_routes.search_variables(
        auth=self.auth,
        name=name,
        filters=filters,
        context=context,
    )

    if not res.is_success:
        return []

    return [DomoVariable.from_dict(auth=self.auth, obj=v) for v in res.response]