Skip to main content

accounts

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

Overview

Nameaccounts
TypeResource
Idsnowflake.account.accounts

Fields

The following fields are returned by SELECT queries:

Snowflake account object.

NameDatatypeDescription
namestringA Snowflake object identifier. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. (pattern: ^"([^"]|"")+"|[a-zA-Z_][a-zA-Z0-9_$]*$, example: TEST_NAME)
admin_namestringName of the account administrator.
consumption_billing_entity_namestringName of the consumption billing entity.
first_namestringFirst name of the account administrator.
last_namestringLast name of the account administrator.
marketplace_consumer_billing_entity_namestringName of the marketplace consumer billing entity.
marketplace_provider_billing_entity_namestringName of the marketplace provider billing entity.
organization_namestringName of the organization.
account_locatorstringSystem-assigned identifier of the acccount.
account_locator_urlstringLegacy Snowflake account URL syntax that includes the region_name and account_locator.
account_old_url_last_usedstring (date-time)If the original account URL was saved when the account was renamed, indicates the last time the account was accessed using the original URL.
account_old_url_saved_onstring (date-time)If the original account URL was saved when the account was renamed, provides the date and time when the original account URL was saved.
account_urlstringPreferred Snowflake account URL that includes the values of organization_name and account_name.
admin_passwordstring (password)Password for the account administrator.
admin_rsa_public_keystring (password)RSA public key for the account administrator.
admin_user_typestringUser type of the account administrator.
commentstringOptional comment in which to store information related to the account.
created_onstring (date-time)Date and time the account was created.
dropped_onstring (date-time)Date and time the account was dropped.
editionstringSnowflake Edition of the account.
emailstringEmail address of the account administrator.
is_events_accountbooleanIndicates whether an account is an events account. For more information, see Set up logging and event sharing for an application.
is_org_adminbooleanIndicates whether the ORGADMIN role is enabled in an account. If TRUE, the role is enabled.
managed_accountsinteger (int64)Indicates how many managed accounts have been created by the account.
moved_onstring (date-time)Date and time when the account was moved to a different organization.
moved_to_organizationstringIf the account was moved to a different organization, provides the name of that organization.
must_change_passwordbooleanIndicates whether the account administrator must change the password at the next login.
old_account_urlstringIf the original account URL was saved when the account was renamed, provides the original URL. If the original account URL was dropped, the value is NULL even if the account was renamed
organization_URL_expiration_onstring (date-time)If the account’s organization was changed in a way that created a new account URL and the original account URL was saved, provides the date and time when the original account URL will be dropped. Dropped URLs cannot be used to access the account.
organization_old_urlstringIf the account’s organization was changed in a way that created a new account URL and the original account URL was saved, provides the original account URL. If the original account URL was dropped, the value is NULL even if the organization changed.
organization_old_url_last_usedstring (date-time)If the account’s organization was changed in a way that created a new account URL and the original account URL was saved, indicates the last time the account was accessed using the original account URL.
organization_old_url_saved_onstring (date-time)If the account’s organization was changed in a way that created a new account URL and the original account URL was saved, provides the date and time when the original account URL was saved.
polarisbooleanIndicates whether the account is a Polaris account.
regionstringSnowflake Region where the account is located. A Snowflake Region is a distinct location within a cloud platform region that is isolated from other Snowflake Regions. A Snowflake Region can be either multi-tenant or single-tenant (for a Virtual Private Snowflake account).
region_groupstringRegion group where the account is located. Note - This column is only displayed for organizations that span multiple region groups.
restored_onstring (date-time)Date and time when the account was last restored.
retention_timeintegerNumber of days that historical data is retained for Time Travel.
scheduled_deletion_timestring (date-time)Date and time when the account is scheduled to be permanently deleted. Accounts are deleted within one hour after the scheduled time.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_accountsselectendpointlike, showLimit, historyLists the accessible accounts.
create_accountinsertendpointCreates a account. You must provide the full account definition when creating a account.
delete_accountdeletename, gracePeriodInDays, endpointifExistsDeletes the specified account. If you enable the ifExists parameter, the operation succeeds even if the account does not exist. Otherwise, a 404 failure is returned if the account does not exist. if the drop is unsuccessful.
undrop_accountexecname, endpointRestores a dropped account that has not yet been permanently deleted (a dropped account that is within its grace period).

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
endpointstringOrganization and Account Name (default: orgid-acctid)
gracePeriodInDaysintegerSpecifies the number of days during which the account can be restored (“undropped”). The minimum is 3 days and the maximum is 90 days.
namestringIdentifier (i.e. name) for the resource.
historybooleanOptionally includes dropped accounts that have not yet been purged.
ifExistsbooleanQuery parameter that specifies how to handle the request for a resource that does not exist: - true: The endpoint does not throw an error if the resource does not exist. It returns a 200 success response, but does not take any action on the resource. - false: The endpoint throws an error if the resource doesn't exist.
likestringQuery parameter to filter the command output by resource name. Uses case-insensitive pattern matching, with support for SQL wildcard characters.
showLimitintegerQuery parameter to limit the maximum number of rows returned by a command.

SELECT examples

Lists the accessible accounts.

SELECT
name,
admin_name,
consumption_billing_entity_name,
first_name,
last_name,
marketplace_consumer_billing_entity_name,
marketplace_provider_billing_entity_name,
organization_name,
account_locator,
account_locator_url,
account_old_url_last_used,
account_old_url_saved_on,
account_url,
admin_password,
admin_rsa_public_key,
admin_user_type,
comment,
created_on,
dropped_on,
edition,
email,
is_events_account,
is_org_admin,
managed_accounts,
moved_on,
moved_to_organization,
must_change_password,
old_account_url,
organization_URL_expiration_on,
organization_old_url,
organization_old_url_last_used,
organization_old_url_saved_on,
polaris,
region,
region_group,
restored_on,
retention_time,
scheduled_deletion_time
FROM snowflake.account.accounts
WHERE endpoint = '{{ endpoint }}' -- required
AND like = '{{ like }}'
AND showLimit = '{{ showLimit }}'
AND history = '{{ history }}';

INSERT examples

Creates a account. You must provide the full account definition when creating a account.

INSERT INTO snowflake.account.accounts (
data__name,
data__region_group,
data__region,
data__edition,
data__comment,
data__admin_name,
data__admin_password,
data__admin_rsa_public_key,
data__admin_user_type,
data__first_name,
data__last_name,
data__email,
data__must_change_password,
data__polaris,
endpoint
)
SELECT
'{{ name }}' --required,
'{{ region_group }}',
'{{ region }}',
'{{ edition }}' --required,
'{{ comment }}',
'{{ admin_name }}' --required,
'{{ admin_password }}',
'{{ admin_rsa_public_key }}',
'{{ admin_user_type }}',
'{{ first_name }}',
'{{ last_name }}',
'{{ email }}' --required,
{{ must_change_password }},
{{ polaris }},
'{{ endpoint }}'
;

DELETE examples

Deletes the specified account. If you enable the ifExists parameter, the operation succeeds even if the account does not exist. Otherwise, a 404 failure is returned if the account does not exist. if the drop is unsuccessful.

DELETE FROM snowflake.account.accounts
WHERE name = '{{ name }}' --required
AND gracePeriodInDays = '{{ gracePeriodInDays }}' --required
AND endpoint = '{{ endpoint }}' --required
AND ifExists = '{{ ifExists }}';

Lifecycle Methods

Restores a dropped account that has not yet been permanently deleted (a dropped account that is within its grace period).

EXEC snowflake.account.accounts.undrop_account 
@name='{{ name }}' --required,
@endpoint='{{ endpoint }}' --required;