Ok… bear with us a minute. We have a few requirements with this one. We are very worried about clustering depth this week, and so we need to build a DAG of tasks that will monitor this.
Create the following table:
create or replace table cluster_depth_monitoring ( database_name varchar, sceham_name varchar, table_name varchar, clustering_depth float, inserted_at timestamp, inserted_by varchar );
We want a DAG like the one above where:
- Identify the tables in your database that are clustered
- Create a transient table with this information
- Execute a Snowpark stored procedure that examines the clustering depth of each of those tables
- Inserts the result into the
- Drops the transient table created by CM_IDENTIFY_TABLES
Importantly, we want all these tasks to tag the queries with ‘cluster_depth_monitoring’
If you need a db to use
The above DB has clustered tables, I would recommend perhaps editing the db name, though…
alter database SFSALESSHARED_SFC_SAMPLES_AWS_EU_WEST_2_SAMPLE_DATA rename to SNOWFLAKE_SAMPLE_DATA;
Note that the name might appear different in your account, and that, depending on your account’s permission structures, you may need ACCOUNTADMIN to add this db.
Your end result ought to look something like this:
Remember, if you want to participate: