> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/textual/textual-integrations/snowflake-native-app-and-spcs/snowflake-app-setup.md).

# Setting up the app

For the Tonic Textual Snowflake Native App, you set up:

* A compute pool
* A warehouse to enable queries
* To enable the app to detect model-based custom entity types, a&#x20;

## Setting up the compute pools <a href="#snowflake-app-compute-pool" id="snowflake-app-compute-pool"></a>

The compute pools must be specific to Textual.

{% code overflow="wrap" %}

```sql
USE ROLE SYSADMIN;

CREATE COMPUTE POOL IF NOT EXISTS textual_api_pool
  MIN_NODES = 1
  MAX_NODES = 1
  INSTANCE_FAMILY = CPU_X64_XS
  AUTO_RESUME = true
  AUTO_SUSPEND_SECS = 600;
  
CREATE COMPUTE POOL IF NOT EXISTS textual_ml_pool
    MIN_NODES = 1
    MAX_NODES = 1
    INSTANCE_FAMILY = GPU_NV_S
    AUTO_RESUME = true;
    AUTO_SUSPEND_SECS = 600;
```

{% endcode %}

## Creating a warehouse for Textual to query Snowflake <a href="#snowflake-app-etup-warehouse" id="snowflake-app-etup-warehouse"></a>

To run SQL queries against Snowflake tables that the app manages, the app requires a warehouse.

{% code overflow="wrap" %}

```sql
USE ROLE ACCOUNTADMIN; CREATE WAREHOUSE {YOUR_TEXTUAL_WAREHOUSE_NAME} WITH WAREHOUSE_SIZE='MEDIUM';
GRANT USAGE ON WAREHOUSE {YOUR_TEXTUAL_WAREHOUSE_NAME} TO APPLICATION TONIC_TEXTUAL;
```

{% endcode %}

## Mounting model-based custom entity types

To be able to use the Snowflake integration to detect model-based custom entity types, you must mount the entity types to a Snowflake stage.

To obtain the entity type files to mount, contact Tonic.ai.

### Creating the stage to mount the entity types

To create the stage:

{% code overflow="wrap" %}

```sql
USE ROLE ACCOUNTADMIN; CREATE OR REPLACE STAGE public.textual_models
  DIRECTORY = (ENABLE = TRUE)
  ENCRYPTION = (TYPE = 'SNOWFLAKE_SSE');
```

{% endcode %}

After you create the stage, grant read access to the role that you will use to call the app:

{% code overflow="wrap" %}

```sql
GRANT READ ON STAGE public.textual_models TO ROLE <role name>;
```

{% endcode %}

### Mounting the entity types

You mount to the stage each model-based custom entity type that you want to use in the Snowflake integration. You request the entity type files from Tonic.ai.

The file structure for the mounted entity types is:

{% code overflow="wrap" %}

```
<organization_identifier>  // The identifier of the Textual organization.
    <entity type identifier>  // The identifier of the custom entity type.
        labels
        <model identifier>   // The identifier of the trained model to use.
          [model files] // Model definition files
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tonic.ai/textual/textual-integrations/snowflake-native-app-and-spcs/snowflake-app-setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
