Skip to main content

databases

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

Overview

Namedatabases
TypeResource
Idazure.postgresql.databases

Fields

NameDatatypeDescription
charsettextfield from the properties object
collationtextfield from the properties object
databaseNametextfield from the properties object
resourceGroupNametextfield from the properties object
serverNametextfield from the properties object
subscriptionIdtextfield from the properties object

Methods

NameAccessible byRequired ParamsDescription
getSELECTdatabaseName, resourceGroupName, serverName, subscriptionIdGets information about a database.
list_by_serverSELECTresourceGroupName, serverName, subscriptionIdList all the databases in a given server.
createINSERTdatabaseName, resourceGroupName, serverName, subscriptionIdCreates a new database or updates an existing database.
deleteDELETEdatabaseName, resourceGroupName, serverName, subscriptionIdDeletes a database.

SELECT examples

List all the databases in a given server.

SELECT
charset,
collation,
databaseName,
resourceGroupName,
serverName,
subscriptionId
FROM azure.postgresql.vw_databases
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND serverName = '{{ serverName }}'
AND subscriptionId = '{{ subscriptionId }}';

INSERT example

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

/*+ create */
INSERT INTO azure.postgresql.databases (
databaseName,
resourceGroupName,
serverName,
subscriptionId,
properties
)
SELECT
'{{ databaseName }}',
'{{ resourceGroupName }}',
'{{ serverName }}',
'{{ subscriptionId }}',
'{{ properties }}'
;

DELETE example

Deletes the specified databases resource.

/*+ delete */
DELETE FROM azure.postgresql.databases
WHERE databaseName = '{{ databaseName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND serverName = '{{ serverName }}'
AND subscriptionId = '{{ subscriptionId }}';