update_query_workbook

PlaygroundApi.update_query_workbook(workbook_id, role_id, content_type=None, action=None, query_workbook_update=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Update a workbook, or stop its running queries

Has two modes, selected by the action query parameter. The caller needs editor access or higher on the workbook. - Without action: updates the workbook. Every body property is optional and an empty body is a valid no-op that still returns 200. Properties are written only when the supplied value differs from the stored one, except ExpireAfter, which always rewrites the expiry from the current time. Setting Title also sets IsTitleUpdated to true, which stops auto-generation from later overwriting it. - action=stop_running_queries: aborts all in-flight queries belonging to the workbook. The request body is ignored entirely in this mode. Unlike GET on the same path, an unrecognised action value is rejected here with IPV-1004. Note that an unknown workbook id is reported as HTTP 400 with IPV-1002, not 404.

Parameters:
  • workbook_id (str) – Workbook identifier. (required)

  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the caller belongs to. (required)

  • content_type (str) – Must be application/json when a body is sent.

  • action (str) – Omit to update the workbook. Set to stop_running_queries to abort all in-flight queries instead, in which case the request body is ignored. Any other value is rejected with IPV-1004.

  • query_workbook_update (QueryWorkbookUpdate)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

UpdateQueryWorkbook200Response

Returns:

Returns the result object.

Request and Response Examples

HTTP: PUT /workbooks/{workbook_id}

Parameter examples

Name

In

Example

workbook_id

path

"b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"

role_id

header

"role-admin"

action

query

"stop_running_queries"

Request

The request body is optional.

Rename, which also marks the title as manually set

{
  "Title": "Quarterly order analysis"
}

Pin the workbook in listings

{
  "IsPinned": true
}

Extend the expiry, recomputed from now

{
  "ExpireAfter": 730
}

Clear the stored chat configuration by sending null

{
  "ChatConfiguration": null
}

Replace the chat configuration

{
  "ChatConfiguration": {
    "AutoRunQuery": "disabled",
    "TargetLocation": "redshift",
    "RowLimit": 500,
    "QueryOn": {
      "Datasets": [
        "c2f7d3b1-1a2b-4d8e-9f3a-2b3c4d5e6f70"
      ]
    }
  }
}

Success (HTTP 200)

Workbook updated, or stop requests issued when action=stop_running_queries.

Workbook updated

{
  "Message": "Workbook updated successfully"
}

Stops triggered, action=stop_running_queries

{
  "Message": "Triggered stop on running queries successfully",
  "StoppedQueries": [
    "f5c0a6e4-4d5e-4012-8c6d-5e6f70819203"
  ]
}

Nothing was running, action=stop_running_queries

{
  "Message": "No running queries found to stop",
  "StoppedQueries": []
}

Errors

Documented error codes: GE-1001, IPV-1002, IPV-1004, AUTH-1012, AUTH-1010.

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: GE-1001 (body present but unparseable), IPV-1002 (workbook id not found), IPV-1004 (invalid action, Title, IsPinned, AutoGenerateTitle, ExpireAfter, or any chat or query configuration violation), AUTH-1012 (the caller lacks editor access), AUTH-1010 (ChatConfiguration RoleId is not a role the caller is attached to).

Unrecognised action value

{
  "Message": "IPV-1004 - Invalid value for action, must be one of - stop_running_queries"
}

Unknown workbook id

{
  "Message": "IPV-1002 - Invalid WorkbookId - b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f, resource not found."
}

Caller lacks editor access

{
  "Message": "AUTH-1012 - User is not authorized to perform this operation"
}

ExpireAfter outside the permitted range

{
  "Message": "IPV-1004 - Invalid value for ExpireAfter, must be between 1 and 1825"
}

HTTP 500

Something went wrong at backend