Set up dedicated Snowflake roles and permissions for two
scenarios: read-only access for rules and profiling through a catalog
datasource, and read/write access for quality pipeline
execution.
Before you begin, choose a warehouse size based on your data
volume. The right size supports efficient rule execution and
profiling, and helps manage costs. Use a multi-cluster warehouse
with Min 1 and Max 4 as the recommended
configuration.
| Data size |
Number of columns |
Warehouse size |
| < 10 million records |
< 100 |
Small |
| 10 million – 50 million records |
100 – 300 |
Medium |
| 50 million – 120 million records |
100 – 500 |
Large |
| 120 million+ records |
100 – 500 |
X-Large |
Depending on how Quality is used in your environment, two
permission configurations might be required:
- Catalog datasource setup: Read-only access for
running rules and profiling against a registered Snowflake
datasource. Grants SELECT and staging privileges only for
temporary processing objects.
- Quality pipeline setup: Full read/write access for a
pipeline that evaluates rules and writes results back to
Snowflake. Also grants INSERT, UPDATE, DELETE, CREATE TABLE,
and stage read/write permissions.
Note: A pipeline engine is required only for
features that execute processing through a pipeline. Features
that do not require a pipeline engine can use the catalog
datasource configuration alone. If multiple Snowflake
connections use the same account credentials, a single pipeline
engine can be shared across those connections. In this case,
only one schema within that Snowflake connection requires the
additional pipeline permissions described in this topic.
-
Set up roles and permissions for a catalog
datasource.
This configuration grants a custom role the minimum
permissions required to evaluate quality rules and run
profiling against a Snowflake datasource. Key
permissions, including CREATE STAGE, CREATE
FILE FORMAT, and CREATE FUNCTION, support
temporary processing objects that are removed
automatically after each run.
-
Create a custom role.
create role PRECISELY_DIS_INSIGHTS;
-
Create an empty staging schema.
create schema EXAMPLE_DB.STAGING_SCHEMA;
If the staging schema already exists, drop the
existing stage before you continue:
drop stage if exists EXAMPLE_DB.STAGING_SCHEMA.PRECISELY_DQ_STAGE;
-
Grant staging permissions to the role.
grant CREATE STAGE, CREATE FILE FORMAT, CREATE FUNCTION on schema EXAMPLE_DB.STAGING_SCHEMA to role PRECISELY_DIS_INSIGHTS;
-
Grant warehouse usage permission to the role.
Note: Grant the role
permission to use the desired warehouse for
processing.
grant usage on warehouse EXAMPLE_WH to role PRECISELY_DIS_INSIGHTS;
-
Grant database and schema access to the role.
Note: Provide the role
permission to use the database and desired
schemas, and to read data from the
tables.
-
grant usage on database EXAMPLE_DB
to role PRECISELY_DIS_INSIGHTS;
-
grant usage on all schemas in
database EXAMPLE_DB to role
PRECISELY_DIS_INSIGHTS;
-
grant usage on future schemas in
database EXAMPLE_DB to role
PRECISELY_DIS_INSIGHTS;
-
grant select on all tables in
database EXAMPLE_DB to role
PRECISELY_DIS_INSIGHTS;
-
grant select on future tables in
database EXAMPLE_DB to role
PRECISELY_DIS_INSIGHTS;
-
Assign the role to the user who will perform
cataloging.
grant role PRECISELY_DIS_INSIGHTS to user PRECISELY_DIS_USER;
-
Grant the user permission to use internal
stages.
alter user PRECISELY_DIS_USER set PREVENT_UNLOAD_TO_INTERNAL_STAGES=FALSE;
Note: This user-level
Snowflake setting is currently required for any
operation that uses a pipeline engine. It allows
the pipeline to write temporary processing data
to the staging schema while executing UDF and
UTF operations. These temporary files are used
only during pipeline execution and are
automatically deleted after processing
completes.
-
Create a Snowflake connection using the following
credentials.
- User:
PRECISELY_DIS_USER
- Role:
PRECISELY_DIS_INSIGHTS
- Warehouse:
EXAMPLE_WH
-
Create a pipeline engine and set its schema to the
staging schema.
Create a pipeline engine with schema
STAGING_SCHEMA.
-
Grant roles and permissions for a quality pipeline.
This configuration grants a dedicated role full access to
compute resources, schemas, tables, and staging areas
required during pipeline execution. Unlike the catalog
datasource setup, this flow also grants write
permissions so the pipeline can store results and manage
intermediate tables.
Required permissions are:
- CREATE STAGE: Allows the pipeline to create
temporary storage locations for intermediate
execution files.
- CREATE FILE FORMAT: Enables the pipeline to
define formats required for reading and writing
staged data.
- CREATE FUNCTION: Allows creation of
user-defined functions used during rule evaluation
or transformations.
- SELECT: Provides read access to source tables
required for rule evaluation.
- INSERT, UPDATE, DELETE, TRUNCATE: Allows the
pipeline to write results and manage intermediate
tables.
- CREATE TABLE: Enables creation of result
tables or temporary processing tables.
- READ and WRITE on Stage: Allows upload and
retrieving intermediate files used during
execution.
Note:
- The pipeline may create temporary stages, file
formats, or functions during execution.
- Intermediate data may be written to the internal
stage while rules are evaluated.
- Temporary files and objects are used only during
pipeline execution.
- Cleanup for most temporary artifacts is
automated after the pipeline run completes.
- The staging schema and stage object remain
available for reuse across pipeline runs.
-
Create a dedicated role for pipeline
execution.
CREATE ROLE IF NOT EXISTS PRECISELY_DQ_OPERATOR;
-
Grant warehouse usage so the role can run pipeline
workloads.
GRANT USAGE ON WAREHOUSE DQ_AUTO_DEV TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant database access.
GRANT USAGE ON DATABASE DQ TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant schema access to the schema where the
pipeline reads and writes data.
GRANT USAGE ON SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant object-creation permissions for stages, file
formats, and functions.
GRANT CREATE STAGE, CREATE FILE FORMAT, CREATE FUNCTION ON SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant read access to existing and future
tables.
GRANT SELECT ON ALL TABLES IN SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
GRANT SELECT ON FUTURE TABLES IN SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant write access to existing tables.
GRANT INSERT, UPDATE, DELETE, TRUNCATE ON ALL TABLES IN SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant write access to future tables.
GRANT INSERT, UPDATE, DELETE ON FUTURE TABLES IN SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
-
Grant table creation permission.
GRANT CREATE TABLE ON SCHEMA DQ.AUTOMATION_DO_NOT_TOUCH TO ROLE PRECISELY_DQ_OPERATOR;
-
Create an internal stage for temporary pipeline
files.
CREATE STAGE IF NOT EXISTS DQ.AUTOMATION_DO_NOT_TOUCH.PRECISELY_DQ_STAGE;
-
Grant stage read and write permissions to the
role.
GRANT READ, WRITE ON STAGE DQ.AUTOMATION_DO_NOT_TOUCH.PRECISELY_DQ_STAGE TO ROLE PRECISELY_DQ_OPERATOR;
-
Create a dedicated Snowflake user for pipeline
execution.
CREATE USER IF NOT EXISTS PRECISELY_DQ_USER PASSWORD = 'your_strong_password' DEFAULT_ROLE = PRECISELY_DQ_OPERATOR DEFAULT_WAREHOUSE = DQ_AUTO_DEV DEFAULT_NAMESPACE = DQ.AUTOMATION_DO_NOT_TOUCH MUST_CHANGE_PASSWORD = FALSE DISABLED = FALSE;
-
Assign the role to the pipeline user.
GRANT ROLE PRECISELY_DQ_OPERATOR TO USER PRECISELY_DQ_USER;
-
Allow the pipeline to unload intermediate results
to internal stages.
ALTER USER PRECISELY_DQ_USER SET PREVENT_UNLOAD_TO_INTERNAL_STAGES = FALSE;
Both Snowflake access configurations are complete. The catalog
datasource role is ready for rule evaluation and profiling, and
the quality pipeline role is ready for full pipeline
execution.
Note:
- A temporary staging area is set up during processing
where required files are uploaded to run operations.
This includes creating temporary storage areas, file
formats, and custom functions to support faster data
processing.
- Data is stored in Snowflake in compressed JSON format,
which includes details about records that did not meet
the specified criteria. Special functions are also set
up to manage this data efficiently.
- No temporary tables are created; however, temporary
stages, file formats, and user-defined functions are
established for the duration of the processing
tasks.
- Data is not permanently stored in staging objects. All
data is deleted from temporary areas after the pipeline
run completes.
- After processing, all temporary items are permanently
deleted, ensuring no residual data or objects
remain.
- The cleanup process is fully automated and clears most
temporary items such as data files and functions after
each run. The temporary staging area is not deleted, as
it is required for pipeline runs and tasks within the
same database.
- The temporary staging schema and stage can be reused
across multiple pipeline runs. Temporary files generated
during execution are automatically removed when
processing completes.