dataset_data
dataset_data ¶
a class based approach for interacting with Domo Datasets
DomoDataset_Data
dataclass
¶
DomoDataset_Data(parent: DomoEntity)
Bases: DomoSubEntity
interacts with domo datasets
delete_data_version
async
¶
delete_data_version(
data_id: int,
is_index: bool = True,
debug_api: bool = False,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> ResponseGetData
Delete one data version by id, leaving every other version in place.
This is how to remove the untagged ("null partition") data while keeping tagged partitions, see tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_delete_untagged_data_version_keeps_tagged_partitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_id
|
int
|
integer |
required |
is_index
|
bool
|
index afterwards (default True). Indexing is asynchronous: poll the row count until it drops. |
True
|
debug_api
|
bool
|
log the underlying requests. |
False
|
session
|
AsyncClient
|
optional shared httpx client. |
None
|
context
|
RouteContext | None
|
optional RouteContext. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseGetData
|
ResponseGetData of the index call when |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Dataset_CRUD_Error
|
Domo rejected the delete or index. |
Example: await ds.Data.delete_data_version(1)
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | |
delete_partition
async
¶
delete_partition(
dataset_partition_id: str,
empty_df: DataFrame = None,
is_index: bool = True,
debug_api: bool = False,
return_raw: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> ResponseGetData | dict
Delete one tagged partition (data tag) from this dataset.
When empty_df is None this first queries one row for the schema and uploads an
empty frame under the tag, then runs delete stage 1 (mark the version deleted),
stage 2 (drop the tag association) and indexes. Only real tags work; untagged data
cannot be deleted by tag ("null" is rejected with 404), use delete_data_version,
see tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_untagged_data_cannot_be_deleted_by_tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_partition_id
|
str
|
the data tag, e.g. "2025-01". |
required |
empty_df
|
DataFrame
|
pre-built empty DataFrame with the dataset's columns (skips the schema query and the empty upload). |
None
|
is_index
|
bool
|
index after the empty upload. |
True
|
debug_api
|
bool
|
log the underlying requests. |
False
|
return_raw
|
bool
|
return the last ResponseGetData instead of its |
False
|
context
|
RouteContext | None
|
optional RouteContext. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseGetData | dict
|
the |
Raises:
| Type | Description |
|---|---|
Dataset_CRUD_Error
|
a delete stage was rejected. |
Indexing is asynchronous, so counts are stale until it finishes.
Example: await ds.Data.delete_partition("2025-01")
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 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 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
index
async
¶
index(
debug_api: bool = False,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> ResponseGetData
Ask Domo to index this dataset's pending data versions.
Indexing is asynchronous: this returns before the queryable row count reflects
recent uploads or deletes (and SQL queries 404 until the first index finishes);
both rest on observed runs, not verified. Poll SELECT COUNT(*) until it equals
the expected value. The response carries a requestKey, not an index id; see
routes.dataset.index_dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
log the underlying request. |
False
|
session
|
AsyncClient
|
optional shared httpx client. |
None
|
context
|
RouteContext | None
|
optional RouteContext (extra kwargs are merged into it). |
None
|
Returns:
| Type | Description |
|---|---|
ResponseGetData
|
ResponseGetData from |
Raises:
| Type | Description |
|---|---|
Dataset_CRUD_Error
|
Domo rejected the request. |
Example: await ds.Data.index()
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
list_data_versions
async
¶
list_data_versions(
debug_api: bool = False,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> list[dict]
List every data version of this dataset, tagged and untagged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
log the underlying request. |
False
|
session
|
AsyncClient
|
optional shared httpx client. |
None
|
context
|
RouteContext | None
|
optional RouteContext. |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
list of dicts |
list[dict]
|
("null partition") version has |
list[dict]
|
omits, see |
list[dict]
|
tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_tagged_upload_is_additive_and_untagged_version_is_listed. |
Raises:
| Type | Description |
|---|---|
Dataset_GET_Error
|
non-2xx response. |
Example: untagged = [v for v in await ds.Data.list_data_versions() if v["partitionId"] is None]
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
list_partitions
async
¶
list_partitions(
debug_api: bool = False,
session: AsyncClient = None,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> list[dict]
List the TAGGED partitions of this dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug_api
|
bool
|
log the underlying requests. |
False
|
session
|
AsyncClient
|
optional shared httpx client. |
None
|
context
|
RouteContext | None
|
optional RouteContext. |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
list of dicts `{"dataId": int, "partitionId": str, "dateCompleted": str, |
list[dict]
|
"rowCount": int}`. Untagged data is NOT included even though it counts toward |
list[dict]
|
the dataset total; use |
list[dict]
|
tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_tagged_upload_is_additive_and_untagged_version_is_listed. |
Raises:
| Type | Description |
|---|---|
DatasetNotFoundError
|
Domo answered 404. |
Dataset_GET_Error
|
any other non-2xx response. |
Example: parts = await ds.Data.list_partitions()
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | |
query
async
¶
query(
sql: str,
session: AsyncClient | None = None,
filter_pdp_policy_id_ls: list[int] | None = None,
loop_until_end: bool = False,
limit=100,
skip=0,
maximum=100,
return_raw: bool = False,
debug_api: bool = False,
debug_loop: bool = False,
debug_num_stacks_to_drop: int = 2,
timeout=10,
maximum_retry: int = 5,
is_return_dataframe: bool = True,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> DataFrame
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
34 35 36 37 38 39 40 41 42 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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
upload_data
async
¶
upload_data(
upload_df: DataFrame = None,
upload_df_ls: list[DataFrame] | None = None,
upload_file: TextIOWrapper | None = None,
upload_method: str = "REPLACE",
partition_key: str | None = None,
is_index: bool = True,
dataset_upload_id: str | None = None,
session: AsyncClient = None,
debug_api: bool = False,
*,
context: RouteContext | None = None,
**context_kwargs,
) -> ResponseGetData
Upload rows to this dataset: open session, upload parts, commit, optionally index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
upload_df
|
DataFrame
|
one DataFrame to upload (columns in schema order, no header sent). |
None
|
upload_df_ls
|
list[DataFrame] | None
|
several DataFrames, uploaded as parts of ONE session (overrides
|
None
|
upload_file
|
TextIOWrapper | None
|
open CSV text file, uploaded instead of DataFrames when given. |
None
|
upload_method
|
str
|
"REPLACE" (default; new data replaces the untagged dataset
contents) or "APPEND". Ignored when |
'REPLACE'
|
partition_key
|
str | None
|
data tag (partition) to store the rows under, e.g. "2025-01"; None uploads untagged data. A tagged upload is ADDITIVE next to untagged data: the untagged rows keep counting in the dataset total, see tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_tagged_upload_is_additive_and_untagged_version_is_listed. |
None
|
is_index
|
bool
|
index after committing (default True). Indexing is asynchronous, so row counts are stale until it finishes; poll the count. |
True
|
dataset_upload_id
|
str | None
|
reuse an existing upload session id instead of opening one. |
None
|
session
|
AsyncClient
|
optional shared httpx client. |
None
|
debug_api
|
bool
|
log the underlying requests. |
False
|
context
|
RouteContext | None
|
optional RouteContext. |
None
|
Returns:
| Type | Description |
|---|---|
ResponseGetData
|
ResponseGetData of the index call when |
Raises:
| Type | Description |
|---|---|
UploadDataError
|
a stage failed (stage 1 is retried up to 5 times first). |
Related: tagged data is listed by list_partitions; untagged data only by
list_data_versions; delete_data_version removes a version by id.
Example: await ds.Data.upload_data(upload_df=df, partition_key="2025-01")
Calls route
Source code in src/crew_dcs/classes/DomoDataset/dataset_data.py
153 154 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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 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 264 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 | |