Complete a job
Marks a job as completed along with its result. The result shape is selected by the type field in the body
and must match the job’s type. It is a no-op for a job already in a terminal state (completed, cancelled,
failed); a pending_cancellation job can still be completed if it finishes before the cancellation is processed.
Requires write access to jobs.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier for a job.
Body
Marks a job as completed along with its result. The body is polymorphic: the type field selects the result
shape, which must match the job's type. The remaining fields depend on type.
Common variants:
forecast—{ "type": "forecast", "cost": <integer>, "rows": <integer> }refresh_materialized_view—{ "type": "refresh_materialized_view", "snapshot_id": "<string>", "row_stats": { "affected_rows": <integer>, "inserted_rows": <integer>, "updated_rows": <integer>, "deleted_rows": <integer> } }datasets_execute_dml—{ "type": "datasets_execute_dml", "affected_rows": <integer>, ... }
Other supported type values include datasets_create_table, datasets_truncate_table, datasets_delete_table,
datasets_deliver_data, datasets_calculate_column_stats, datasets_suggest_mappings, model_inference_run,
model_training_run, models_deliver_model, models_train_classifier, and health_check.
Discriminator selecting the result shape. Must match the job's type.
Response
OK
Unique identifier for the job.
The data plane the job runs on.
{
"type": "api_user",
"company_id": 1,
"user_id": 1248
}failed, cancelled, completed, pending, pending_cancellation, running The type associated with the job. Jobs can have a type of nql-forecast or materialize-view.
- Option 1
- Option 2
{
"nql": "CREATE MATERIALIZED VIEW \"sampleNQL\" as WITH OrderedData AS (\n SELECT\n \"mobile_id_unique_identifier\".\"value\" AS mobile_id,\n \"timestamp_object\".\"day\",\n \"timestamp_object\".\"hour\",\n \"geographic_location\".\"latitude\",\n \"geographic_location\".\"longitude\",\n \"event_timestamp\",\n LAG(\"event_timestamp\", 1) OVER (PARTITION BY \"mobile_id_unique_identifier\".\"value\", \"geographic_location\".\"latitude\", \"geographic_location\".\"longitude\" ORDER BY \"event_timestamp\") AS prev_timestamp\n FROM\n \"company_data\".\"6402\"\n WHERE\n \"mobile_id_unique_identifier\".\"value\" IS NOT NULL \n), \nContinuousPresence AS (\n SELECT\n mobile_id,\n \"day\",\n \"hour\",\n latitude,\n longitude,\n event_timestamp,\n prev_timestamp,\n CASE\n WHEN extract(minute FROM event_timestamp) - extract(minute FROM prev_timestamp) BETWEEN 40 AND 120 THEN 1\n ELSE 0\n END AS is_continuous\n FROM\n OrderedData\n)\nSELECT\n mobile_id,\n \"day\",\n \"hour\",\n latitude,\n longitude\nFROM\n ContinuousPresence\nWHERE\n is_continuous = 1\nGROUP BY\n mobile_id,\n \"day\",\n \"hour\",\n latitude,\n longitude\n",
"dataset_id": 6404,
"stats_enabled": true,
"compiled_sql": "SELECT\n `t`.`mobile_id`,\n `t`.`day`,\n `t`.`hour`,\n `t`.`latitude`,\n `t`.`longitude`\nFROM\n (SELECT\n `ds_6402`.`mobile_id_unique_identifier`['value'] `mobile_id`,\n `ds_6402`.`timestamp_object`['day'] `day`,\n `ds_6402`.`timestamp_object`['hour'] `hour`,\n `ds_6402`.`geographic_location`['latitude'] `latitude`,\n `ds_6402`.`geographic_location`['longitude'] `longitude`,\n CASE\n WHEN EXTRACT(MINUTE FROM `ds_6402`.`event_timestamp`) - EXTRACT(MINUTE FROM LAG(`ds_6402`.`event_timestamp`, 1) OVER (\n PARTITION BY `ds_6402`.`mobile_id_unique_identifier`.`value`, `ds_6402`.`geographic_location`.`latitude`, `ds_6402`.`geographic_location`.`longitude`\n ORDER BY `ds_6402`.`event_timestamp` NULLS LAST)) >= 40 AND EXTRACT(MINUTE FROM `ds_6402`.`event_timestamp`) - EXTRACT(MINUTE FROM LAG(`ds_6402`.`event_timestamp`, 1) OVER (\n PARTITION BY `ds_6402`.`mobile_id_unique_identifier`.`value`, `ds_6402`.`geographic_location`.`latitude`, `ds_6402`.`geographic_location`.`longitude`\n ORDER BY `ds_6402`.`event_timestamp` NULLS LAST)) <= 120\n THEN 1\n ELSE 0\n END `is_continuous`\n FROM\n narrative.datasets.ds_6402 `ds_6402`) `t`\nWHERE\n `t`.`is_continuous` = 1\nGROUP BY\n `t`.`mobile_id`,\n `t`.`day`,\n `t`.`hour`,\n `t`.`latitude`,\n `t`.`longitude`"
}The internal job executor tied to the job.
causes of job failure
The unique ID associated with the job.
The output of a materialized view.
- Option 1
- Option 2
{
"dataset_id": 6404,
"snapshot_id": 739881302291276700,
"recalculation_id": "abf9a2ec-426b-4751-bd16-fcb435061925"
}The timestamp representing when the job was created.
The timestamp representing when the job was updated.
The timestamp representing when the job finished.
The compute pool associated with the job, if any.
The type of the execution cluster to run the job on.
dedicatedruns job on a dedicated cluster.sharedruns job on a shared cluster.
dedicated, shared 
