Skip to main content

databases

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

Overview

Namedatabases
TypeResource
Idazure.data_explorer.databases

Fields

The following fields are returned by SELECT queries:

Successfully retrieved the specified database.

NameDatatypeDescription
kindstringKind of the database
locationstringResource location.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresourceGroupName, clusterName, databaseName, subscriptionIdReturns a database.
list_by_clusterselectresourceGroupName, clusterName, subscriptionId$top, $skiptokenReturns the list of databases of the given Kusto cluster.
create_or_updateinsertresourceGroupName, clusterName, databaseName, subscriptionId, data__kindcallerRoleCreates or updates a database.
updateupdateresourceGroupName, clusterName, databaseName, subscriptionId, data__kindcallerRoleUpdates a database.
deletedeleteresourceGroupName, clusterName, databaseName, subscriptionIdDeletes the database with the given name.
check_name_availabilityexecresourceGroupName, clusterName, subscriptionId, name, typeChecks that the databases resource name is valid and is not already in use.
invite_followerexecsubscriptionId, resourceGroupName, clusterName, databaseName, inviteeEmailGenerates an invitation token that allows attaching a follower database to this database.
add_principalsexecresourceGroupName, clusterName, databaseName, subscriptionIdAdd Database principals permissions.
remove_principalsexecresourceGroupName, clusterName, databaseName, subscriptionIdRemove Database principals permissions.

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
clusterNamestringThe name of the Kusto cluster.
databaseNamestringThe name of the database in the Kusto cluster.
resourceGroupNamestringThe name of the resource group. The name is case insensitive.
subscriptionIdstringThe ID of the target subscription.
$skiptokenstringSkiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls.
$topinteger (int32)limit the number of results
callerRolestringBy default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude the caller from Admins list.

SELECT examples

Returns a database.

SELECT
kind,
location
FROM azure.data_explorer.databases
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND clusterName = '{{ clusterName }}' -- required
AND databaseName = '{{ databaseName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
;

INSERT examples

Creates or updates a database.

INSERT INTO azure.data_explorer.databases (
data__location,
data__kind,
resourceGroupName,
clusterName,
databaseName,
subscriptionId,
callerRole
)
SELECT
'{{ location }}',
'{{ kind }}' /* required */,
'{{ resourceGroupName }}',
'{{ clusterName }}',
'{{ databaseName }}',
'{{ subscriptionId }}',
'{{ callerRole }}'
RETURNING
kind,
location
;

UPDATE examples

Updates a database.

UPDATE azure.data_explorer.databases
SET
data__location = '{{ location }}',
data__kind = '{{ kind }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}' --required
AND clusterName = '{{ clusterName }}' --required
AND databaseName = '{{ databaseName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
AND data__kind = '{{ kind }}' --required
AND callerRole = '{{ callerRole}}'
RETURNING
kind,
location;

DELETE examples

Deletes the database with the given name.

DELETE FROM azure.data_explorer.databases
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND clusterName = '{{ clusterName }}' --required
AND databaseName = '{{ databaseName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
;

Lifecycle Methods

Checks that the databases resource name is valid and is not already in use.

EXEC azure.data_explorer.databases.check_name_availability 
@resourceGroupName='{{ resourceGroupName }}' --required,
@clusterName='{{ clusterName }}' --required,
@subscriptionId='{{ subscriptionId }}' --required
@@json=
'{
"name": "{{ name }}",
"type": "{{ type }}"
}'
;