create_query_workbook

PlaygroundApi.create_query_workbook(role_id, content_type=None, query_workbook_create=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Create a workbook

Creates a new query workbook owned by the caller. Every field is optional and the body may be omitted entirely, which creates a workbook titled “New Workbook” that expires in 365 days. Both configuration objects use closed key sets: sending a property that is not documented on them is rejected with IPV-1004.

Parameters:
  • 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.

  • query_workbook_create (QueryWorkbookCreate)

  • _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:

QueryWorkbookCreateResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /workbooks

Parameter examples

Name

In

Example

role_id

header

"role-admin"

Request

The request body is optional.

Empty body, creating a workbook with default settings

{}

Named workbook

{
  "Title": "Monthly order analysis"
}

Workbook scoped to specific datasets for SQL AI

{
  "Title": "Monthly order analysis",
  "ExpireAfter": 90,
  "ChatConfiguration": {
    "AutoRunQuery": "enabled",
    "TargetLocation": "s3athena",
    "RowLimit": 1000,
    "QueryOn": {
      "Datasets": [
        "c2f7d3b1-1a2b-4d8e-9f3a-2b3c4d5e6f70"
      ],
      "SystemDatasets": []
    }
  }
}

Workbook pinned to a specific Athena workgroup

{
  "Title": "Finance scratchpad",
  "QueryConfiguration": {
    "QueryTargetLocation": "athena",
    "WorkGroup": "AmazonAthenaEngineV3",
    "AssumeRole": "no"
  }
}

Success (HTTP 200)

Workbook created.

Request / response example

{
  "Message": "Workbook created successfully",
  "WorkbookId": "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
}

Errors

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

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1002 (Title is not a non-empty string, or the caller is not a known user), IPV-1004 (invalid AutoGenerateTitle, ExpireAfter, or any chat or query configuration violation, including unrecognised keys and the Redshift mutual-exclusion rules), AUTH-1010 (ChatConfiguration RoleId is not a role the caller is attached to).

Title supplied but empty

{
  "Message": "IPV-1002 - Invalid value for Title"
}

Configuration object contains an unsupported key

{
  "Message": "IPV-1004 - Invalid value for ChatConfiguration, contains unsupported keys - {'Foo'}"
}

WorkGroup combined with a Redshift target

{
  "Message": "IPV-1004 - Invalid value for QueryConfiguration, WorkGroup is not applicable when QueryTargetLocation is redshift"
}

ChatConfiguration RoleId is not one of the caller’s roles

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

HTTP 500

Backend failure. Also returned when ChatConfiguration supplies QueryOn without TargetLocation. Body is {“Message”: “<CODE> - <text>”}.