> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paradime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake Storage

> Read your Bolt schedule run artifacts from the Paradime-hosted S3 bucket directly in Snowflake using a Snowflake Storage Integration.

Paradime enables you to read from the Paradime-hosted AWS S3 bucket all the files generated from production schedules running with Paradime using a [Snowflake Storage Integration](https://docs.snowflake.com/en/user-guide/data-load-s3-config-storage-integration).

## What you can do

* Read Bolt schedule run metadata (such as `manifest.json` and `run_results.json`) directly from Snowflake.
* Query dbt™ run artifacts stored in the Paradime-hosted S3 bucket using Snowflake external stages.

## Prerequisites

To set up this integration, reach out to the Paradime team at [support@paradime.io](mailto:support@paradime.io) to get the following values, which you will need to create the storage integration in your Snowflake account:

* `STORAGE_AWS_ROLE_ARN`
* `STORAGE_ALLOWED_LOCATIONS`

## How to set up the integration

### Step 1: Create a Snowflake Storage Integration

After receiving the AWS role and S3 path from the Paradime team, you will need to create a new storage integration to establish connecting your Snowflake account to the AWS S3 bucket containing your schedules' run metadata.

Execute the below SQL command in Snowflake replacing the placeholder text with the appropriate values.

```sql theme={"system"}
use role ACCOUNTADMIN;

CREATE STORAGE INTEGRATION BOLT_METADATA
  TYPE = EXTERNAL_STAGE
  STORAGE_PROVIDER = 'S3'
  ENABLED = TRUE
  STORAGE_AWS_ROLE_ARN = '<aws_role_provided_by_paradime>'
  STORAGE_ALLOWED_LOCATIONS = ('<s3_pathprovided_by_paradime>');
```

Now you will need to the get from Snowflake the `STORAGE_AWS_IAM_USER_ARN` and the `STORAGE_AWS_EXTERNAL_ID` for the Storage Integration you have just created by executing the below command and share it with the Paradime team to complete the configuration.

```sql theme={"system"}
DESC INTEGRATION BOLT_METADATA;
```

### Step 2: Create a Snowflake External Stage to query our metadata

You can now create a Snowflake External Stage to specify where data files are stored so that the data in the files can be loaded into a table.

First lets create a [file format](https://docs.snowflake.com/en/sql-reference/sql/create-file-format) in Snowflake. This will be needed in the next step when creating the STAGE

```sql theme={"system"}
CREATE OR REPLACE FILE FORMAT my_json_format
  TYPE = 'json';
```

In the example below we are going to create an external stage based on our storage integration in the database called `ANALYTICS` and in the schema `EXTERNAL`.

<Info>
  Note that you can create multiple Snowflake Stages connecting to your Snowflake Storage integration.
</Info>

Below we are going to create a STAGE to access schedules metadata like `manifest.json` for any of the schedules in our default Paradime workspace (This usually is named after the organization name you enter to login/signup).

```sql theme={"system"}
CREATE OR REPLACE STAGE ANALYTICS.EXTERNAL.BOLT_METADATA
  STORAGE_INTEGRATION = "BOLT_METADATA" 
  URL = 's3://paradime-s3-uany7edagtovarzx-eu-west-2/bolt/'
  FILE_FORMAT = my_json_format;
```

Alternatively you can create a STAGE point directly to a given schedule name folder in the AWS S3

```sql theme={"system"}
CREATE OR REPLACE STAGE ANALYTICS.EXTERNAL.BOLT_METADATA
  STORAGE_INTEGRATION = "BOLT_METADATA" 
  URL = 's3://paradime-s3-uany7edagtovarzx-eu-west-2/bolt/run/daily_jaffle/current'
  FILE_FORMAT = my_json_format;
```

## Query dbt™️ runs artifacts directly from Snowflake

Now that the Snowflake Stage has been configured, you can query your Bolt schedules metadata directly from Snowflake with a query like the one below.

👉 See also: [Querying Snowflake Stage](https://docs.snowflake.com/en/user-guide/querying-stage).

```sql theme={"system"}
SELECT
  METADATA $FILENAME,
  METADATA $FILE_ROW_NUMBER,
  METADATA $FILE_CONTENT_KEY,
  METADATA $FILE_LAST_MODIFIED,
  METADATA $START_SCAN_TIME,
  parse_json($1) as JSON_META
FROM
  @ANALYTICS.EXTERNAL.BOLT_METADATA/target/manifest.json;
```


## Related topics

- [Integrations](/integrations/index.md)
- [Snowflake cost connection](/integrations/snowflake/cost-connection.md)
- [Snowflake Tools](/products/dino-ai/tools-and-features/warehouse-tool/snowflake-tools.md)
- [Snowflake Alerts](/products/radar/real-time-alerting/snowflake-alerts.md)
- [Snowflake](/integrations/snowflake/index.md)
