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
|
Calls route
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
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 197 | |
delete
async
¶
delete(
*, context: RouteContext | None = None, **context_kwargs
) -> Any
Delete this beast mode.
Calls route
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
265 266 267 268 269 270 271 272 273 274 275 | |
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
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
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.
Calls route
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
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
149 150 151 152 153 154 | |
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
301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
set_locked
async
¶
set_locked(
is_locked: bool,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs,
)
Lock or unlock this beast mode.
Calls route
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
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
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
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
316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
update
async
¶
update(
name: str | None = None,
expression: str | None = None,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> DomoBeastMode | ResponseGetData
Update this beast mode's name and/or expression.
Only fields that are not None are sent. After a successful PUT the beast mode is re-fetched, so the instance reflects server state even when the PUT response is sparse or empty.
Raises:
| Type | Description |
|---|---|
BeastMode_Locked_Error
|
This beast mode is locked (known locally, or the server rejected the update as locked). |
BeastMode_CRUD_Error
|
The update was rejected or no field was given. |
Calls route
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
DomoBeastMode_TemplateManager
dataclass
¶
DomoBeastMode_TemplateManager(
parent: DomoEntity,
template: BeastModeTemplate | None = None,
)
Bases: DomoSubEntity
Subentity holding a beast mode's template definition.
Built from its parent beast mode (from_parent); auth and parent_id
come from the parent. The Manager suffix is historical: get() returns
this one facet's data, not a list of entities.
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. |
Calls route
Source code in src/crew_dcs/classes/DomoBeastMode/core.py
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 72 | |