create_cluster_operation

DwhManagementApi.create_cluster_operation(role_id, clustertype, operations, input_details, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Create DWH tenant/WLM queue or submit a DWH query

Creates a tenant or WLM queue, or submits a DWH query. Supported only when clustertype=dwh: - tenants — create tenant asynchronously. Body requires TenantName and DisplayName - wlm — create a workload management queue (provisioned only) - queries — submit a query. Body requires QueryType of vacuum, system-tables, or kill

Parameters:
  • role_id (str) – Amorphic role ID used for authorization. (required)

  • clustertype (str) – Must be dwh for create/submit operations. Supported operations: - tenants — create tenant - wlm — create a workload management queue - queries — submit a query (required)

  • operations (str) – Operation to perform. One of tenants, wlm, or queries. (required)

  • input_details (InputDetails) – Body depends on operations: - tenants: see Tenant - wlm: see WLMQueueConfig - queries: see DWHQueryInput (required)

  • content_type (str) – Should be application/json when sending a body.

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

OperationsResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /clusters/{clustertype}/{operations}

Parameter examples

Name

In

Example

role_id

header

"role-admin"

Content-Type

header

"application/json"

clustertype

path

"dwh"

operations

path

"queries"

Request

Body depends on `operations`: - tenants: see Tenant - wlm: see WLMQueueConfig - queries: see DWHQueryInput

Create tenant

{
  "TenantName": "sales",
  "DisplayName": "Sales Tenant",
  "TenantDescription": "Sales analytics tenant"
}

Create WLM queue

{
  "WLMQueueName": "analytics-queue",
  "Description": "Analytics workload queue"
}

Submit vacuum query

{
  "QueryType": "vacuum",
  "SchemaName": "sales",
  "TableName": "monthly_orders"
}

Query a system table

{
  "QueryType": "system-tables",
  "SystemTable": "STV_SESSIONS",
  "Limit": 1
}

Kill a session or query

{
  "QueryType": "kill",
  "KillType": "SESSION",
  "ProcessID": 12345
}

Success (HTTP 200)

Accepted/completed. Tenant create returns an initiation Message. Query submit returns QueryDetails. WLM create returns a success Message.

tenantCreateStarted

{
  "Message": "Tenant creation initiated and will be running in the background"
}

querySubmitted

{
  "QueryDetails": {
    "QueryId": "a1b2c3d4-1111-2222-3333-444455556666",
    "QueryStatus": "SUBMITTED"
  }
}

wlmCreated

{
  "Message": "Successfully created queue details in the work load configuration - analytics-queue"
}

Errors

Documented error codes: IPV-1008, IPV-1004.

HTTP 400

Validation or unsupported operation.

missingQueryType

{
  "Message": "IPV-1008 - Missing required parameter - QueryType"
}

invalidOperation

{
  "Message": "IPV-1004 - Invalid operation type. Supported types are tenants, wlm and queries."
}

HTTP 500

Backend/generic failure.