Skip to content

Commit e5de521

Browse files
docs: move snowflake docs into new IA structure (#2)
* moving snowflake docs to new IA structure in new docs repo * added snowflake services to their own folder
1 parent 2a822df commit e5de521

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3858
-8
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Accounts
3+
description: Get started with Accounts in LocalStack for Snowflake
4+
---
5+
6+
## Introduction
7+
8+
An account is a unique identifier for a Snowflake instance within an organization. It acts as a container
9+
for resources and operations related to data storage, processing, and management.
10+
11+
The Snowflake emulator lets you connect to and manage resources in different accounts.
12+
13+
## Getting Started
14+
15+
This guide explains how to start and connect to the Snowflake emulator using specific accounts.
16+
17+
You can specify any account name when connecting to the Snowflake emulator. If you don't, all resources
18+
will be managed by the default `test` account.
19+
20+
Depending on the Snowflake Driver you choose, you can pass `account` accordingly.
21+
22+
### Connect using Snowflake Connection Object
23+
24+
If the Snowflake driver provides a connection object, you can pass the `account` parameter in the connection object.
25+
26+
Example using the Snowflake Connector for Python:
27+
28+
```python
29+
sf_conn_obj = sf.connect(
30+
account="your_account",
31+
# other parameters
32+
)
33+
```
34+
35+
Example using the NodeJS Driver for Snowflake:
36+
37+
```javascript
38+
var connection = snowflake.createConnection({
39+
account: "your_account",
40+
// other parameters
41+
});
42+
```
43+
44+
### Connect using Connection String
45+
46+
You can also specify the account for Snowflake drivers that let you connect with a connection string.
47+
48+
Example establishing a JDBC connection:
49+
50+
```
51+
jdbc:snowflake://snowflake.localhost.localstack.cloud:4566/?account=your_account
52+
```
53+
54+
### Check Current Account
55+
56+
Once successfully connected, you can verify which account you are connected to by executing the following SQL command:
57+
58+
```sql
59+
SELECT CURRENT_ACCOUNT_NAME();
60+
```
61+
62+
The query statement will return the name of the account you are currently connected to. Output should look like:
63+
64+
```sql
65+
+------------------------------------------+
66+
| CURRENT_ACCOUNT_NAME() |
67+
|------------------------------------------|
68+
| YOUR_ACCOUNT |
69+
+------------------------------------------+
70+
```
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: Clones
3+
description: Get started with Clones in LocalStack for Snowflake
4+
---
5+
6+
{{< preview-notice >}}
7+
8+
## Introduction
9+
10+
Cloning in Snowflake allows you to create a quick, zero-copy duplicate of an existing database, schema, or table. This feature enables users to replicate data structures and content for testing or development without duplicating the underlying storage.
11+
12+
The Snowflake emulator supports database cloning, enabling you to create quick duplicates of databases, schemas, or tables. Currently, [`CREATE ... CLONE`](https://docs.snowflake.com/en/sql-reference/sql/create-clone) is supported by LocalStack.
13+
14+
## Getting started
15+
16+
This guide assumes basic knowledge of SQL and Snowflake. Start your Snowflake emulator and connect to it using an SQL client to execute the queries below.
17+
18+
The following sections guide you through creating a database, inserting data into a table, and then cloning the database to verify data integrity.
19+
20+
### Create a Database
21+
22+
The following SQL snippet demonstrates how to create a database named `test_db`.
23+
24+
```sql
25+
CREATE DATABASE test_db;`
26+
```
27+
28+
The expected output is:
29+
30+
```sql
31+
+--------------------------------------------+
32+
| status |
33+
|--------------------------------------------|
34+
| Database TEST_DB successfully created. |
35+
+--------------------------------------------+
36+
0 Row(s) produced. Time Elapsed: 0.123s
37+
```
38+
39+
### Create a Table
40+
41+
Once the database is created, you can create a table within it. The following SQL statement demonstrates how to create a table named `test_table` with columns for `id` and `name`.
42+
43+
```sql
44+
CREATE TABLE test_table (id INT, name TEXT);`
45+
```
46+
47+
The expected output is:
48+
49+
```sql
50+
+----------------------------------------+
51+
| status |
52+
|----------------------------------------|
53+
| Table TEST_TABLE successfully created. |
54+
+----------------------------------------+
55+
0 Row(s) produced. Time Elapsed: 0.067s
56+
```
57+
58+
### Insert Data
59+
60+
To insert data into the `test_table`, use the `INSERT INTO` statement. This example inserts a single row with the values `(1, 'test')`.
61+
62+
```sql
63+
INSERT INTO test_table VALUES (1, 'test');
64+
```
65+
66+
The expected output is:
67+
68+
```sql
69+
+----------------------------------------+
70+
| status |
71+
|----------------------------------------|
72+
| 1 Row(s) inserted. |
73+
+----------------------------------------+
74+
1 Row(s) produced. Time Elapsed: 0.024s
75+
```
76+
77+
### Create a Clone
78+
79+
With data now in `test_table`, you can create a clone of the entire `test_db` database. This will produce a new database, `test_db_clone`, containing all objects and data from the original `test_db`.
80+
81+
```sql
82+
CREATE DATABASE test_db_clone CLONE test_db;
83+
```
84+
85+
The expected output is:
86+
87+
```sql
88+
+--------------------------------------------+
89+
| status |
90+
|--------------------------------------------|
91+
| Database TEST_DB_CLONE successfully created. |
92+
+--------------------------------------------+
93+
0 Row(s) produced. Time Elapsed: 0.101s
94+
```
95+
96+
### Verify Data in Clone
97+
98+
To confirm that the data has been cloned, query the `test_table` in the `test_db_clone` database.
99+
100+
```sql
101+
SELECT * FROM test_db_clone.test_table;
102+
```
103+
104+
The expected output is:
105+
106+
```sql
107+
+----+------+
108+
| id | name |
109+
|----|------|
110+
| 1 | test |
111+
+----+------+
112+
1 Row(s) produced. Time Elapsed: 0.012s
113+
```
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: Configuration
3+
description: Overview of configuration options in LocalStack for Snowflake.
4+
template: doc
5+
nav:
6+
label:
7+
---
8+
9+
10+
{{< preview-notice >}}
11+
12+
LocalStack exposes various configuration options to control its behaviour.
13+
14+
These options can be passed to LocalStack as environment variables like so:
15+
16+
{{< command >}}
17+
$ DEBUG=1 localstack start
18+
{{< / command >}}
19+
20+
## Core
21+
22+
Options that affect the core Snowflake emulator functionality.
23+
24+
| Variable | Example Values | Description |
25+
|----------|----------------------|-------------------------------------------------------------------------------------------------------------|
26+
| `DEBUG` | `0` (default) \| `1` | Flag to increase log level and print more verbose logs (useful for troubleshooting issues) |
27+
| `SF_LOG` | `trace` | Specify the log level. Currently overrides the `DEBUG` configuration. `trace` for detailed request/response |
28+
| `SF_S3_ENDPOINT` | `s3.localhost.localstack.cloud:4566` (default) | Specify the S3 endpoint to use for the Snowflake emulator. |
29+
| `DNS_NAME_PATTERNS_TO_RESOLVE_UPSTREAM` | `*.s3.amazonaws.com` (example) | List of domain names that should NOT be resolved to the LocalStack container, but instead always forwarded to the upstream resolver (S3 for example). this would be required when importing data into a stage from an external S3 bucket on the real AWS cloud. Comma-separated list of Python-flavored regex patterns. |
30+
| `SF_HOSTNAME_REGEX` | `snowflake\..+` (default) | Allows you to customize the hostname used for matching the Snowflake API routes in the HTTP router. If not set, then it matches on any hostnames that contain a `snowflake.*` subdomain (e.g., `snowflake.localhost.localstack.cloud`). |
31+
| `SF_CSV_IMPORT_MAX_ROWS` | `50000` (default) | Maximum number of rows to import from CSV files into tables |
32+
| `SF_DEFAULT_USER` | `test` (default) | Specify the default user to be used by the Snowflake emulator. |
33+
| `SF_DEFAULT_PASSWORD` | `test` (default) | Specify the default password to be used by the Snowflake emulator. |
34+
35+
## CLI
36+
37+
These options are applicable when using the CLI to start LocalStack.
38+
39+
| Variable | Example Values | Description |
40+
| - | - | - |
41+
| `LOCALSTACK_VOLUME_DIR` | `~/.cache/localstack/volume` (on Linux) | The location on the host of the LocalStack volume directory mount. |
42+
| `CONFIG_PROFILE` | | The configuration profile to load. See [Profiles]({{< ref "#profiles" >}}) |
43+
| `CONFIG_DIR` | `~/.localstack` | The path where LocalStack can find configuration profiles and other CLI-specific configuration |
44+
45+
## Docker
46+
47+
Options to configure how LocalStack interacts with Docker.
48+
49+
| Variable | Example Values | Description |
50+
| - | - | - |
51+
| `DOCKER_FLAGS` | | Allows to pass custom flags (e.g., volume mounts) to "docker run" when running LocalStack in Docker. |
52+
| `DOCKER_SOCK` | `/var/run/docker.sock` | Path to local Docker UNIX domain socket |
53+
| `DOCKER_BRIDGE_IP` | `172.17.0.1` | IP of the Docker bridge used to enable access between containers |
54+
| `LEGACY_DOCKER_CLIENT` | `0`\|`1` | Whether LocalStack should use the command-line Docker client and subprocess execution to run Docker commands, rather than the Docker SDK. |
55+
| `DOCKER_CMD` | `docker` (default), `sudo docker`| Shell command used to run Docker containers (only used in combination with `LEGACY_DOCKER_CLIENT`) |
56+
| `FORCE_NONINTERACTIVE` | | When running with Docker, disables the `--interactive` and `--tty` flags. Useful when running headless. |
57+
58+
## Proxy Configuration
59+
60+
Options to configure Snowflake proxy settings for LocalStack.
61+
62+
| Variable | Example Values | Description |
63+
| - | - | - |
64+
| `SF_PROXY_HOST` | `proxy.example.com` | Hostname or IP address of the proxy server to be used for connecting to Snowflake. |
65+
| `SF_PROXY_USER` | `proxy_user` | Username for authentication with the proxy server. |
66+
| `SF_PROXY_PASSWORD` | `password123` | Password associated with the proxy user account. |
67+
68+
## Profiles
69+
70+
LocalStack supports configuration profiles which are stored in the `~/.localstack` config directory.
71+
A configuration profile is a set of environment variables stored in a `*.env` file in the LocalStack config directory.
72+
73+
Here is an example of what configuration profiles might look like:
74+
75+
{{< command >}}
76+
$ tree ~/.localstack
77+
/home/username/.localstack
78+
├── default.env
79+
├── dev.env
80+
└── pro.env
81+
{{< / command >}}
82+
83+
Here is an example of what a specific environment profile looks like
84+
85+
{{< command >}}
86+
$ cat ~/.localstack/pro-debug.env
87+
LOCALSTACK_AUTH_TOKEN=XXXXX
88+
SF_LOG=trace
89+
SF_S3_ENDPOINT=s3.localhost.localstack.cloud:4566
90+
{{< / command >}}
91+
92+
You can load a profile by either setting the environment variable `CONFIG_PROFILE=<profile>` or the `--profile=<profile>` CLI flag when using the CLI.
93+
Let's take an example to load the `dev.env` profile file if it exists:
94+
95+
{{< command >}}
96+
$ IMAGE_NAME=localstack/snowflake localstack --profile=dev start
97+
{{< / command >}}
98+
99+
If no profile is specified, the `default.env` profile will be loaded.
100+
If explicitly specified, any environment variables will overwrite the configurations defined in the profile.
101+
102+
To display the config environment variables, you can use the following command:
103+
104+
{{< command >}}
105+
$ localstack --profile=dev config show
106+
{{< / command >}}
107+
108+
{{< alert title="Note" >}}
109+
The `CONFIG_PROFILE` is a CLI feature and cannot be used directly with a docker-compose setup.
110+
You can look at [alternative means of setting environment variables](https://docs.docker.com/compose/environment-variables/set-environment-variables/) for your Docker Compose setups.
111+
For Docker setups, we recommend passing the environment variables directly to the `docker run` command.
112+
{{< /alert >}}
113+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Ephemeral Instances
3+
description: Get started with Ephemeral Instances in LocalStack for Snowflake
4+
---
5+
6+
{{< preview-notice >}}
7+
8+
## Introduction
9+
10+
Ephemeral Instances allows you to run a LocalStack for Snowflake instance in the cloud. You can interact with these instances by configuring your Snowflake host with the endpoint URL of the ephemeral instance.
11+
12+
{{< alert title="Note" >}}
13+
Ephemeral Instances is offered as a **preview** feature and under active development.
14+
{{< /alert >}}
15+
16+
## Getting started
17+
18+
Navigate to the [LocalStack Ephemeral Instance Management](https://app.localstack.cloud/instances/ephemeral) page. In the form, enter the name of the new Ephemeral Instance, choose **LocalStack Snowflake (preview)**, select the lifetime of the instance by dragging the slider, and click on **Launch**.
19+
20+
<img src="ephemeral-instance-creation.png" alt="Creating an Ephemeral Instance" title="Creating an Ephemeral Instance" width="800" />
21+
22+
After the ephemeral instance is created, you can run the following command to verify the status of the instance:
23+
24+
{{< command >}}
25+
$ export SNOWFLAKE_HOST=<ephemeral-instance-endpoint>
26+
$ curl -d '{}' $SNOWFLAKE_HOST/session
27+
{{< /command >}}
28+
29+
You can access the Ephemeral Instance via the SnowSQL or any alternative SQL client by configuring the Snowflake host with the endpoint URL of the Ephemeral Instance.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Capabilities
3+
description: Capabilities
4+
template: doc
5+
nav:
6+
label:
7+
---
8+
9+
# Capabilities

0 commit comments

Comments
 (0)