Skip to main content

export-datahub-dataset-records

dci export-datahub-dataset-records name [flags]

Returns one page of the live records of a DataHub dataset, as CSV (default) or as newline-delimited JSON in the same shape as the /datahub/v1/events payload.

A time window is required: startTime is inclusive, endTime is exclusive, and the window must not exceed 366 days. Rows are ordered by their event time and event id, and pages never overlap: read the X-Next-Page-Token response header and pass it back as pageToken until the header is absent. X-Row-Count carries the number of rows in the page. Only live rows are returned; rows deleted through the console or the delete endpoints are excluded.

Every row starts with five provenance columns (event_id, batch, source, export_time, updated_by) followed by the dataset's business columns in the CSV ingest vocabulary (usage_date, fixed.<key>, label.<key>, project_label.<key>, system_label.<key>, metric.<type>). The business columns are computed from the rows of each page, so consecutive pages can have different label and metric columns; union the headers when concatenating pages. Datasets created with the FOCUS schema template use the FOCUS column names instead and can only be exported as CSV.

To re-import an export into another dataset, drop the batch, source, export_time and updated_by columns, and either drop event_id or rename it to id.

Flags

--format: (string default:"csv" enum:"csv","jsonl")

--start-time: (string format:date-time)

--end-time: (string format:date-time)

--max-results: (integer format:int64 default:10000)

--page-token: (string)

Output

OK - One page of records. The body is streamed.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

Returns: string (binary)

Raw JSON schema
{
"type": "string",
"format": "binary"
}

Errors

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
42950RATE_LIMITEDToo many requests. Retryable — the CLI reports the server-provided delay.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.