Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export default defineConfig({
collapsed: true,
items: [
{
label: 'Welcome',
label: 'Introduction',
slug: 'snowflake',
},
{
Expand Down Expand Up @@ -324,10 +324,6 @@ export default defineConfig({
label: 'SQL Functions',
slug: 'snowflake/sql-functions',
},
{
label: 'Feature Coverage',
slug: 'snowflake/coverage-features',
},
{
label: 'Changelog',
slug: 'snowflake/changelog',
Expand Down
Binary file added public/images/snowflake/credit_df_cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/snowflake/credit_df_hist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/snowflake/proxy-web-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/snowflake/request-logs-web-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 16 additions & 20 deletions src/content/docs/snowflake/capabilities/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ nav:
label:
---




LocalStack exposes various configuration options to control its behaviour.

These options can be passed to LocalStack as environment variables like so:

{{< command >}}
$ DEBUG=1 localstack start
{{< / command >}}
```bash
DEBUG=1 localstack start
```

## Core

Expand All @@ -39,7 +36,7 @@ These options are applicable when using the CLI to start LocalStack.
| Variable | Example Values | Description |
| - | - | - |
| `LOCALSTACK_VOLUME_DIR` | `~/.cache/localstack/volume` (on Linux) | The location on the host of the LocalStack volume directory mount. |
| `CONFIG_PROFILE` | | The configuration profile to load. See [Profiles]({{< ref "#profiles" >}}) |
| `CONFIG_PROFILE` | | The configuration profile to load. See [Profiles](#profiles) |
| `CONFIG_DIR` | `~/.localstack` | The path where LocalStack can find configuration profiles and other CLI-specific configuration |

## Docker
Expand Down Expand Up @@ -72,42 +69,41 @@ A configuration profile is a set of environment variables stored in a `*.env` fi

Here is an example of what configuration profiles might look like:

{{< command >}}
```bash
$ tree ~/.localstack
/home/username/.localstack
├── default.env
├── dev.env
└── pro.env
{{< / command >}}
```

Here is an example of what a specific environment profile looks like

{{< command >}}
```bash
$ cat ~/.localstack/pro-debug.env
LOCALSTACK_AUTH_TOKEN=XXXXX
SF_LOG=trace
SF_S3_ENDPOINT=s3.localhost.localstack.cloud:4566
{{< / command >}}
```

You can load a profile by either setting the environment variable `CONFIG_PROFILE=<profile>` or the `--profile=<profile>` CLI flag when using the CLI.
Let's take an example to load the `dev.env` profile file if it exists:

{{< command >}}
$ IMAGE_NAME=localstack/snowflake localstack --profile=dev start
{{< / command >}}
```bash
IMAGE_NAME=localstack/snowflake localstack --profile=dev start
```

If no profile is specified, the `default.env` profile will be loaded.
If explicitly specified, any environment variables will overwrite the configurations defined in the profile.

To display the config environment variables, you can use the following command:

{{< command >}}
$ localstack --profile=dev config show
{{< / command >}}
```bash
localstack --profile=dev config show
```

{{< alert title="Note" >}}
:::note
The `CONFIG_PROFILE` is a CLI feature and cannot be used directly with a docker-compose setup.
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.
For Docker setups, we recommend passing the environment variables directly to the `docker run` command.
{{< /alert >}}

:::
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: Initialization Hooks
description: Writing SQL scripts to initialize your Snowflake emulator
---

import { Tabs, TabItem } from '@astrojs/starlight/components';


## Introduction

LocalStack for Snowflake supports automatically executing `*.sf.sql` files via [Init Hooks](https://docs.localstack.cloud/references/init-hooks/) when mounted into the Docker container. A script can be added to one of these stages in the lifecycle:
Expand All @@ -28,8 +28,9 @@ SHOW DATABASES;

Mount the script into `/etc/localstack/init/ready.d/` using Docker Compose or the `localstack` CLI:

{{< tabpane >}}
{{< tab header="docker-compose.yml" lang="yml" >}}
<Tabs>
<TabItem label="docker-compose.yml">
```yaml
version: "3.8"

services:
Expand All @@ -47,13 +48,17 @@ services:
- "/path/to/test.sf.sql:/etc/localstack/init/ready.d/test.sf.sql" # ready hook
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
{{< /tab >}}
{{< tab header="CLI" lang="bash" >}}
```
</TabItem>
<TabItem label="CLI">
```bash
# DOCKER_FLAGS are additional parameters to the `docker run` command of localstack start

DOCKER_FLAGS='-v /path/to/test.sf.sql:/etc/localstack/init/ready.d/test.sf.sql' DEBUG=1 localstack start
{{< /tab >}}
{{< /tabpane >}}
DOCKER_FLAGS='-v /path/to/test.sf.sql:/etc/localstack/init/ready.d/test.sf.sql' \
DEBUG=1 \
localstack start
```
</TabItem>
</Tabs>

Start the Snowflake emulator, and the following logs will appear:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: State Management
description: Get started with State Management in LocalStack for Snowflake
---


import { Tabs, TabItem } from '@astrojs/starlight/components';

## Introduction

Expand All @@ -22,34 +22,43 @@ LocalStack’s Persistence mechanism enables the saving and restoration of the e

To start snapshot-based persistence, launch LocalStack with the configuration option `PERSISTENCE=1`. This setting instructs LocalStack to save all local Snowflake resources and their respective application states into the LocalStack Volume Directory. Upon restarting LocalStack, you'll be able to resume your activities exactly where you left off.

{{< tabpane >}}
{{< tab header="LocalStack CLI" lang="bash" >}}
LOCALSTACK_AUTH_TOKEN=... PERSISTENCE=1 IMAGE_NAME=localstack/snowflake localstack start
{{< /tab >}}
{{< tab header="Docker Compose" lang="yaml" >}}
<Tabs>
<TabItem label="LocalStack CLI">
```bash
LOCALSTACK_AUTH_TOKEN=... \
PERSISTENCE=1 \
IMAGE_NAME=localstack/snowflake \
localstack start
```
</TabItem>
<TabItem label="Docker Compose">
```yaml
...
image: localstack/snowflake
environment:
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
- PERSISTENCE=1
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
{{< /tab >}}
{{< tab header="Docker" lang="bash" >}}
```
</TabItem>
<TabItem label="Docker">
```bash
docker run \
-e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?} \
-e PERSISTENCE=1 \
-v ./volume:/var/lib/localstack \
-p 4566:4566 \
localstack/snowflake
{{< /tab >}}
{{< /tabpane >}}
```
</TabItem>
</Tabs>

{{< alert title="Note">}}
:::note
Snapshots may not be compatible across different versions of LocalStack.
It is possible that snapshots from older versions can be restored, but there are no guarantees as to whether LocalStack will start into a consistent state.
We are actively working on a solution for this problem.
{{< /alert >}}
:::

## Export/Import State

Expand All @@ -59,18 +68,18 @@ The Export/Import State feature enables you to export the state of your LocalSta

To export the state, you can run the following command:

{{< command >}}
$ localstack state export '<file-name>'
{{< /command >}}
```bash
localstack state export '<file-name>'
```

You can use the `<file-name>` argument to specify a file path to export the state to. If you do not specify a file path, the state will be exported to the current working directory into a file named `ls-state-export`.

### Import the State

To import the state, you can run the following command:

{{< command >}}
$ localstack state import '<file-name>'
{{< /command >}}
```bash
localstack state import '<file-name>'
```

The `<file-name>` argument is required and specifies the file path to import the state from. The file should be generated from a previous export.
4 changes: 2 additions & 2 deletions src/content/docs/snowflake/features/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can also specify the account for Snowflake drivers that let you connect with

Example establishing a JDBC connection:

```
```text
jdbc:snowflake://snowflake.localhost.localstack.cloud:4566/?account=your_account
```

Expand All @@ -67,4 +67,4 @@ The query statement will return the name of the account you are currently connec
|------------------------------------------|
| YOUR_ACCOUNT |
+------------------------------------------+
```
```
8 changes: 4 additions & 4 deletions src/content/docs/snowflake/features/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ sf_conn_obj = sf.connect(

The default username and password are set to `test` and can be changed using `SF_DEFAULT_USER` and `SF_DEFAULT_PASSWORD` when starting the Snowflake emulator.

{{< alert title="Note" >}}
:::note
It is not recommended to use your production credentials in the Snowflake emulator.
{{< /alert >}}
:::

## RSA key pair authentication

Expand Down Expand Up @@ -66,6 +66,6 @@ conn = snowflake.connector.connect(
)
```

{{< alert title="Note" >}}
:::note
The Snowflake emulator does not validate key contents—RSA authentication is mocked for local testing only.
{{< /alert >}}
:::
4 changes: 1 addition & 3 deletions src/content/docs/snowflake/features/clones.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Clones
description: Get started with Clones in LocalStack for Snowflake
---



## Introduction

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.
Expand Down Expand Up @@ -110,4 +108,4 @@ The expected output is:
| 1 | test |
+----+------+
1 Row(s) produced. Time Elapsed: 0.012s
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Cross-Database Resource Sharing
description: Get started with cross-database resource sharing in the Snowflake emulator
---



## Introduction

Snowflake data providers can easily share data from various databases using secure views. These views can include schemas, tables, and other views from one or more databases, as long as they're part of the same account.
Expand Down Expand Up @@ -97,4 +95,4 @@ The expected output is:

```plaintext
(1, 2, 3)
```
```
9 changes: 2 additions & 7 deletions src/content/docs/snowflake/features/dynamic-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ title: Dynamic Tables
description: Get started with Dynamic Tables in LocalStack for Snowflake
---



## Introduction

Snowflake Dynamic Tables enable a background process to continuously load new data from sources into the table, supporting both delta and full load operations. A dynamic table automatically updates to reflect query results, removing the need for a separate target table and custom code for data transformation. This table is kept current through regularly scheduled refreshes by an automated process.

The Snowflake emulator supports Dynamic tables, allowing you to create and manage Dynamic tables locally. The following operations are supported:

* [`CREATE DYNAMIC TABLE`](https://docs.snowflake.com/en/sql-reference/sql/create-dynamic-table)
* [`DROP DYNAMIC TABLE`](https://docs.snowflake.com/en/sql-reference/sql/drop-dynamic-table)
The Snowflake emulator supports Dynamic tables, allowing you to create and manage Dynamic tables locally.

## Getting started

Expand Down Expand Up @@ -91,4 +86,4 @@ The output should be:
| 1 | foo |
| 2 | bar |
+----+------+
```
```
10 changes: 2 additions & 8 deletions src/content/docs/snowflake/features/hybrid-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ title: Hybrid Tables
description: Get started with Hybrid Tables in LocalStack for Snowflake
---



## Introduction

Snowflake Hybrid tables, also known as Unistore hybrid tables, support fast, single-row operations by enforcing unique constraints for required primary keys and including indexes to speed up data retrieval. These tables are designed to optimize support for both analytical and transactional workloads simultaneously, underpinning Snowflake's Unistore architecture.

The Snowflake emulator supports Hybrid tables, allowing you to create and manage Hybrid tables locally. The following operations are supported:

* [`CREATE HYBRID TABLE`](https://docs.snowflake.com/en/sql-reference/sql/create-hybrid-table)
* [`DROP HYBRID TABLE`](https://docs.snowflake.com/en/sql-reference/sql/drop-hybrid-table)
* [`SHOW HYBRID TABLES`](https://docs.snowflake.com/en/sql-reference/sql/show-hybrid-tables)
The Snowflake emulator supports Hybrid tables, allowing you to create and manage Hybrid tables locally.

## Getting started

Expand Down Expand Up @@ -73,4 +67,4 @@ The output should be:
| -----------------------------------------+
| TEST-TABLE successfully dropped. |
+------------------------------------------+
```
```
8 changes: 3 additions & 5 deletions src/content/docs/snowflake/features/iceberg-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ title: Iceberg Tables
description: This is a dummy description.
---



## Introduction

Iceberg tables uses [Apache Iceberg](https://iceberg.apache.org/) open table format specification to provide an abstraction layer on data files stored in open formats. Iceberg tables for Snowflake offer schema evolution, partitioning, and snapshot isolation to manage the table data efficiently.
Expand Down Expand Up @@ -81,6 +79,6 @@ The output should be:

You can also list the content of the S3 bucket:

{{< command >}}
$ awslocal s3 ls --recursive s3://test-bucket/
{{< / command >}}
```bash
awslocal s3 ls --recursive s3://test-bucket/
```
9 changes: 1 addition & 8 deletions src/content/docs/snowflake/features/materialized-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ description: Get started with Materialized Views in LocalStack for Snowflake

Materialized views are a feature of Snowflake that allows you to create a persistent view of a table. This view is pre-computed and stored in the database, allowing for faster queries and improved performance.

The Snowflake emulator supports Materialized Views, allowing you to accurately test materialized view logic and behavior in local development environments. The following operations are supported:

- [`CREATE MATERIALIZED VIEW`](https://docs.snowflake.com/en/sql-reference/sql/create-materialized-view)
- [`ALTER MATERIALIZED VIEW`](https://docs.snowflake.com/en/sql-reference/sql/alter-materialized-view)
- [`DESCRIBE MATERIALIZED VIEW`](https://docs.snowflake.com/en/sql-reference/sql/desc-materialized-view)
- [`DROP MATERIALIZED VIEW`](https://docs.snowflake.com/en/sql-reference/sql/drop-materialized-view)
- [`SHOW MATERIALIZED VIEWS`](https://docs.snowflake.com/en/sql-reference/sql/show-materialized-views)
- [`TRUNCATE MATERIALIZED VIEW`](https://docs.snowflake.com/en/sql-reference/sql/truncate-materialized-view)
The Snowflake emulator supports Materialized Views, allowing you to accurately test materialized view logic and behavior in local development environments.

## Getting started

Expand Down
Loading