Skip to main content

sql_user_defined_functions

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

Overview

Namesql_user_defined_functions
TypeResource
Idazure.cosmos_db.sql_user_defined_functions

Fields

NameDatatypeDescription
idtextThe unique resource identifier of the ARM resource.
nametextThe name of the ARM resource.
accountNametextfield from the properties object
containerNametextfield from the properties object
databaseNametextfield from the properties object
identitytextIdentity for the resource.
locationtextThe location of the resource group to which the resource belongs.
resourcetextfield from the properties object
resourceGroupNametextfield from the properties object
subscriptionIdtextfield from the properties object
tagstextTags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
typetextThe type of Azure resource.
userDefinedFunctionNametextfield from the properties object

Methods

NameAccessible byRequired ParamsDescription
getSELECTaccountName, containerName, databaseName, resourceGroupName, subscriptionId, userDefinedFunctionNameGets the SQL userDefinedFunction under an existing Azure Cosmos DB database account.
listSELECTaccountName, containerName, databaseName, resourceGroupName, subscriptionIdLists the SQL userDefinedFunction under an existing Azure Cosmos DB database account.
create_updateINSERTaccountName, containerName, databaseName, resourceGroupName, subscriptionId, userDefinedFunctionName, data__propertiesCreate or update an Azure Cosmos DB SQL userDefinedFunction
deleteDELETEaccountName, containerName, databaseName, resourceGroupName, subscriptionId, userDefinedFunctionNameDeletes an existing Azure Cosmos DB SQL userDefinedFunction.

SELECT examples

Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account.

SELECT
id,
name,
accountName,
containerName,
databaseName,
identity,
location,
resource,
resourceGroupName,
subscriptionId,
tags,
type,
userDefinedFunctionName
FROM azure.cosmos_db.vw_sql_user_defined_functions
WHERE accountName = '{{ accountName }}'
AND containerName = '{{ containerName }}'
AND databaseName = '{{ databaseName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new sql_user_defined_functions resource.

/*+ create */
INSERT INTO azure.cosmos_db.sql_user_defined_functions (
accountName,
containerName,
databaseName,
resourceGroupName,
subscriptionId,
userDefinedFunctionName,
data__properties,
properties,
location,
tags,
identity
)
SELECT
'{{ accountName }}',
'{{ containerName }}',
'{{ databaseName }}',
'{{ resourceGroupName }}',
'{{ subscriptionId }}',
'{{ userDefinedFunctionName }}',
'{{ data__properties }}',
'{{ properties }}',
'{{ location }}',
'{{ tags }}',
'{{ identity }}'
;

DELETE example

Deletes the specified sql_user_defined_functions resource.

/*+ delete */
DELETE FROM azure.cosmos_db.sql_user_defined_functions
WHERE accountName = '{{ accountName }}'
AND containerName = '{{ containerName }}'
AND databaseName = '{{ databaseName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}'
AND userDefinedFunctionName = '{{ userDefinedFunctionName }}';