Skip to content

core

core

Dataset core CRUD operations.

create async

create(
    auth: DomoAuth,
    dataset_name: str,
    dataset_type: str = "api",
    schema: dict | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Endpoint

  • POST /data/v2/datasources

Called by

Source code in src/crew_dcs/routes/dataset/core.py
 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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create(
    auth: DomoAuth,
    dataset_name: str,
    dataset_type: str = "api",
    schema: dict | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    body = generate_create_dataset_body(
        dataset_name=dataset_name, dataset_type=dataset_type, schema=schema
    )

    url = f"https://{auth.domo_instance}.domo.com/api/data/v2/datasources"

    res = await gd.get_data(
        auth=auth,
        method="POST",
        url=url,
        body=body,
        context=context,
    )

    if not res.is_success:
        raise Dataset_CRUD_Error(res=res)

    return res

create_dataset_enterprise_tookit async

create_dataset_enterprise_tookit(
    auth: DomoAuth,
    payload: dict,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Endpoint

  • POST /executor/v1/datasets
Source code in src/crew_dcs/routes/dataset/core.py
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
163
164
165
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def create_dataset_enterprise_tookit(
    auth: DomoAuth,
    payload: dict,  # call generate_enterprise_toolkit_body
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    url = f"https://{auth.domo_instance}.domo.com/api/executor/v1/datasets"

    res = await gd.get_data(
        auth=auth,
        method="POST",
        url=url,
        body=payload,
        context=context,
    )

    if not res.is_success:
        raise Dataset_CRUD_Error(res=res)

    return res

delete async

delete(
    auth: DomoAuth,
    dataset_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
)

Endpoint

  • DELETE /data/v3/datasources/{}

Called by

Source code in src/crew_dcs/routes/dataset/core.py
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
308
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete(
    auth: DomoAuth,
    dataset_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
):
    url = f"https://{auth.domo_instance}.domo.com/api/data/v3/datasources/{dataset_id}?deleteMethod=hard"

    res = await gd.get_data(
        auth=auth,
        method="DELETE",
        url=url,
        context=context,
    )

    if not res.is_success:
        raise Dataset_CRUD_Error(dataset_id=dataset_id, res=res)

    return res

delete_partition_stage_1 async

delete_partition_stage_1(
    auth: DomoAuth,
    dataset_id: str,
    dataset_partition_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Delete a partition (stage 1 of 3): mark the data version behind a tag as deleted.

Domo terms: DELETE /api/query/v1/datasources/{id}/tag/{tag}/data.

Parameters:

Name Type Description Default
auth DomoAuth

Domo auth for the target instance.

required
dataset_id str

id of the dataset.

required
dataset_partition_id str

the data tag / partition key, e.g. "2025-01". Only real tags work: "null", "NULL" and "None" are rejected with 404 "Data tag ... not found", so the untagged data cannot be deleted this way (use delete_data_version), see tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_untagged_data_cannot_be_deleted_by_tag.

required

Returns:

Type Description
ResponseGetData

ResponseGetData from Domo.

Raises:

Type Description
Dataset_CRUD_Error

non-2xx response.

This stage leaves the tag and its association with the data version in place (stage 2 removes those), and no empty-file upload is needed first: the index in stage 3 removes the rows. Source: a Domo engineer, 2022-09-09; not verified by a proof.

Stage 2 is delete_partition_stage_2; then call index_dataset and poll the count. Example: await delete_partition_stage_1(auth=auth, dataset_id=ds_id, dataset_partition_id="2025-01")

Endpoint

  • DELETE /query/v1/datasources/{}/tag/{}/data

Called by

Source code in src/crew_dcs/routes/dataset/core.py
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_partition_stage_1(
    auth: DomoAuth,
    dataset_id: str,
    dataset_partition_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Delete a partition (stage 1 of 3): mark the data version behind a tag as deleted.

    Domo terms: DELETE /api/query/v1/datasources/{id}/tag/{tag}/data.

    Args:
        auth: Domo auth for the target instance.
        dataset_id: id of the dataset.
        dataset_partition_id: the data tag / partition key, e.g. "2025-01". Only real tags
            work: "null", "NULL" and "None" are rejected with 404 "Data tag ... not found",
            so the untagged data cannot be deleted this way (use `delete_data_version`), see
            tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_untagged_data_cannot_be_deleted_by_tag.

    Returns:
        ResponseGetData from Domo.

    Raises:
        Dataset_CRUD_Error: non-2xx response.

    This stage leaves the tag and its association with the data version in place (stage 2
    removes those), and no empty-file upload is needed first: the index in stage 3 removes
    the rows. Source: a Domo engineer, 2022-09-09; not verified by a proof.

    Stage 2 is `delete_partition_stage_2`; then call `index_dataset` and poll the count.
    Example: `await delete_partition_stage_1(auth=auth, dataset_id=ds_id, dataset_partition_id="2025-01")`
    """

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/datasources/{dataset_id}/tag/{dataset_partition_id}/data"

    res = await gd.get_data(
        auth=auth,
        method="DELETE",
        url=url,
        context=context,
    )

    if not res.is_success:
        raise Dataset_CRUD_Error(dataset_id=dataset_id, res=res)

    return res

delete_partition_stage_2 async

delete_partition_stage_2(
    auth: DomoAuth,
    dataset_id: str,
    dataset_partition_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Delete a partition (stage 2 of 3): drop the tag association so it leaves list_partitions.

Domo terms: DELETE /api/query/v1/datasources/{id}/partition/{tag}.

Parameters:

Name Type Description Default
auth DomoAuth

Domo auth for the target instance.

required
dataset_id str

id of the dataset.

required
dataset_partition_id str

the data tag / partition key, e.g. "2025-01".

required

Returns:

Type Description
ResponseGetData

ResponseGetData from Domo.

Raises:

Type Description
Dataset_CRUD_Error

non-2xx response.

Run delete_partition_stage_1 first; this stage only detaches the tag so it stops showing in list_partitions. It is optional: a partition whose data version was deleted no longer counts toward the 400-partition limit, but the list call does not show that, so detaching keeps the list honest. Source: a Domo engineer, 2022-09-09; not verified by a proof. Untagged data is not addressed here (see delete_data_version). Example: await delete_partition_stage_2(auth=auth, dataset_id=ds_id, dataset_partition_id="2025-01")

Endpoint

  • DELETE /query/v1/datasources/{}/partition/{}

Called by

Source code in src/crew_dcs/routes/dataset/core.py
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def delete_partition_stage_2(
    auth: DomoAuth,
    dataset_id: str,
    dataset_partition_id: str,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Delete a partition (stage 2 of 3): drop the tag association so it leaves `list_partitions`.

    Domo terms: DELETE /api/query/v1/datasources/{id}/partition/{tag}.

    Args:
        auth: Domo auth for the target instance.
        dataset_id: id of the dataset.
        dataset_partition_id: the data tag / partition key, e.g. "2025-01".

    Returns:
        ResponseGetData from Domo.

    Raises:
        Dataset_CRUD_Error: non-2xx response.

    Run `delete_partition_stage_1` first; this stage only detaches the tag so it stops
    showing in `list_partitions`. It is optional: a partition whose data version was
    deleted no longer counts toward the 400-partition limit, but the list call does not
    show that, so detaching keeps the list honest. Source: a Domo engineer, 2022-09-09;
    not verified by a proof. Untagged data is not addressed here (see
    `delete_data_version`).
    Example: `await delete_partition_stage_2(auth=auth, dataset_id=ds_id, dataset_partition_id="2025-01")`
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/query/v1/datasources/{dataset_id}/partition/{dataset_partition_id}"

    res = await gd.get_data(
        auth=auth,
        method="DELETE",
        url=url,
        context=context,
    )

    if not res.is_success:
        raise Dataset_CRUD_Error(dataset_id=dataset_id, res=res)

    return res

get_dataset_by_id async

get_dataset_by_id(
    dataset_id: str,
    auth: DomoAuth | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

retrieve dataset metadata

Endpoint

  • GET /data/v3/datasources/{}

Called by

Source code in src/crew_dcs/routes/dataset/core.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_dataset_by_id(
    dataset_id: str,  # dataset id from URL
    auth: DomoAuth | None = None,  # requires full authentication
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:  # returns metadata about a dataset
    """retrieve dataset metadata"""

    url = f"https://{auth.domo_instance}.domo.com/api/data/v3/datasources/{dataset_id}"  # type: ignore

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="GET",
        context=context,
    )

    if res.status == 404 and res.response == "Not Found":
        raise DatasetNotFoundError(dataset_id=dataset_id, res=res)

    if not res.is_success:
        raise Dataset_GET_Error(dataset_id=dataset_id, res=res)

    return res

get_datasets_by_ids async

get_datasets_by_ids(
    auth: DomoAuth,
    dataset_ids: list[str],
    include_private: bool = True,
    include_all_details: bool = True,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Fetch metadata for many datasources at once.

POST /api/data/v3/datasources/bulk (body = list of dataset ids). The API returns {"dataSources": [...], "_metaData": {...}}; unless return_raw is set, res.response is unwrapped to the dataSources list.

Endpoint

  • POST /data/v3/datasources/bulk

Called by

Source code in src/crew_dcs/routes/dataset/core.py
350
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_datasets_by_ids(
    auth: DomoAuth,
    dataset_ids: list[str],
    include_private: bool = True,
    include_all_details: bool = True,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Fetch metadata for many datasources at once.

    POST /api/data/v3/datasources/bulk (body = list of dataset ids). The API
    returns ``{"dataSources": [...], "_metaData": {...}}``; unless ``return_raw``
    is set, ``res.response`` is unwrapped to the ``dataSources`` list.
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    params = {
        "includePrivate": str(include_private).lower(),
        "includeAllDetails": str(include_all_details).lower(),
    }
    url = f"https://{auth.domo_instance}.domo.com/api/data/v3/datasources/bulk"

    res = await gd.get_data(
        auth=auth,
        url=url,
        method="POST",
        body=list(dataset_ids),
        params=params,
        context=context,
    )

    if not res.is_success:
        raise Dataset_GET_Error(res=res)

    if not return_raw and isinstance(res.response, dict):
        res.response = res.response.get("dataSources", res.response)

    return res

search_datasets async

search_datasets(
    auth: DomoAuth,
    search_text: str | None = None,
    maximum: int | None = None,
    data_provider_type: str | None = None,
    tags: list[str] | str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Search for datasets by name, data provider, and/or tags.

Uses the datacenter search API to find datasets matching the search criteria.

Parameters:

Name Type Description Default
auth DomoAuth

Authentication object

required
search_text str | None

Optional text to search for in dataset names (wildcards supported)

None
maximum int | None

Maximum number of results to return

None
data_provider_type str | None

Optional dataset provider type filter

None
tags list[str] | str | None

Optional tag filter(s) — a single tag string or a list of tag strings. Each tag generates a tag_facet term filter.

None
return_raw bool

Return raw response without processing

False
context RouteContext | None

RouteContext for request configuration

None
**context_kwargs

Additional context parameters (session, debug_api, etc.)

{}

Returns:

Type Description
ResponseGetData

ResponseGetData object containing list of matching datasets

Raises:

Type Description
Dataset_GET_Error

If search operation fails

Calls route

Called by

Source code in src/crew_dcs/routes/dataset/core.py
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
445
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
483
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def search_datasets(
    auth: DomoAuth,
    search_text: str | None = None,
    maximum: int | None = None,
    data_provider_type: str | None = None,
    tags: list[str] | str | None = None,
    return_raw: bool = False,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Search for datasets by name, data provider, and/or tags.

    Uses the datacenter search API to find datasets matching the search criteria.

    Args:
        auth: Authentication object
        search_text: Optional text to search for in dataset names (wildcards supported)
        maximum: Maximum number of results to return
        data_provider_type: Optional dataset provider type filter
        tags: Optional tag filter(s) — a single tag string or a list of tag strings.
            Each tag generates a ``tag_facet`` term filter.
        return_raw: Return raw response without processing
        context: RouteContext for request configuration
        **context_kwargs: Additional context parameters (session, debug_api, etc.)

    Returns:
        ResponseGetData object containing list of matching datasets

    Raises:
        Dataset_GET_Error: If search operation fails
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    from ..datacenter import (
        Datacenter_Enum,
        Datacenter_Filter_Field_Enum,
        generate_data_center_profile_body,
        generate_search_datacenter_filter,
        generate_search_datacenter_filters,
        generate_search_datacenter_filter_search_term,
        search_datacenter,
    )
    from ..datacenter.exceptions import SearchDatacenterNoResultsFoundError

    # Normalize tags to a list
    if tags is not None and isinstance(tags, str):
        tags = [tags]

    try:
        body = None
        if data_provider_type or tags:
            # Build declarative (value, builder) filter specs.
            # generate_search_datacenter_filters skips entries whose value is None.
            filter_specs = [
                (
                    search_text,
                    lambda value: generate_search_datacenter_filter_search_term(value),
                ),
                (
                    data_provider_type,
                    lambda value: {
                        **generate_search_datacenter_filter(
                            Datacenter_Filter_Field_Enum.DATAPROVIDER,
                            value,
                        ),
                        "name": value,
                    },
                ),
            ]

            # Add one tag filter per tag
            if tags:
                for tag in tags:
                    filter_specs.append(
                        (
                            tag,
                            lambda value: generate_search_datacenter_filter(
                                Datacenter_Filter_Field_Enum.TAG,
                                value,
                            ),
                        )
                    )

            filters = generate_search_datacenter_filters(filter_specs)

            body = generate_data_center_profile_body(
                maximum=maximum,
                filters=filters,
                entity_type=Datacenter_Enum.DATASET,
            )

        res = await search_datacenter(
            auth=auth,
            body=body,
            search_text=search_text,
            entity_type=Datacenter_Enum.DATASET,
            maximum=maximum,
            context=context,
        )
    except SearchDatacenterNoResultsFoundError:
        # No results is valid - return empty list
        res = rgd.ResponseGetData(
            status=200,
            response=[],
            is_success=True,
        )

    if return_raw:
        return res

    if not res.is_success:
        raise Dataset_GET_Error(res=res)

    return res

update_dataset_properties async

update_dataset_properties(
    auth: DomoAuth,
    dataset_id: str,
    name: str | None = None,
    description: str | None = None,
    body: dict | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> ResponseGetData

Update a datasource's name and/or description.

PUT /api/data/v3/datasources/{dataset_id}/properties

Endpoint

  • PUT /data/v3/datasources/{}/properties

Called by

Source code in src/crew_dcs/routes/dataset/core.py
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
@gd.route_function
@log_call(
    level_name="route",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def update_dataset_properties(
    auth: DomoAuth,
    dataset_id: str,
    name: str | None = None,
    description: str | None = None,
    body: dict | None = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> rgd.ResponseGetData:
    """Update a datasource's name and/or description.

    PUT /api/data/v3/datasources/{dataset_id}/properties
    """
    context = RouteContext.build_context(context=context, **context_kwargs)

    url = f"https://{auth.domo_instance}.domo.com/api/data/v3/datasources/{dataset_id}/properties"

    if body is None:
        body = {"dataSourceName": name, "dataSourceDescription": description}

    res = await gd.get_data(
        auth=auth, url=url, method="PUT", body=body, context=context
    )

    if not res.is_success:
        raise Dataset_CRUD_Error(dataset_id=dataset_id, res=res)

    return res

See also

Domo Knowledge Base categories

  • Manage Data (DataSets, DataSet Views, PDP, tags)