Skip to main content

versions

Creates, updates, deletes, gets or lists a versions resource.

Overview

Nameversions
TypeResource
Idclickhouse.udfs.versions

Fields

The following fields are returned by SELECT queries:

Successful response.

NameDatatypeDescription
function_namestringName of the UDF. Unique within the organization. (wire: functionName)
return_namestringName of the returned value, or null when unnamed. (wire: returnName)
argumentsarrayArguments passed to the UDF command.
command_read_timeoutintegerCommand stdout read timeout in milliseconds. (wire: commandReadTimeout)
command_write_timeoutintegerCommand stdin write timeout in milliseconds. (wire: commandWriteTimeout)
created_atstring (date-time)Creation timestamp. (wire: createdAt)
errorstringBuild error, or null when no build error is present.
formatstringInput and output format used by the UDF command.
max_command_execution_timeintegerMaximum command execution time in seconds for executable_pool UDFs. (wire: maxCommandExecutionTime)
memory_limit_mibintegerMaximum memory, in MiB, available to each UDF sandbox process. Null uses the sandbox default. (wire: memoryLimitMib)
pool_sizeintegerCommand pool size for executable_pool UDFs. (wire: poolSize)
return_typestringClickHouse data type of the returned value. (wire: returnType)
runtimestringRuntime used to execute the UDF command. (python3.11, native)
sandbox_typestringSandbox isolation level. (basic, netenable) (wire: sandboxType)
sandbox_versionstringSandbox runtime version. (v1, v2, v3) (wire: sandboxVersion)
send_chunk_headerbooleanWhether ClickHouse sends a row-count chunk header. (wire: sendChunkHeader)
statusstringBuild state of this UDF version. (building, error, ready)
typestringExecutable UDF type. (executable, executable_pool)
updated_atstring (date-time)Last-update timestamp. (wire: updatedAt)
versionintegerVersion number of the UDF.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectfunction_name, organization_idcursor, limitDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Returns all versions of a UDF.
createinsertfunction_name, organization_id, upload_id, runtime, arguments, return_type, typeDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Consumes a source archive, assigns a version, and starts the UDF build. Optional configuration fields omitted from the request use the defaults documented in the request schema; values are not inherited from the previous version. Retry by requesting a new upload URL and re-uploading.
deletedeletefunction_name, version, organization_idDisclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Deletes a UDF version. The UDF must not be attached to any services.

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)
versionintegerVersion number of the UDF.
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 all versions of a UDF.

SELECT
function_name,
return_name,
arguments,
command_read_timeout,
command_write_timeout,
created_at,
error,
format,
max_command_execution_time,
memory_limit_mib,
pool_size,
return_type,
runtime,
sandbox_type,
sandbox_version,
send_chunk_header,
status,
type,
updated_at,
version
FROM clickhouse.udfs.versions
WHERE function_name = '{{ function_name }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
AND cursor = '{{ cursor }}'
AND limit = '{{ limit }}'
;

INSERT examples

Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Consumes a source archive, assigns a version, and starts the UDF build. Optional configuration fields omitted from the request use the defaults documented in the request schema; values are not inherited from the previous version. Retry by requesting a new upload URL and re-uploading.

INSERT INTO clickhouse.udfs.versions (
upload_id,
runtime,
arguments,
return_type,
return_name,
command_read_timeout,
command_write_timeout,
memory_limit_mib,
send_chunk_header,
format,
sandbox_type,
sandbox_version,
type,
pool_size,
max_command_execution_time,
function_name,
organization_id
)
SELECT
'{{ upload_id }}' /* required */,
'{{ runtime }}' /* required */,
'{{ arguments }}' /* required */,
'{{ return_type }}' /* required */,
'{{ return_name }}',
{{ command_read_timeout }},
{{ command_write_timeout }},
'{{ memory_limit_mib }}',
{{ send_chunk_header }},
'{{ format }}',
'{{ sandbox_type }}',
'{{ sandbox_version }}',
'{{ type }}' /* required */,
'{{ pool_size }}',
'{{ max_command_execution_time }}',
'{{ function_name }}',
'{{ organization_id }}'
RETURNING
request_id,
result,
status
;

DELETE examples

Disclaimer: This beta endpoint is evolving; the API contract may change. <br /><br /> Deletes a UDF version. The UDF must not be attached to any services.

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