Snowflake: security and costs
What QUANTI:'s Snowflake setup script grants, how to share your own tables, how to cut access, and what it costs.
Setting up the project: Snowflake.
What the script does
The script creates who QUANTI: is in your account (a user), and what it may do (two roles). Nothing else.
ACCOUNTADMIN ──creates──▶ QUANTI_<ID>_ROLE ◀──held by── QUANTI_<ID>_USER (public key)
│ │
├─ USAGE → your warehouse (run loads)
├─ USAGE + CREATE SCHEMA → your database (1 schema per source)
└─ EXECUTE (MANAGED) TASK → account (webhook visits, optional)
│
ACCOUNTADMIN ──creates──▶ QUANTI_<ID>_READER ◀──held by─────────┘
├─ USAGE → your warehouse (AI assistant queries)
├─ USAGE → your database
└─ SELECT, granted by QUANTI: → only the schemas QUANTI: createsThe
SETlines are worksheet variables, used only while the script runs.identifier($x)turns a variable into an object name.USE ROLE ACCOUNTADMIN: the script needs it to grant the webhook task privileges, which only ACCOUNTADMIN can grant. QUANTI: never uses it.CREATE ROLE: QUANTI:'s privileges are granted to this role, not to the user. This role holds every privilege QUANTI: needs to load data.GRANT ROLE … TO ROLE SYSADMIN: SYSADMIN inherits QUANTI:'s role, never the other way round. In Snowflake an object belongs to the role that created it, and even SYSADMIN cannot see it otherwise. With this grant, your admins see and manage every schema and table QUANTI: creates. QUANTI: gains nothing from it.CREATE USER … TYPE = SERVICE: the identity QUANTI: signs in with. A service user cannot sign in with a password: only the key works.DEFAULT_ROLE: the role used when QUANTI: signs in.DEFAULT_WAREHOUSE: the warehouse QUANTI: loads run on.DEFAULT_SECONDARY_ROLES = (): no secondary role is active by default, so a QUANTI: session does not combine the privileges of all the user's roles.RSA_PUBLIC_KEY: Snowflake checks QUANTI:'s signature with it.
GRANT ROLE … TO USER: without it, the user signs in with no privilege.USAGEon the warehouse: run queries on it. QUANTI: cannot resize or change it.USAGE,CREATE SCHEMAon the database: enter the database and create one schema per data source. QUANTI: owns what it creates and never touches your other schemas.EXECUTE MANAGED TASK,EXECUTE TASK: webhooks only, see Webhooks: visits.The read-only role
QUANTI_<ID>_READER: the AI assistant queries your data with it, never with the loading role. The script gives it no read right: each time QUANTI: creates a schema, it grants this roleSELECTon that schema's tables and views, and nothing else. So the assistant cannot write, and cannot read your own schemas unless you grant them yourself (see Tables you created yourself).WITH MANAGED ACCESS: QUANTI: creates its schemas in this mode. Only the schema's owner, QUANTI:'s loading role, or a role with theMANAGE GRANTSprivilege can grant access to its tables. That is what lets QUANTI: open them to the read-only role without any account-wide privilege.
Tables you created yourself
QUANTI: sees the schemas and tables it creates: they belong to its role. A table you created yourself, in PUBLIC or any other schema, belongs to your role, and QUANTI: cannot see it. Give read access to the role that needs it:
push the table to a destination with a reverse connector
QUANTI_<ID>_ROLE, the loading role
declare it in a semantic view, so the AI assistant can query it
QUANTI_<ID>_READER, the read-only role
The AI assistant only reads with QUANTI_<ID>_READER: a table granted to QUANTI_<ID>_ROLE alone stays invisible to it. For both uses, grant both roles.
Give read access, nothing more: USAGE on the schema, SELECT on the table. Run as ACCOUNTADMIN, or as the role that owns the table. For the reverse connector:
For the AI assistant, the same lines with the read-only role:
For every table of a schema, including the ones you create later (replace _ROLE by _READER for the AI assistant):
In Snowsight, you can also open the table under Catalog » Explorer, then in Privileges select + Privilege, pick QUANTI:'s role and the SELECT privilege; the schema still needs USAGE.
Cut or remove QUANTI:'s access
To cut it at once, reversibly:
When you delete the project in QUANTI:, its user and role stay in your account. Remove them yourself:
The schemas QUANTI: created stay in your database, with your data: drop them only if you no longer need them.
Cost
Everything QUANTI: runs in your Snowflake account is billed to your account.
Connector loads run on your warehouse. Each load resumes it: Snowflake bills at least 60 seconds, then every second until the warehouse suspends. Its
AUTO_SUSPENDdelay is billed after every load: with 300 seconds, a 20-second load bills about 5 minutes. See Warehouse considerations.Webhook visits are computed once a night, at 02:30 UTC, by a serverless task, billed to your account as serverless compute.
The access check reads metadata, and creates then drops an empty test schema: it never starts your warehouse.
If nothing else needs your warehouse to stay on, lower its delay:
Last updated