entities
entities ¶
Base entity classes for Domo objects with inheritance hierarchy and lineage support.
This module provides the foundational classes for all Domo entities including datasets, cards, pages, users, and groups. It implements a hierarchical structure with support for entity relationships, lineage tracking, and federation.
Classes:
| Name | Description |
|---|---|
DomoEntity |
Base entity with core functionality |
DomoEntity_w_Lineage |
Entity with lineage tracking capabilities |
DomoManager |
Base class for entity managers |
DomoSubEntity |
Entity that belongs to a parent entity |
Access ¶
DomoEntity
dataclass
¶
DomoEntity(auth: DomoAuth, id: str, raw: dict)
Bases: DomoBase
Base class for all Domo entities (datasets, cards, pages, users, etc.).
Provides core functionality including authentication, unique identification, data conversion utilities, and relationship management. All concrete entity types should inherit from this class or one of its subclasses.
Attributes:
| Name | Type | Description |
|---|---|---|
auth |
DomoAuth
|
Authentication object for API requests (hidden in repr) |
id |
str
|
Unique identifier for the entity |
raw |
dict
|
Raw API response data for the entity (hidden in repr) |
Relations |
Any
|
Relationship controller for managing entity relationships |
Class Attributes
entity_type: The Domo entity type string (e.g., "DATA_SOURCE", "PAGE"). Concrete subclasses MUST set this. Intermediate/abstract bases that don't override it are skipped by auto-registration. has_lineage: Whether this entity type supports lineage tracking. Defaults to False on DomoEntity, True on DomoEntity_w_Lineage.
display_url is a property each concrete subclass implements.
display_url
abstractmethod
property
¶
display_url: str
Generate the URL to display this entity in the Domo interface.
This method should return the direct URL to view the entity in Domo's web interface, allowing users to navigate directly to the entity.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Complete URL to view the entity in Domo |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Must be implemented by subclasses |
entity_name
property
¶
entity_name: str
Get the display name for this entity.
Tries common name fields in order: name, title, display_name. Falls back to entity ID if no name is found.
Subclasses can override this property to use entity-specific name fields.
Returns:
| Type | Description |
|---|---|
str
|
Display name for the entity, or entity ID as fallback |
create
async
classmethod
¶
create(auth: DomoAuth, **kwargs) -> DomoEntity
Create a new entity and return it (classmethod: no instance yet).
Creatable entities override this to build the create payload (typically via a builder) and call the corresponding route.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If this entity type does not support creation. |
Source code in src/crew_dcs/base/entities.py
305 306 307 308 309 310 311 312 313 314 315 | |
delete
async
¶
delete(**kwargs)
Delete this entity.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If this entity type does not support deletion. |
Source code in src/crew_dcs/base/entities.py
325 326 327 328 329 330 331 | |
dispatch_get_by_id
async
classmethod
¶
dispatch_get_by_id(
auth: DomoAuth,
entity_type: str,
entity_id: str,
**kwargs,
)
Route entity_type + entity_id to the right subclass.get_entity_by_id().
The entity class must already be imported (which triggers init_subclass registration). If you get a "not registered" error, import the entity module before calling this method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for API requests |
required |
entity_type
|
str
|
The Domo entity type string (e.g., "DATA_SOURCE", "PAGE") |
required |
entity_id
|
str
|
Unique identifier of the entity to retrieve |
required |
**kwargs
|
Additional arguments passed to the subclass's get_entity_by_id |
{}
|
Returns:
| Type | Description |
|---|---|
|
An instance of the appropriate DomoEntity subclass |
Raises:
| Type | Description |
|---|---|
ValueError
|
If entity_type is not registered |
Source code in src/crew_dcs/base/entities.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
from_dict
abstractmethod
classmethod
¶
from_dict(auth: DomoAuth, obj: dict[str, Any])
Create an entity instance from a dictionary representation.
This method should be implemented by subclasses to handle the conversion from API response dictionaries to entity objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for API requests |
required |
obj
|
dict[str, Any]
|
Dictionary representation of the entity from the API |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Must be implemented by subclasses |
Source code in src/crew_dcs/base/entities.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
get_by_id
abstractmethod
async
classmethod
¶
get_by_id(
auth: DomoAuth,
id: str,
debug_num_stacks_to_drop=2,
debug_api: bool = False,
session: AsyncClient | None = None,
)
Fetch an entity by its unique identifier.
This method should be implemented by subclasses to handle entity-specific retrieval logic from the Domo API.
Concrete subclasses name the id parameter for the entity (user_id,
dataset_id, card_id, page_id, group_id, account_id,
dataflow_id). For a uniform entity_id keyword, call
get_entity_by_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for API requests |
required |
id
|
str
|
Unique identifier of the entity to retrieve |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Must be implemented by subclasses |
Source code in src/crew_dcs/base/entities.py
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 | |
get_entity_by_id
abstractmethod
async
classmethod
¶
get_entity_by_id(
auth: DomoAuth,
entity_id: str,
debug_num_stacks_to_drop: int = 2,
debug_api: bool = False,
session: AsyncClient | None = None,
check_if_published: bool | None = None,
parent_auth_retrieval_fn: Any | None = None,
parent_auth: Any | None = None,
**kwargs,
)
Fetch an entity by its ID
This method should be implemented by subclasses to fetch the specific entity type while ensuring lineage tracking is properly initialized.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth
|
DomoAuth
|
Authentication object for API requests |
required |
entity_id
|
str
|
Unique identifier of the entity to retrieve |
required |
debug_num_stacks_to_drop
|
int
|
Number of stack frames to drop for debug logging (default: 2) |
2
|
debug_api
|
bool
|
Enable API debug logging (default: False) |
False
|
session
|
AsyncClient | None
|
Optional HTTP client session |
None
|
check_if_published
|
bool | None
|
When True attempt to resolve publish subscriptions. If None and either parent_auth or parent_auth_retrieval_fn is provided, subclasses should default to True. |
None
|
parent_auth_retrieval_fn
|
Any | None
|
Callable used to obtain publisher auth for publish checks |
None
|
parent_auth
|
Any | None
|
Pre-existing publisher auth (alternative to parent_auth_retrieval_fn) |
None
|
**kwargs
|
Additional arguments passed to the underlying get_by_id method |
{}
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Must be implemented by subclasses |
Source code in src/crew_dcs/base/entities.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
refresh
async
¶
refresh(
debug_num_stacks_to_drop=2,
debug_api: bool = False,
session: AsyncClient | None = None,
**kwargs,
)
Refresh this instance from the API using its id and auth.
Source code in src/crew_dcs/base/entities.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
to_dict ¶
to_dict(
override_fn: Callable | None = None,
return_snake_case: bool = False,
) -> dict
Convert all dataclass attributes to a dictionary in camelCase or snake_case.
This method is useful for serializing entity data for API requests or data export operations.
Only fields with repr=True are included, plus any properties listed in serialize_properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
override_fn
|
Callable | None
|
Custom conversion function to override default behavior |
None
|
return_snake_case
|
bool
|
If True, return keys in snake_case. If False (default), return camelCase. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Dictionary with camelCase (default) or snake_case keys and corresponding attribute values |
Example
entity.to_dict() {'id': '123', 'displayName': 'My Entity', 'displayUrl': '...', ...} entity.to_dict(return_snake_case=True) {'id': '123', 'display_name': 'My Entity', 'display_url': '...', ...}
Source code in src/crew_dcs/base/entities.py
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 | |
update
async
¶
update(**kwargs) -> DomoEntity
Update this entity in place and return self.
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If this entity type does not support update. |
Source code in src/crew_dcs/base/entities.py
317 318 319 320 321 322 323 | |
DomoEntity_w_Lineage
dataclass
¶
DomoEntity_w_Lineage(auth: DomoAuth, id: str, raw: dict)
Bases: DomoEntity
Entity with lineage tracking capabilities.
Extends DomoEntity to include lineage tracking functionality, enabling entities to track their relationships and dependencies within the Domo ecosystem.
Attributes:
| Name | Type | Description |
|---|---|---|
Lineage |
Any | None
|
Lineage tracking object for dependency management (hidden in repr) |
Federation |
Any | None
|
Federation context for publish/subscribe state (hidden in repr) |
__skip_lineage_registration__ |
Any | None
|
Class attribute to opt out of registration requirement. Set to True for abstract or intermediate base classes that should not be registered. |
name
property
¶
name: str
Get the display name for this entity.
All entities with lineage provide a name property for consistent identification in lineage diagrams and reports.
Entities that use 'title' (DomoCard, DomoPage) should override this as: @property def name(self) -> str: return self.title or f"Untitled {self.entity_type}"
Entities with a 'name' attribute (DomoDataset, DomoDataflow, DomoPublication) will use their dataclass field directly.
Returns:
| Type | Description |
|---|---|
str
|
Display name for the entity |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If entity doesn't have name, title, or override this property |
enable_federation_support ¶
enable_federation_support()
Ensure this entity has an attached FederationContext helper. returns FederationContext instance.
Source code in src/crew_dcs/base/entities.py
536 537 538 539 540 541 542 543 544 545 546 | |
probe_is_published
async
classmethod
¶
probe_is_published(
entity_id: str,
subscriber_auth: DomoAuth,
parent_auth: DomoAuth | None = None,
parent_auth_retrieval_fn: Callable | None = None,
session: AsyncClient | None = None,
debug_api: bool = False,
max_subscriptions_to_check: int | None = None,
context: RouteContext | None = None,
)
Check if entity is published (federated) - works for all entity types.
Uses lineage type registry to determine entity type automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
str
|
Entity identifier to check |
required |
subscriber_auth
|
DomoAuth
|
Auth for subscriber instance |
required |
parent_auth
|
DomoAuth | None
|
Optional pre-existing publisher auth |
None
|
parent_auth_retrieval_fn
|
Callable | None
|
Callable to retrieve publisher auth |
None
|
session
|
AsyncClient | None
|
Optional HTTP session for reuse |
None
|
debug_api
|
bool
|
Enable debug logging |
False
|
max_subscriptions_to_check
|
int | None
|
Limit subscription checking |
None
|
context
|
RouteContext | None
|
Optional pre-built context |
None
|
Returns:
| Type | Description |
|---|---|
|
FederationContext with subscription info if published |
Raises:
| Type | Description |
|---|---|
ValueError
|
If class not registered with lineage type or missing auth |
Source code in src/crew_dcs/base/entities.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | |
DomoManager
dataclass
¶
DomoManager(auth: DomoAuth)
Bases: DomoBase
Base class for entity managers that handle collections of entities.
Provides the foundation for manager classes that handle operations on collections of entities (e.g., DomoDatasets, DomoGroups, DomoUsers).
Attributes:
| Name | Type | Description |
|---|---|---|
auth |
DomoAuth
|
Authentication object for API requests (hidden in repr) |
get
abstractmethod
async
¶
get(*args: Any, **kwargs: Any) -> list[DomoEntity]
Retrieve entities based on provided criteria.
Must be implemented by subclasses to handle entity-specific retrieval and filtering logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
Any
|
Positional arguments for entity retrieval |
()
|
**kwargs
|
Any
|
Keyword arguments for filtering and options |
{}
|
Returns:
| Type | Description |
|---|---|
list[DomoEntity]
|
list[DomoEntity]: List of entity instances retrieved |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Must be implemented by subclasses |
Source code in src/crew_dcs/base/entities.py
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | |
DomoSubEntity
dataclass
¶
DomoSubEntity(parent: DomoEntity)
Bases: DomoBase
Base class for entities that belong to a parent entity.
Handles entities that are sub-components of other entities, such as columns in a dataset or slides in a page. Automatically inherits authentication and parent references.
Attributes:
| Name | Type | Description |
|---|---|---|
parent |
DomoEntity
|
Reference to the parent entity |
auth |
Authentication object (inherited from parent, hidden in repr) |
from_parent
classmethod
¶
from_parent(parent: DomoEntity)
Create a sub-entity instance from a parent entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
DomoEntity
|
The parent entity to derive from |
required |
Returns:
| Name | Type | Description |
|---|---|---|
DomoSubEntity |
New sub-entity instance with inherited properties |
Source code in src/crew_dcs/base/entities.py
725 726 727 728 729 730 731 732 733 734 735 | |