statements
Creates, updates, deletes, gets or lists a statements resource.
Overview
| Name | statements |
| Type | Resource |
| Id | confluent.sql.statements |
Fields
The following fields are returned by SELECT queries:
- get_sqlv1_statement
- list_sqlv1_statements
Statement.
| Name | Datatype | Description |
|---|---|---|
name | string | The user provided name of the resource, unique within this environment. (example: sql123, pattern: [a-z0-9]([-a-z0-9][a-z0-9])?(.[a-z0-9]([-a-z0-9][a-z0-9])?)*) |
environment_id | string | The unique identifier for the environment. |
organization_id | string (uuid) | The unique identifier for the organization. |
api_version | string | APIVersion defines the schema version of this representation of a resource. (sql/v1) (example: sql/v1) |
kind | string | Kind defines the object this REST resource represents. (Statement) |
metadata | object | The metadata of the statement. |
result | object | Statement Result represents a resource used to model results of SQL statements. The API allows you to read your SQL statement result. |
spec | object | The specs of the Statement |
status | object | The status of the Statement |
Statements.
| Name | Datatype | Description |
|---|---|---|
name | string | The user provided name of the resource, unique within this environment. (example: sql123, pattern: [a-z0-9]([-a-z0-9][a-z0-9])?(.[a-z0-9]([-a-z0-9][a-z0-9])?)*) |
environment_id | string | The unique identifier for the environment. |
organization_id | string (uuid) | The unique identifier for the organization. |
api_version | string | APIVersion defines the schema version of this representation of a resource. (sql/v1) (example: sql/v1) |
kind | string | Kind defines the object this REST resource represents. (Statement) |
metadata | object | The metadata of the statement. |
result | object | Statement Result represents a resource used to model results of SQL statements. The API allows you to read your SQL statement result. |
spec | object | The specs of the Statement |
status | object | The status of the Statement |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_sqlv1_statement | select | organization_id, environment_id, statement_name | Make a request to read a statement. | |
list_sqlv1_statements | select | organization_id, environment_id | spec.compute_pool_id, page_size, page_token, label_selector | Retrieve a sorted, filtered, paginated list of all statements. |
create_sqlv1_statement | insert | organization_id, environment_id, spec, name | Make a request to create a statement. | |
patch_sqlv1_statement | update | organization_id, environment_id, statement_name | Make a request to patch a statement. | |
update_sqlv1_statement | replace | organization_id, environment_id, statement_name, spec, name, metadata | Make a request to update a statement. The request will fail with a 409 Conflict error if the Statement has changed since it was fetched. In this case, do a GET, reapply the modifications, and try the update again. | |
delete_sqlv1_statement | delete | organization_id, environment_id, statement_name | Make a request to delete a statement. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
environment_id | string | The unique identifier for the environment. |
organization_id | string (uuid) | The unique identifier for the organization. |
statement_name | string | The unique identifier for the statement. |
label_selector | string | A comma-separated label selector to filter the statements. |
page_size | integer | A pagination size for collection requests. |
page_token | string | An opaque pagination token for collection requests. |
spec.compute_pool_id | string | Filter the results by exact match for spec.compute_pool_id. When creating statements, if compute_pool_id is not specified, the statement will use the default compute pool. The default pool is automatically determined by the system. (example: lfcp-00000) |
SELECT examples
- get_sqlv1_statement
- list_sqlv1_statements
Make a request to read a statement.
SELECT
name,
environment_id,
organization_id,
api_version,
kind,
metadata,
result,
spec,
status
FROM confluent.sql.statements
WHERE organization_id = '{{ organization_id }}' -- required
AND environment_id = '{{ environment_id }}' -- required
AND statement_name = '{{ statement_name }}' -- required
;
Retrieve a sorted, filtered, paginated list of all statements.
SELECT
name,
environment_id,
organization_id,
api_version,
kind,
metadata,
result,
spec,
status
FROM confluent.sql.statements
WHERE organization_id = '{{ organization_id }}' -- required
AND environment_id = '{{ environment_id }}' -- required
AND spec.compute_pool_id = '{{ spec.compute_pool_id }}'
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
AND label_selector = '{{ label_selector }}'
;
INSERT examples
- create_sqlv1_statement
- Manifest
Make a request to create a statement.
INSERT INTO confluent.sql.statements (
name,
organization_id,
environment_id,
spec,
result,
organization_id,
environment_id
)
SELECT
'{{ name }}' /* required */,
'{{ organization_id }}',
'{{ environment_id }}',
'{{ spec }}' /* required */,
'{{ result }}',
'{{ organization_id }}',
'{{ environment_id }}'
RETURNING
name,
environment_id,
organization_id,
api_version,
kind,
metadata,
result,
spec,
status
;
# Description fields are for documentation purposes
- name: statements
props:
- name: organization_id
value: "{{ organization_id }}"
description: Required parameter for the statements resource.
- name: environment_id
value: "{{ environment_id }}"
description: Required parameter for the statements resource.
- name: name
value: "{{ name }}"
description: |
The user provided name of the resource, unique within this environment.
- name: organization_id
value: "{{ organization_id }}"
description: |
The unique identifier for the organization.
- name: environment_id
value: "{{ environment_id }}"
description: |
The unique identifier for the environment.
- name: spec
description: |
The specs of the Statement
value:
statement: "{{ statement }}"
properties: "{{ properties }}"
compute_pool_id: "{{ compute_pool_id }}"
principal: "{{ principal }}"
stopped: {{ stopped }}
execution_mode: "{{ execution_mode }}"
- name: result
description: |
`Statement Result` represents a resource used to model results of SQL statements.
The API allows you to read your SQL statement result.
value:
api_version: "{{ api_version }}"
kind: "{{ kind }}"
metadata:
self: "{{ self }}"
next: "{{ next }}"
created_at: "{{ created_at }}"
results:
data: "{{ data }}"
UPDATE examples
- patch_sqlv1_statement
Make a request to patch a statement.
UPDATE confluent.sql.statements
SET
-- No updatable properties
WHERE
organization_id = '{{ organization_id }}' --required
AND environment_id = '{{ environment_id }}' --required
AND statement_name = '{{ statement_name }}' --required
RETURNING
name,
environment_id,
organization_id,
api_version,
kind,
metadata,
result,
spec,
status;
REPLACE examples
- update_sqlv1_statement
Make a request to update a statement.
The request will fail with a 409 Conflict error if the Statement has changed since it was fetched.
In this case, do a GET, reapply the modifications, and try the update again.
REPLACE confluent.sql.statements
SET
name = '{{ name }}',
organization_id = '{{ organization_id }}',
environment_id = '{{ environment_id }}',
spec = '{{ spec }}',
result = '{{ result }}'
WHERE
organization_id = '{{ organization_id }}' --required
AND environment_id = '{{ environment_id }}' --required
AND statement_name = '{{ statement_name }}' --required
AND spec = '{{ spec }}' --required
AND name = '{{ name }}' --required;
DELETE examples
- delete_sqlv1_statement
Make a request to delete a statement.
DELETE FROM confluent.sql.statements
WHERE organization_id = '{{ organization_id }}' --required
AND environment_id = '{{ environment_id }}' --required
AND statement_name = '{{ statement_name }}' --required
;