# Connect Snowflake

### Connect Roadway to Snowflake

[Data Warehouse Requirements](/data-requirements/warehouse-requirements.md)

1\. Log in to the **Snowflake** web interface.

2\. Execute the following SQL. These `commands` create a roadway user, role, warehouse and schema and grants read and write permissions on this schema.

```sql
Copy/*
Create Database Objects:

Note that we use explicit CREATE statements with no additional clauses, which 
prevents us from overwriting any existing objects of the same name. In the event you already have objects with these names, change the names in this script accordingly, but notify us of these changes.
 */
CREATE USER roadway_user
		PASSWORD = <some password>
		DEFAULT_ROLE = 'roadway_role'
		DEFAULT_WAREHOUSE = 'roadway_warehouse'
		DEFAULT_NAMESPACE = 'your_db.roadway'
		EMAIL = 'service@roadwayai.com'
;
CREATE SCHEMA <your_db>.roadway;
CREATE WAREHOUSE roadway_warehouse
		AUTO_SUSPEND = 1
		WAREHOUSE_SIZE = XSMALL -- default to most conservative size, but change according to data volume and usage
;
CREATE ROLE roadway_role;

-- grant usages to roadway_role
GRANT USAGE ON DATABASE <your_db> TO ROLE roadway_role;
GRANT USAGE ON SCHEMA <your_db>.roadway TO ROLE roadway_role;
GRANT USAGE ON WAREHOUSE roadway_warehouse TO ROLE roadway_role;

-- grant limited read/write privileges to roadway_role within roadway schema
GRANT SELECT ON ALL VIEWS IN SCHEMA <your_db>.roadway TO ROLE roadway_role;
GRANT SELECT ON ALL TABLES IN SCHEMA  <your_db>.roadway TO ROLE roadway_role;
GRANT SELECT ON FUTURE TABLES IN SCHEMA <your_db>.roadway TO ROLE roadway_role;
GRANT SELECT ON FUTURE VIEWS IN SCHEMA <your_db>.roadway TO ROLE roadway_role;
GRANT CREATE TABLE, CREATE VIEW ON SCHEMA <your_db>.roadway TO ROLE roadway_role;

-- grant roadway_role to roadway_user
GRANT ROLE roadway_role TO USER roadway_user;
```

3\. Extend the above commands with readonly permissions on other databases and schemas according to your warehouse structure, e.g. GRANT SELECT ON ALL TABLES IN SCHEMA revenue\_db.stripe TO ROLE roadway\_role.

4\. Ensure the role has permissions to view and create as needed.

```sql
Copysql
Copy code
GRANT SELECT, INSERT ON ALL TABLES IN schema your_schema TO service@roadwayai.com;
```


---

# Agent Instructions: 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:

```
GET https://docs.roadwayai.com/implement-roadway/warehouse-native/connect-snowflake.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
