For the complete documentation index, see llms.txt. This page is also available as Markdown.

Snowflake

Minimum Snowflake grants for each Nilus pipeline mode: batch read and write, and metadata ingestion.

This page lists the minimum Snowflake grants required to run each Nilus pipeline mode against a Snowflake depot. Use it as a provisioning reference when granting access to a Nilus pipeline role and user.

Read data: Snowflake as source (type: batch)

Used when the depot is referenced in source.address of a Nilus pipeline config. Nilus issues SELECT queries (full scan or incremental via a cursor column) against the target table.

Minimum grants

-- Step 1: Create role and user
CREATE ROLE nilus_reader_role;

CREATE USER nilus_reader_user
    DEFAULT_ROLE = nilus_reader_role
    PASSWORD = '<password>';

GRANT ROLE nilus_reader_role TO USER nilus_reader_user;

-- Step 2: Warehouse (required to execute any query)
GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE nilus_reader_role;

-- Step 3: Database
GRANT USAGE ON DATABASE <database_name> TO ROLE nilus_reader_role;

-- Step 4: Schemas: existing and future
GRANT USAGE ON ALL SCHEMAS IN DATABASE <database_name> TO ROLE nilus_reader_role;
GRANT USAGE ON FUTURE SCHEMAS IN DATABASE <database_name> TO ROLE nilus_reader_role;

-- Step 5: Tables and views: existing and future
GRANT SELECT ON ALL TABLES IN DATABASE <database_name> TO ROLE nilus_reader_role;
GRANT SELECT ON FUTURE TABLES IN DATABASE <database_name> TO ROLE nilus_reader_role;
GRANT SELECT ON ALL VIEWS IN DATABASE <database_name> TO ROLE nilus_reader_role;
GRANT SELECT ON FUTURE VIEWS IN DATABASE <database_name> TO ROLE nilus_reader_role;

To restrict access to a single schema, replace IN DATABASE <database_name> with ON SCHEMA <schema_name> IN DATABASE <database_name> in each grant.

Write data: Snowflake as destination (type: batch)

Used when the depot is referenced in sink.address of a Nilus pipeline config. Nilus manages table creation and data loading. The required grants depend on the incremental_strategy in use.

Schema creation

If the destination schema does not exist yet, Nilus creates it during the pipeline run. Creating a schema requires the database-level CREATE SCHEMA privilege, granted with GRANT CREATE SCHEMA ON DATABASE. Snowflake does not support granting CREATE SCHEMA at the schema level.

Minimum grants (covers all strategies)

Grants by incremental strategy

Strategy
Required DML

append

INSERT, CREATE TABLE, CREATE STAGE, CREATE SCHEMA (if schema may not exist)

merge

INSERT, UPDATE, DELETE, SELECT, CREATE TABLE, CREATE STAGE, CREATE SCHEMA

replace

INSERT, TRUNCATE, DROP TABLE (implicit via CREATE OR REPLACE TABLE), CREATE TABLE, CREATE STAGE, CREATE SCHEMA

Metadata ingestion: Snowflake source connector (type: metadata)

Used when the depot is referenced in source.address of a type: metadata Nilus pipeline. Nilus drives the Snowflake source connector, resolving the depot to a metadata+snowflake:// URI internally.

Basic metadata (tables, schemas, columns, tags)

Additional grants by workflow type

Workflow
Extra grant required
What it accesses

Lineage and usage

GRANT IMPORTED PRIVILEGES ON ALL SCHEMAS IN DATABASE SNOWFLAKE TO ROLE meta_ingestion_role;

snowflake.account_usage.query_history

Tags ingestion

Same IMPORTED PRIVILEGES above

snowflake.account_usage.tag_references

Stored procedures

Same IMPORTED PRIVILEGES above

snowflake.account_usage.procedures and .functions

Incremental extraction

Same IMPORTED PRIVILEGES above

snowflake.account_usage.tables

Column-level lineage (masking or row-access policies on views)

GRANT APPLY MASKING POLICY TO ROLE meta_ingestion_role; GRANT APPLY ROW ACCESS POLICY TO ROLE meta_ingestion_role;

Policy definitions on view DDLs

If direct access to SNOWFLAKE.ACCOUNT_USAGE is restricted, replicate the required tables (QUERY_HISTORY, TAG_REFERENCES, PROCEDURES, FUNCTIONS) to a custom schema, then set the Account Usage Schema Name option in the metadata connector to point to it (for example, CUSTOM_DB.CUSTOM_SCHEMA).

Permission matrix

Use case

USAGE WH

USAGE DB

USAGE Schema

SELECT

INSERT

UPDATE/DELETE

CREATE SCHEMA

CREATE TABLE

CREATE STAGE

Account Usage

Read (source, batch)

Yes

Yes

Yes

Yes

No

No

No

No

No

No

Write, append

Yes

Yes

Yes

No

Yes

No

Yes

Yes

Yes

No

Write, merge

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

Yes

No

Write, replace

Yes

Yes

Yes

No

Yes

TRUNCATE

Yes

Yes (+ DROP)

Yes

No

metadata (basic)

Yes

Yes

Yes

Yes

No

No

No

No

No

No

lineage, usage, tags

Yes

Yes

Yes

Yes

No

No

No

No

No

Yes

Notes

  • role lives in the depot secret only. The depot spec does not carry a role field. Set role in the secret to activate a specific Snowflake role for the session. If not set, Snowflake falls back to the user's DEFAULT_ROLE.

  • The role must be pre-granted to the user before the pipeline runs.

  • CREATE SCHEMA is a database-level privilege, granted with GRANT CREATE SCHEMA ON DATABASE, not at the schema level. Omitting this grant causes the pipeline to fail on the first write to a schema that does not yet exist.

Last updated

Was this helpful?