# Snowflake

A cloud-based data platform offers a scalable, secure, and high-performance relational database that offers online services and minimal management.&#x20;

## Supported Methods

Means for Lumi to connect to the client to implement the services required

* [x] **Direct**&#x20;

  *The default / typical connection option. Interfaces directly with the target system over the Internet with no mediation. Suitable for most cloud-hosted scenarios or public-facing resources. See* [*Network Configuration*](https://docs.lumi-ai.com/using-lumi/network-configuration) *for more details.*
* [x] **Gateway**\
  \&#xNAN;*An alternative connection method leveraging a Lumi AI Data Gateway. This uses Lumi AI's purpose-built connection agent to mediate communications. Ideal for restricting access to systems within a protected network. For more information, see* [*Data Gateway*](https://docs.lumi-ai.com/product-features/data-gateway)*.*&#x20;

## Supported Limits

The following are limitations that can be set to fine tune the agents' actions:&#x20;

* [ ] **Cost Limit**\
  \&#xNAN;*Before running a query, if the system supports it, the system-specific compute cost (or surrogate) estimate will be processed and compared to an organization-level/admin-set cost limit for systems of this type (if configured/set). If exceeded, the query will not run (and either the workflow will attempt an optimization or the user will be notified).*
* [x] **Duration Limit**\
  \&#xNAN;*An alternative to cost, queries will be stopped the system supports a duration/timeout limit and one is set/configured at the organization level (across systems).*

## Available Parameters

These properties are the essential source system connection properties that all queries are directed towards.

*\* Required parameters*

{% hint style="info" %}
Note: The Gateway parameter is common to all systems (when supported) and is only available when gateway is the selected connection method.
{% endhint %}

<details>

<summary>Account Identifier*</summary>

Provide the Snowflake unique account identifier within your organization.

[Snowflake Account Identifier Documentation](https://docs.snowflake.com/en/user-guide/admin-account-identifier)&#x20;

</details>

<details>

<summary>Username*</summary>

Username of the generated database user which will be used for interactions and transactions.

**Special Considerations**

* If double quotes are used, then the name will be case sensitive
* Encasing a username with \[ ] allows for a usage of reserved words and the @ character
* Username can include alphanumeric characters, hyphens (-), underscores (\_), and periods (.)

:thumbsup: **Valid Examples**

* Uses alphanumeric characters : *lumi1*
* Utilizing underscore (\_) in place of spaces: *user\_number*

:thumbsdown: **Invalid Examples**

* Starting with a number: *1lumi*
* Utilizing spaces: *user name*
* Using invalid characters: *user#1*

</details>

<details>

<summary>Password</summary>

Password of the generated database user which will be used for interactions and transactions (if using password-based authentication).

</details>

<details>

<summary>Private key</summary>

Private key of the generated database user which will be used for interactions and transactions (if using Public / Private Key Pair-based authentication)

</details>

<details>

<summary>Database*</summary>

Literal database name that will be used for transactions within the agents.

:thumbsup: **Valid Examples**

* Uses alphanumeric characters: *lumi1*
* Utilizing underscore (\_) in place of spaces: *new\_database*

:thumbsdown: **Invalid Examples**

* Starting with a number: *1lumi*
* Utilizing spaces: *user name*
* Using reserved words unquoted: *select*

</details>

<details>

<summary>Warehouse*</summary>

Literal warehouse name that will be used for transactions within the agents.

[How To Generate A Warehouse](https://docs.snowflake.com/en/sql-reference/sql/create-warehouse)

:thumbsup: **Valid Examples**

* Uses alphanumeric characters: *lumi1*
* Utilizing underscore (\_) in place of spaces: *new\_database*

:thumbsdown: **Invalid Examples**

* Starting with a number: *1lumi*
* Utilizing spaces: *user name*
* Using reserved words unquoted: *select*

</details>

<details>

<summary>Role*</summary>

The role associated with the an account to provide access and permissions.

[How To Generate A Role](https://docs.snowflake.com/en/sql-reference/sql/create-role)

</details>

## System Permissions & Configuration

Provided user must have the following:

* [x] If applicable generate a new User with:
  * [x] `DEFAULT_ROLE`, `DEFAULT_WAREHOUSE`, `DEFAULT_NAMESPACE`, and `PASSWORD`
* [x] Generate a new ROLE and grant privileges:
  * [x] `GRANT USAGE ON DATABASE <database> TO ROLE <role>`
  * [x] `GRANT USAGE ON SCHEMA <database.schema> TO ROLE <role>`
* [x] Grant SELECT to all tables via `GRANT SELECT ON ALL TABLES IN SCHEMA <database.schema> TO ROLE <role>`
* [x] When applicable, grant the role to the generated user&#x20;

For configurations:

* [x] Ensure the server is allowing connections from the Lumi gateway or server via the firewall

## Special Notes

* If case sensitivity is required and other special characters, utilize double quotes for database name; ex. "New\_database"&#x20;

## Common Issues

* Ensure the firewall settings allow for a connection to the database
* Ensure the username, password, and database values are explicitly provided&#x20;
