Skip to main content

attachments

Creates, updates, deletes, gets or lists an attachments resource.

Overview

Nameattachments
TypeResource
Idclickhouse.udfs.attachments

Fields

The following fields are returned by SELECT queries:

Successful response.

NameDatatypeDescription
service_idstring (uuid)ID of the attached service. (pattern: <code>^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$</code>) (wire: serviceId)
function_namestringName of the UDF. (wire: functionName)
statusstringCurrent attachment lifecycle state. (deployed, deprovisioning, error, provisioning, standby)
versionintegerAttached UDF version.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfunction_name, service_id, organization_idDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Returns the current attachment of a UDF to one service.
listselectfunction_name, organization_idcursor, limitDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Returns the current service attachments for a UDF, with at most one attachment per service.
updateupdatefunction_name, service_id, organization_idDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Attaches one UDF version to a service, replacing the current version when necessary. When version is omitted, the latest ready version is attached.
deletedeletefunction_name, service_id, organization_idDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Detaches a UDF from a service.

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.

NameDatatypeDescription
function_namestringName of the UDF. (wire: functionName)
organization_idstringClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID)
service_idstring (uuid)ID of the requested service. (wire: serviceId)
cursorstringCursor returned in pagination.nextCursor from the previous page.
limitintegerMaximum number of records to return per page. Defaults to 100. Maximum is 100.

SELECT examples

Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Returns the current attachment of a UDF to one service.

SELECT
service_id,
function_name,
status,
version
FROM clickhouse.udfs.attachments
WHERE function_name = '{{ function_name }}' -- required
AND service_id = '{{ service_id }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
;

UPDATE examples

Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Attaches one UDF version to a service, replacing the current version when necessary. When version is omitted, the latest ready version is attached.

UPDATE clickhouse.udfs.attachments
SET
version = {{ version }}
WHERE
function_name = '{{ function_name }}' --required
AND service_id = '{{ service_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
RETURNING
request_id,
result,
status;

DELETE examples

Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Detaches a UDF from a service.

DELETE FROM clickhouse.udfs.attachments
WHERE function_name = '{{ function_name }}' --required
AND service_id = '{{ service_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
;