The account baseline we start most Snowflake engagements with: roles, warehouses, grants, a nightly dev clone, a DCM project and AI gateway governance, as plain SQL you can read in an afternoon.
- A two-layer role model: access roles hold privileges, functional roles describe people and services, and future grants are set per schema so the model stays true as tables arrive.
- Warehouses sized per workload, suspending after 60 seconds, each with a resource monitor, plus the queries that tell you whether to size up (spilling) or scale out (queuing).
- A nightly zero-copy clone of production into dev, with the dev grants re-applied every time.
- A DCM project that stamps out the same team infrastructure per environment from one Jinja definition.
- Cortex AI Gateway locked down with ordinary RBAC: USAGE removed from PUBLIC, MONITOR for a cost role, and payload capture with tag-based exemptions.
- Snowflake access control that scales past your first ten users
- Snowflake warehouse sizing, a practical guide
- Zero-copy cloning, the Snowflake feature teams underuse
- DCM Projects, managing Snowflake objects as code from inside Snowflake
- Cortex AI Gateway, one governed door for every model your teams use
Run the scripts in order in a Snowsight worksheet or with the Snowflake CLI. Each script switches to the role it needs with USE ROLE, so you need a user that holds ACCOUNTADMIN for the first run. After that, day-to-day work happens in the functional roles.
| Order | Script | Roles used |
|---|---|---|
| 1 | setup/01_roles.sql |
USERADMIN, SECURITYADMIN |
| 2 | setup/02_warehouses.sql |
SYSADMIN, SECURITYADMIN, ACCOUNTADMIN |
| 3 | setup/03_databases_and_grants.sql |
SYSADMIN, SECURITYADMIN |
| 4 | setup/04_dev_refresh_by_clone.sql |
ACCOUNTADMIN, SYSADMIN, FR_DEPLOY |
| 5 | setup/05_ai_gateway_governance.sql |
ACCOUNTADMIN |
| any time | monitoring/*.sql |
a role with access to SNOWFLAKE.ACCOUNT_USAGE |
Placeholders to replace before running:
sales_db,sales_db_devand therawandcuratedschemas: your own database and schema names.- The
CREDIT_QUOTAvalues in02_warehouses.sql: your monthly budget per workload. - The cron schedule and time zone in
04_dev_refresh_by_clone.sql. - Ownership for the dev clone: the procedure re-grants on cloned tables, which only works if
FR_DEPLOYowns them or holds MANAGE GRANTS. The comment at the top of04_dev_refresh_by_clone.sqlexplains the trade-off. - Read the comment at the top of
05_ai_gateway_governance.sqlbefore running it. Payload capture stores prompts and responses, so agree it with whoever is responsible for privacy first.
For the DCM project:
- Run
dcm/bootstrap.sqlonce to create the deployer role and the project object. - Replace the
account_identifiervalues indcm/manifest.yml. - From the
dcmfolder, preview the changes withsnow dcm plan --target DEV. Nothing is applied until you deploy.
setup/ numbered account baseline scripts
monitoring/ warehouse sizing and access review queries
dcm/ DCM project: manifest, Jinja definitions and macros, bootstrap
scripts/ render_dcm.py, a local render check for the DCM templates
- CI runs
sqlfluff lint(Snowflake dialect, sqlfluff 4.5.0) over every SQL file except the two listed in.sqlfluffignore. That proves the SQL parses and follows a consistent style. It does not prove it runs. setup/05_ai_gateway_governance.sqland the DCM definitions use syntax newer than the linter's dialect, so they are excluded from lint. Every statement in them follows the Snowflake documentation linked at the top of each file.- CI renders the DCM templates for every configuration in the manifest with strict undefined variables, so a broken loop or a missing variable fails the build. That is a local check; Snowflake's own
PLANis the real test. - None of these scripts have been run against a Snowflake account as part of this repository. Read them, run them in a trial or sandbox account first, and adapt names and budgets to yours.
- Access control overview
- Warehouses overview
- Cloning considerations
- DCM Projects overview
- Cortex AI Gateway
Built by Cloudcentrix, cloud and data engineering in South Africa. https://cloudcentrix.co.za