core
core ¶
DomoBeastMode entity class.
A typed class for beast mode (calculated field) templates, providing access to the formula definition, column references, and metadata via the composition pattern (bm.Template.get()).
DomoBeastMode
dataclass
¶
DomoBeastMode(
auth: DomoAuth,
id: str,
raw: dict,
name: str = "",
locked: bool = False,
legacy_id: str = "",
Template: DomoBeastMode_TemplateManager | None = None,
)
Bases: DomoEntity
A Domo dataset-level beast mode (reusable calculated field / template).
This is the governed, reusable counterpart to a card-level inline formula
(kpi_builder.build_formula / DomoCard.create(measure_formula=...)):
a beast mode created here is persisted on the dataset, appears in Domo's
beast-mode catalog, and can be referenced by name from many cards.
Usage
bm = await DomoBeastMode.create(
auth=auth, name="Net Income",
expression="SUM(CASE WHEN AccountType='Revenue' THEN Amount "
"WHEN AccountType='Expenditures' THEN -Amount ELSE 0 END)",
dataset_id=dataset_id, data_type="DECIMAL", aggregated=True,
)
await bm.Template.get(include_hidden=True) # load full formula
await bm.delete()
create
async
classmethod
¶
create(
auth: DomoAuth,
name: str,
expression: str,
dataset_id: str,
*,
data_type: str = "STRING",
aggregated: bool = False,
return_raw: bool = False,
context: RouteContext | None = None,
**context_kwargs
) -> DomoBeastMode
Create a reusable dataset-level beast mode and return it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
DomoAuth instance. |
required |
name
|
str
|
Display name of the beast mode. |
required |
expression
|
str
|
Beast Mode SQL (columns in backticks). |
required |
dataset_id
|
str
|
Dataset the beast mode is associated with. |
required |
data_type
|
str
|
Result data type (e.g. |
'STRING'
|
aggregated
|
bool
|
Whether the expression aggregates (SUM/AVG/...). |
False
|
return_raw
|
bool
|
Return the raw create response instead of a DomoBeastMode. |
False
|
context
|
RouteContext | None
|
Optional RouteContext. |
None
|
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
delete
async
¶
delete(
*, context: RouteContext | None = None, **context_kwargs
) -> Any
Delete this beast mode.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
198 199 200 201 202 203 204 205 206 207 208 | |
from_dict
classmethod
¶
from_dict(
auth: DomoAuth, obj: dict[str, Any]
) -> DomoBeastMode
Create a DomoBeastMode from a search result or template API response.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
get_by_id
async
classmethod
¶
get_by_id(
auth: DomoAuth,
id: str,
*,
context: RouteContext | None = None,
**context_kwargs
) -> DomoBeastMode
Retrieve a beast mode template by id.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
get_entity_by_id
async
classmethod
¶
get_entity_by_id(
entity_id: str, auth: DomoAuth, **kwargs: Any
) -> DomoBeastMode
Internal wrapper used by the base refresh() method.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
148 149 150 151 152 153 | |
lock
async
¶
lock(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Lock this beast mode.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
set_locked
async
¶
set_locked(
is_locked: bool,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Lock or unlock this beast mode.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
to_measure_ref ¶
to_measure_ref(
data_type: str = "DECIMAL",
) -> dict[str, Any]
Return a card-builder measure_beastmode reference for this beast mode.
Reference is by legacyId (not display name), so renaming the beast
mode does not break the cards that use it. Pass the result to
DomoCard.create(measure_beastmode=...).
Requires legacy_id and the expression: create() populates both, or
call await bm.Template.get() first to load the expression.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
unlock
async
¶
unlock(
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
)
Unlock this beast mode.
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
DomoBeastMode_TemplateManager
dataclass
¶
DomoBeastMode_TemplateManager(
parent: DomoBeastMode,
template: BeastModeTemplate | None = None,
)
Manager for a beast mode's template definition.
Provides typed access to the beast mode's formula, column references, and metadata via the template API.
Usage
await bm.Template.get(include_hidden=True) bm.Template.template # BeastModeTemplate bm.Template.referenced_columns # set[str]
referenced_columns
property
¶
referenced_columns: set[str]
Columns referenced by this beast mode. Empty if template not loaded.
get
async
¶
get(
include_hidden: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs
) -> BeastModeTemplate
Fetch the template definition for this beast mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_hidden
|
bool
|
Include hidden/internal calculations |
False
|
context
|
RouteContext | None
|
Optional RouteContext for request configuration |
None
|
Returns:
| Type | Description |
|---|---|
BeastModeTemplate
|
BeastModeTemplate instance with typed access to all definition data. |
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |