Skip to content

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 dataId from list_data_versions.

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 is_index, else of the delete.

Raises:

Type Description
ValueError

data_id is not an int.

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
async def delete_data_version(
    self,
    data_id: int,
    is_index: bool = True,
    debug_api: bool = False,
    session: httpx.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.

    Args:
        data_id: integer `dataId` from `list_data_versions`.
        is_index: index afterwards (default True). Indexing is asynchronous: poll the
            row count until it drops.
        debug_api: log the underlying requests.
        session: optional shared httpx client.
        context: optional RouteContext.

    Returns:
        ResponseGetData of the index call when `is_index`, else of the delete.

    Raises:
        ValueError: `data_id` is not an int.
        Dataset_CRUD_Error: Domo rejected the delete or index.

    Example: `await ds.Data.delete_data_version(1)`
    """
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        **context_kwargs,
    )

    res = await dataset_routes.delete_data_version(
        auth=self.parent.auth,
        dataset_id=self.parent.id,
        data_id=data_id,
        context=context,
    )

    if is_index:
        return await self.index(context=context)

    return res

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 .response.

False
context RouteContext | None

optional RouteContext.

None

Returns:

Type Description
ResponseGetData | dict

the .response of the final index call (or the ResponseGetData if return_raw).

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
async def delete_partition(
    self,
    dataset_partition_id: str,
    empty_df: pd.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.

    Args:
        dataset_partition_id: the data tag, e.g. "2025-01".
        empty_df: pre-built empty DataFrame with the dataset's columns (skips the
            schema query and the empty upload).
        is_index: index after the empty upload.
        debug_api: log the underlying requests.
        return_raw: return the last ResponseGetData instead of its `.response`.
        context: optional RouteContext.

    Returns:
        the `.response` of the final index call (or the ResponseGetData if `return_raw`).

    Raises:
        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")`
    """
    auth = self.parent.auth
    dataset_id = self.parent.id

    context = RouteContext.build_context(
        context=context,
        session=None,  # Preserve original behavior
        debug_api=debug_api,
        **context_kwargs,
    )

    if empty_df is None:
        empty_df = await self.query(
            sql="SELECT * from table limit 1",
            context=context,
        )

        await self.upload_data(
            upload_df=empty_df.head(0),
            upload_method="REPLACE",
            is_index=is_index,
            partition_key=dataset_partition_id,
            context=context,
        )

    await logger.debug("Starting Stage 1 - delete partition")

    res = await dataset_routes.delete_partition_stage_1(
        auth=auth,
        dataset_id=dataset_id,
        dataset_partition_id=dataset_partition_id,
        context=context,
    )
    await logger.debug(f"Stage 1 response -- {res.status}")

    await logger.debug("Starting Stage 2")

    res = await dataset_routes.delete_partition_stage_2(
        auth=auth,
        dataset_id=dataset_id,
        dataset_partition_id=dataset_partition_id,
        context=context,
    )

    await logger.debug(f"Stage 2 response -- {res.status}")

    await logger.debug("Starting Stage 3")

    res = await dataset_routes.index_dataset(
        auth=auth, dataset_id=dataset_id, context=context
    )
    await logger.debug(f"Stage 3 response -- {res.status}")

    if return_raw:
        return res

    return res.response

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 index_dataset.

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
async def index(
    self,
    debug_api: bool = False,
    session: httpx.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`.

    Args:
        debug_api: log the underlying request.
        session: optional shared httpx client.
        context: optional RouteContext (extra kwargs are merged into it).

    Returns:
        ResponseGetData from `index_dataset`.

    Raises:
        Dataset_CRUD_Error: Domo rejected the request.

    Example: `await ds.Data.index()`
    """
    auth = self.parent.auth
    dataset_id = self.parent.id

    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        **context_kwargs,
    )

    return await dataset_routes.index_dataset(
        auth=auth, dataset_id=dataset_id, context=context
    )

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 {"partitionId": str | None, "dataId": int}. The untagged

list[dict]

("null partition") version has partitionId None, which list_partitions

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
async def list_data_versions(
    self,
    debug_api: bool = False,
    session: httpx.AsyncClient = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> list[dict]:
    """List every data version of this dataset, tagged and untagged.

    Args:
        debug_api: log the underlying request.
        session: optional shared httpx client.
        context: optional RouteContext.

    Returns:
        list of dicts `{"partitionId": str | None, "dataId": int}`. The untagged
        ("null partition") version has `partitionId` None, which `list_partitions`
        omits, see
        tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_tagged_upload_is_additive_and_untagged_version_is_listed.

    Raises:
        Dataset_GET_Error: non-2xx response.

    Example: `untagged = [v for v in await ds.Data.list_data_versions() if v["partitionId"] is None]`
    """
    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        **context_kwargs,
    )

    res = await dataset_routes.list_data_versions(
        auth=self.parent.auth, dataset_id=self.parent.id, context=context
    )
    return res.response

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_data_versions, 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
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
async def list_partitions(
    self,
    debug_api: bool = False,
    session: httpx.AsyncClient = None,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> list[dict]:
    """List the TAGGED partitions of this dataset.

    Args:
        debug_api: log the underlying requests.
        session: optional shared httpx client.
        context: optional RouteContext.

    Returns:
        list of dicts `{"dataId": int, "partitionId": str, "dateCompleted": str,
        "rowCount": int}`. Untagged data is NOT included even though it counts toward
        the dataset total; use `list_data_versions`, see
        tests/integration/api_semantics/dataset_data_version_semantics_tests.py::test_tagged_upload_is_additive_and_untagged_version_is_listed.

    Raises:
        DatasetNotFoundError: Domo answered 404.
        Dataset_GET_Error: any other non-2xx response.

    Example: `parts = await ds.Data.list_partitions()`
    """
    auth = self.parent.auth
    dataset_id = self.parent.id

    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        **context_kwargs,
    )

    res = await dataset_routes.list_partitions(
        auth=auth, dataset_id=dataset_id, context=context
    )
    return res.response

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
async def query(
    self,
    sql: str,
    session: httpx.AsyncClient | None = None,
    filter_pdp_policy_id_ls: list[int] | None = None,  # filter by pdp policy
    loop_until_end: bool = False,  # retrieve all available rows
    limit=100,  # maximum rows to return per request.  refers to PAGINATION
    skip=0,
    maximum=100,  # equivalent to the LIMIT or TOP clause in SQL, the number of rows to return total
    return_raw: bool = False,
    debug_api: bool = False,
    debug_loop: bool = False,
    debug_num_stacks_to_drop: int = 2,
    timeout=10,  # larger API requests may require a longer response time
    maximum_retry: int = 5,
    is_return_dataframe: bool = True,
    *,
    context: RouteContext | None = None,
    **context_kwargs,
) -> pd.DataFrame:
    auth = self.parent.auth
    dataset_id = self.parent.id

    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        debug_num_stacks_to_drop=debug_num_stacks_to_drop,
        **context_kwargs,
    )

    res = None
    retry = 1

    if filter_pdp_policy_id_ls and not isinstance(filter_pdp_policy_id_ls, list):
        filter_pdp_policy_id_ls = [int(filter_pdp_policy_id_ls)]

    while (not res or not res.is_success) and retry <= maximum_retry:
        try:
            res = await dataset_routes.query_dataset_private(
                auth=auth,
                dataset_id=dataset_id,
                sql=sql,
                maximum=maximum,
                filter_pdp_policy_id_ls=filter_pdp_policy_id_ls,
                skip=skip,
                limit=limit,
                loop_until_end=loop_until_end,
                return_raw=return_raw,
                debug_loop=debug_loop,
                timeout=timeout,
                context=context,
            )

            if return_raw:
                return res

        except (RouteDatasetNotFoundError, RouteQueryRequestError):
            raise

        except DomoError as e:
            if retry <= maximum_retry and e:
                await logger.warning(
                    f"⚠️ Error.  Attempt {retry} / {maximum_retry} - {e} - while query dataset {self.id} in {self.auth.domo_instance} with {sql}"
                )

            if retry == maximum_retry:
                raise

            retry += 1

    if not is_return_dataframe:
        return res.response

    return pd.DataFrame(res.response)

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 upload_df).

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 partition_key is set: the commit is then forced to APPEND with dataTag=partition_key.

'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 is_index else of the commit.

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
async def upload_data(
    self,
    upload_df: pd.DataFrame = None,
    upload_df_ls: list[pd.DataFrame] | None = None,
    upload_file: io.TextIOWrapper | None = None,
    upload_method: str = "REPLACE",  # APPEND or REPLACE
    partition_key: str | None = None,
    is_index: bool = True,
    dataset_upload_id: str | None = None,
    session: httpx.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.

    Args:
        upload_df: one DataFrame to upload (columns in schema order, no header sent).
        upload_df_ls: several DataFrames, uploaded as parts of ONE session (overrides
            `upload_df`).
        upload_file: open CSV text file, uploaded instead of DataFrames when given.
        upload_method: "REPLACE" (default; new data replaces the untagged dataset
            contents) or "APPEND". Ignored when `partition_key` is set: the commit is
            then forced to APPEND with `dataTag=partition_key`.
        partition_key: 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.
        is_index: index after committing (default True). Indexing is asynchronous, so
            row counts are stale until it finishes; poll the count.
        dataset_upload_id: reuse an existing upload session id instead of opening one.
        session: optional shared httpx client.
        debug_api: log the underlying requests.
        context: optional RouteContext.

    Returns:
        ResponseGetData of the index call when `is_index` else of the commit.

    Raises:
        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")`
    """
    auth = self.parent.auth
    dataset_id = self.parent.id

    context = RouteContext.build_context(
        context=context,
        session=session,
        debug_api=debug_api,
        **context_kwargs,
    )

    upload_df_ls = upload_df_ls or [upload_df]

    status_message = f"{dataset_id} {partition_key} | {auth.domo_instance}"

    # stage 1 get uploadId
    retry = 1
    while dataset_upload_id is None and retry < 5:
        try:
            await logger.debug(f"Starting Stage 1 - {status_message}")

            res = await dataset_routes.upload_dataset_stage_1(
                auth=auth,
                dataset_id=dataset_id,
                partition_tag=partition_key,
                context=context,
            )
            await logger.debug(
                f"Stage 1 response -- {res.status} for {status_message}"
            )

            dataset_upload_id = res.response

        except dataset_routes.UploadDataError as e:
            await logger.warning(f"{e} - attempt{retry}")
            retry += 1

            if retry == 5:
                await logger.error(
                    f"failed to upload data for {dataset_id} in {auth.domo_instance}"
                )
                raise e

            await asyncio.sleep(5)

    # stage 2 upload_dataset
    if upload_file:
        await logger.debug(f"Starting Stage 2 - upload file for {status_message}")

        res = await dmce.gather_with_concurrency(
            n=60,
            *[  # noqa: B026
                dataset_routes.upload_dataset_stage_2_file(
                    auth=auth,
                    dataset_id=dataset_id,
                    upload_id=dataset_upload_id,
                    part_id=1,
                    data_file=upload_file,
                    context=context,
                )
            ],
        )

    else:
        await logger.debug(
            f"Starting Stage 2 - {len(upload_df_ls)} parts for {status_message}"
        )

        res = await dmce.gather_with_concurrency(
            n=60,
            *[  # noqa: B026
                dataset_routes.upload_dataset_stage_2_df(
                    auth=auth,
                    dataset_id=dataset_id,
                    upload_id=dataset_upload_id,
                    part_id=index + 1,
                    upload_df=df,
                    context=context,
                )
                for index, df in enumerate(upload_df_ls)
            ],
        )

    await logger.debug(f"Stage 2 - upload data: complete for {status_message}")

    # stage 3 commit_data
    await logger.debug(
        f"Starting Stage 3 - commit dataset_upload_id for {status_message}"
    )

    await asyncio.sleep(5)  # wait for uploads to finish

    res = await dataset_routes.upload_dataset_stage_3(
        auth=auth,
        dataset_id=dataset_id,
        upload_id=dataset_upload_id,
        update_method=upload_method,
        partition_tag=partition_key,
        is_index=False,
        context=context,
    )

    await logger.debug(f"Stage 3 - commit dataset: complete for {status_message}")

    if is_index:
        await asyncio.sleep(3)
        return await self.index(context=context)

    return res