|
| 1 | +--- |
| 2 | +title: accounts |
| 3 | +hide_title: false |
| 4 | +hide_table_of_contents: false |
| 5 | +keywords: |
| 6 | + - accounts |
| 7 | + - account |
| 8 | + - snowflake |
| 9 | + - infrastructure-as-code |
| 10 | + - configuration-as-data |
| 11 | + - cloud inventory |
| 12 | +description: Query, deploy and manage snowflake resources using SQL |
| 13 | +custom_edit_url: null |
| 14 | +image: /img/providers/snowflake/stackql-snowflake-provider-featured-image.png |
| 15 | +--- |
| 16 | + |
| 17 | +import CopyableCode from '@site/src/components/CopyableCode/CopyableCode'; |
| 18 | +import Tabs from '@theme/Tabs'; |
| 19 | +import TabItem from '@theme/TabItem'; |
| 20 | + |
| 21 | +Creates, updates, deletes, gets or lists a <code>accounts</code> resource. |
| 22 | + |
| 23 | +## Overview |
| 24 | +<table><tbody> |
| 25 | +<tr><td><b>Name</b></td><td><code>accounts</code></td></tr> |
| 26 | +<tr><td><b>Type</b></td><td>Resource</td></tr> |
| 27 | +<tr><td><b>Id</b></td><td><CopyableCode code="snowflake.account.accounts" /></td></tr> |
| 28 | +</tbody></table> |
| 29 | + |
| 30 | +## Fields |
| 31 | +| Name | Datatype | Description | |
| 32 | +|:-----|:---------|:------------| |
| 33 | +| <CopyableCode code="name" /> | `string` | A 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. | |
| 34 | +| <CopyableCode code="account_locator" /> | `string` | System-assigned identifier of the acccount. | |
| 35 | +| <CopyableCode code="account_locator_url" /> | `string` | Legacy Snowflake account URL syntax that includes the region_name and account_locator. | |
| 36 | +| <CopyableCode code="account_old_url_last_used" /> | `string` | If the original account URL was saved when the account was renamed, indicates the last time the account was accessed using the original URL. | |
| 37 | +| <CopyableCode code="account_old_url_saved_on" /> | `string` | If the original account URL was saved when the account was renamed, provides the date and time when the original account URL was saved. | |
| 38 | +| <CopyableCode code="account_url" /> | `string` | Preferred Snowflake account URL that includes the values of organization_name and account_name. | |
| 39 | +| <CopyableCode code="admin_name" /> | `string` | Name of the account administrator. | |
| 40 | +| <CopyableCode code="admin_password" /> | `string` | Password for the account administrator. | |
| 41 | +| <CopyableCode code="admin_rsa_public_key" /> | `string` | RSA public key for the account administrator. | |
| 42 | +| <CopyableCode code="admin_user_type" /> | `string` | User type of the account administrator. | |
| 43 | +| <CopyableCode code="comment" /> | `string` | Optional comment in which to store information related to the account. | |
| 44 | +| <CopyableCode code="consumption_billing_entity_name" /> | `string` | Name of the consumption billing entity. | |
| 45 | +| <CopyableCode code="created_on" /> | `string` | Date and time the account was created. | |
| 46 | +| <CopyableCode code="dropped_on" /> | `string` | Date and time the account was dropped. | |
| 47 | +| <CopyableCode code="edition" /> | `string` | Snowflake Edition of the account. | |
| 48 | +| <CopyableCode code="email" /> | `string` | Email address of the account administrator. | |
| 49 | +| <CopyableCode code="first_name" /> | `string` | First name of the account administrator. | |
| 50 | +| <CopyableCode code="is_events_account" /> | `boolean` | Indicates whether an account is an events account. For more information, see Set up logging and event sharing for an application. | |
| 51 | +| <CopyableCode code="is_org_admin" /> | `boolean` | Indicates whether the ORGADMIN role is enabled in an account. If TRUE, the role is enabled. | |
| 52 | +| <CopyableCode code="last_name" /> | `string` | Last name of the account administrator. | |
| 53 | +| <CopyableCode code="managed_accounts" /> | `integer` | Indicates how many managed accounts have been created by the account. | |
| 54 | +| <CopyableCode code="marketplace_consumer_billing_entity_name" /> | `string` | Name of the marketplace consumer billing entity. | |
| 55 | +| <CopyableCode code="marketplace_provider_billing_entity_name" /> | `string` | Name of the marketplace provider billing entity. | |
| 56 | +| <CopyableCode code="moved_on" /> | `string` | Date and time when the account was moved to a different organization. | |
| 57 | +| <CopyableCode code="moved_to_organization" /> | `string` | If the account was moved to a different organization, provides the name of that organization. | |
| 58 | +| <CopyableCode code="must_change_password" /> | `boolean` | Indicates whether the account administrator must change the password at the next login. | |
| 59 | +| <CopyableCode code="old_account_url" /> | `string` | If 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 | |
| 60 | +| <CopyableCode code="organization_URL_expiration_on" /> | `string` | 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. | |
| 61 | +| <CopyableCode code="organization_name" /> | `string` | Name of the organization. | |
| 62 | +| <CopyableCode code="organization_old_url" /> | `string` | 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 original account URL. If the original account URL was dropped, the value is NULL even if the organization changed. | |
| 63 | +| <CopyableCode code="organization_old_url_last_used" /> | `string` | 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. | |
| 64 | +| <CopyableCode code="organization_old_url_saved_on" /> | `string` | 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. | |
| 65 | +| <CopyableCode code="polaris" /> | `boolean` | Indicates whether the account is a Polaris account. | |
| 66 | +| <CopyableCode code="region" /> | `string` | Snowflake 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). | |
| 67 | +| <CopyableCode code="region_group" /> | `string` | Region group where the account is located. Note - This column is only displayed for organizations that span multiple region groups. | |
| 68 | +| <CopyableCode code="restored_on" /> | `string` | Date and time when the account was last restored. | |
| 69 | +| <CopyableCode code="retention_time" /> | `integer` | Number of days that historical data is retained for Time Travel. | |
| 70 | +| <CopyableCode code="scheduled_deletion_time" /> | `string` | Date and time when the account is scheduled to be permanently deleted. Accounts are deleted within one hour after the scheduled time. | |
| 71 | + |
| 72 | +## Methods |
| 73 | +| Name | Accessible by | Required Params | Description | |
| 74 | +|:-----|:--------------|:----------------|:------------| |
| 75 | +| <CopyableCode code="list_accounts" /> | `SELECT` | <CopyableCode code="endpoint" /> | Lists the accessible accounts. | |
| 76 | +| <CopyableCode code="create_account" /> | `INSERT` | <CopyableCode code="data__admin_name, data__edition, data__email, data__name, endpoint" /> | Creates a account. You must provide the full account definition when creating a account. | |
| 77 | +| <CopyableCode code="delete_account" /> | `DELETE` | <CopyableCode code="gracePeriodInDays, name, endpoint" /> | 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. | |
| 78 | +| <CopyableCode code="undrop_account" /> | `EXEC` | <CopyableCode code="name, endpoint" /> | Restores a dropped account that has not yet been permanently deleted (a dropped account that is within its grace period). | |
| 79 | + |
| 80 | +## `SELECT` examples |
| 81 | + |
| 82 | +Lists the accessible accounts. |
| 83 | + |
| 84 | + |
| 85 | +```sql |
| 86 | +SELECT |
| 87 | +name, |
| 88 | +account_locator, |
| 89 | +account_locator_url, |
| 90 | +account_old_url_last_used, |
| 91 | +account_old_url_saved_on, |
| 92 | +account_url, |
| 93 | +admin_name, |
| 94 | +admin_password, |
| 95 | +admin_rsa_public_key, |
| 96 | +admin_user_type, |
| 97 | +comment, |
| 98 | +consumption_billing_entity_name, |
| 99 | +created_on, |
| 100 | +dropped_on, |
| 101 | +edition, |
| 102 | +email, |
| 103 | +first_name, |
| 104 | +is_events_account, |
| 105 | +is_org_admin, |
| 106 | +last_name, |
| 107 | +managed_accounts, |
| 108 | +marketplace_consumer_billing_entity_name, |
| 109 | +marketplace_provider_billing_entity_name, |
| 110 | +moved_on, |
| 111 | +moved_to_organization, |
| 112 | +must_change_password, |
| 113 | +old_account_url, |
| 114 | +organization_URL_expiration_on, |
| 115 | +organization_name, |
| 116 | +organization_old_url, |
| 117 | +organization_old_url_last_used, |
| 118 | +organization_old_url_saved_on, |
| 119 | +polaris, |
| 120 | +region, |
| 121 | +region_group, |
| 122 | +restored_on, |
| 123 | +retention_time, |
| 124 | +scheduled_deletion_time |
| 125 | +FROM snowflake.account.accounts |
| 126 | +WHERE endpoint = '{{ endpoint }}'; |
| 127 | +``` |
| 128 | +## `INSERT` example |
| 129 | + |
| 130 | +Use the following StackQL query and manifest file to create a new <code>accounts</code> resource. |
| 131 | + |
| 132 | +<Tabs defaultValue="all" values={[ { label: 'All Properties', value: 'all' }, { label: 'Manifest', value: 'manifest' } ]}> |
| 133 | +<TabItem value="all"> |
| 134 | + |
| 135 | +```sql |
| 136 | +/*+ create */ |
| 137 | +INSERT INTO snowflake.account.accounts ( |
| 138 | +data__name, |
| 139 | +data__admin_name, |
| 140 | +data__email, |
| 141 | +endpoint, |
| 142 | +data__edition |
| 143 | +) |
| 144 | +SELECT |
| 145 | +'{ email }', |
| 146 | +'{ name }', |
| 147 | +'{ admin_name }', |
| 148 | +'{ endpoint }', |
| 149 | +'{ edition }' |
| 150 | +; |
| 151 | +``` |
| 152 | +</TabItem> |
| 153 | +<TabItem value="manifest"> |
| 154 | + |
| 155 | +```yaml |
| 156 | +- name: accounts |
| 157 | + props: |
| 158 | + - name: data__admin_name |
| 159 | + value: string |
| 160 | + - name: data__edition |
| 161 | + value: string |
| 162 | + - name: data__email |
| 163 | + value: string |
| 164 | + - name: data__name |
| 165 | + value: string |
| 166 | + - name: endpoint |
| 167 | + value: string |
| 168 | + |
| 169 | +``` |
| 170 | +</TabItem> |
| 171 | +</Tabs> |
| 172 | + |
| 173 | +## `DELETE` example |
| 174 | + |
| 175 | +Deletes the specified <code>accounts</code> resource. |
| 176 | + |
| 177 | +```sql |
| 178 | +/*+ delete */ |
| 179 | +DELETE FROM snowflake.account.accounts |
| 180 | +WHERE gracePeriodInDays = '{ gracePeriodInDays }' AND name = '{ name }' AND endpoint = '{ endpoint }'; |
| 181 | +``` |
0 commit comments