Reputation: 11
I would like to know how to separate billing for different functions with Snowflake. Would this have to be using the resource monitor and separate warehouses. Or can something be set at a schema\database or other layer?
Upvotes: 0
Views: 179
Reputation: 2622
Let's assume you have 4 different functional areas (Data Loading, ETL, Dashboarding and Data Scientists) and thus 4 different warehouses, one for each area.
Next step is to assign the different virtual warehouses to the corresponding users. This can be done by
USE WAREHOUSE etl_warehouse
at the top of a script (e.g. in data loading or etl scenarios)ALTER USER analyst123 SET DEFAULT_WAREHOUSE = analyst_warehouse
At the moment it is not possible to assign a warehouse to a schema/database to ensure something like "All workloads associated with this database have to run with this virtual warehouse". There can only be the connection between a user and his warehouse.
Same for resource monitors: They cannot be assigned to a database or schema, but to one or more virtual warehouses and on the account level.
For more detailed information regarding INFORMATION_SCHEMA/ACCOUNT_USAGE views and tables I recommend the link stated in one of the other answers.
Upvotes: 0
Reputation: 590
Surely Virtual Warehouses are the first point of call for achieving your call - most of the costs are computation and it is easy to think of a Virtual Warehouse per function. As for disk space, you may come up with a naming convention that allows you to differentiate them or go down to the Owner of the database, or the schema if you like. I would suggest starting from this Power BI report and the article from its author that illustrates how it has been built using the metadata provided by Snowflake:
https://medium.com/analytics-vidhya/snowflake-power-bi-snowflake-usage-report-f628dadbdc85
Upvotes: 0