|
| 1 | +--- |
| 2 | +title: "Accounts" |
| 3 | +linkTitle: "Accounts" |
| 4 | +weight: 17 |
| 5 | +description: Get started with Accounts in LocalStack for Snowflake |
| 6 | +--- |
| 7 | + |
| 8 | +## Introduction |
| 9 | + |
| 10 | +An account is a unique identifier for a Snowflake instance within an organization. It acts as a container |
| 11 | +for resources and operations related to data storage, processing, and management. |
| 12 | + |
| 13 | +The Snowflake emulator lets you connect to and manage resources in different accounts. |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +This guide explains how to start and connect to the Snowflake emulator using specific accounts. |
| 18 | + |
| 19 | +You can specify any account name when connecting to the Snowflake emulator. If you don't, all resources |
| 20 | +will be managed by the default `test` account. |
| 21 | + |
| 22 | +Depending on the Snowflake Driver you choose, you can pass `account` accordingly. |
| 23 | + |
| 24 | +### Connect using Snowflake Connection Object |
| 25 | + |
| 26 | +If the Snowflake driver provides a connection object, you can pass the `account` parameter in the connection object. |
| 27 | + |
| 28 | +Example using the Snowflake Connector for Python: |
| 29 | + |
| 30 | +```python |
| 31 | +sf_conn_obj = sf.connect( |
| 32 | + account="your_account", |
| 33 | + # other parameters |
| 34 | +) |
| 35 | +``` |
| 36 | + |
| 37 | +Example using the NodeJS Driver for Snowflake: |
| 38 | + |
| 39 | +```javascript |
| 40 | +var connection = snowflake.createConnection({ |
| 41 | + account: "your_account", |
| 42 | + // other parameters |
| 43 | +}); |
| 44 | +``` |
| 45 | + |
| 46 | +### Connect using Connection String |
| 47 | + |
| 48 | +You can also specify the account for Snowflake drivers that let you connect with a connection string. |
| 49 | + |
| 50 | +Example establishing a JDBC connection: |
| 51 | + |
| 52 | +``` |
| 53 | +jdbc:snowflake://snowflake.localhost.localstack.cloud:4566/?account=your_account |
| 54 | +``` |
| 55 | + |
| 56 | +### Check Current Account |
| 57 | + |
| 58 | +Once successfully connected, you can verify which account you are connected to by executing the following SQL command: |
| 59 | + |
| 60 | +```sql |
| 61 | +SELECT CURRENT_ACCOUNT_NAME(); |
| 62 | +``` |
| 63 | + |
| 64 | +The query statement will return the name of the account you are currently connected to. Output should look like: |
| 65 | + |
| 66 | +```sql |
| 67 | ++------------------------------------------+ |
| 68 | +| CURRENT_ACCOUNT_NAME() | |
| 69 | +|------------------------------------------| |
| 70 | +| YOUR_ACCOUNT | |
| 71 | ++------------------------------------------+ |
| 72 | +``` |
0 commit comments