Snowflake: Upcoming Feature Alert

Suraj Deogade
3 min readSep 8, 2023

While running the statement, grant all on schema <schema name> to a role name. Yesterday I got the output as selective access granted on schema except CREATE ANOMALY DETECTION, CREATE FORECAST, CREATE DYNAMIC TABLE, CREATE SECRET!

This is interesting as data engineers with minimal knowledge on python and data science space will be encouraged to try hands on these areas and explore the model training without dependent on coding python.

It seems so easy to use and no coding involved on cloud platforms like AWS, Azure & GCP with user interface ML capabilities usage is simpler but with snowflake it is just becoming Data Game!!

As most of the fraternity is aware of the Dynamic tables from the recent Snowflake Summit.

Below are the upcoming feature and their examples, links from the official documentation.

1. CREATE ANOMALY_DETECTION

Allows you to detect outliers in your time series data by using a machine learning algorithm.

You can use CREATE SNOWFLAKE.ML.ANOMALY_DETECTION to create and train the detection model, and then use the <model_name>!DETECT_ANOMALIES method to detect anomalies.

Syntax:

CREATE [ OR REPLACE ] SNOWFLAKE.ML.ANOMALY_DETECTION <name>(
[ SERIES_COLNAME => '<series_column_name>' , ]
INPUT_DATA => <reference_to_training_data>,
TIMESTAMP_COLNAME => '<timestamp_column_name>',
TARGET_COLNAME => '<target_column_name>',
LABEL_COLNAME => '<label_column_name>'
)

https://docs.snowflake.com/en/user-guide/ml-powered-anomaly-detection#label-analysis-anomaly-detection-examples

2. CREATE FORECAST

Creates a new forecast model from the training data you provide or replaces the forecast model of the same name.

Syntax:

CREATE [ OR REPLACE ] SNOWFLAKE.ML.FORECAST [ IF NOT EXISTS ] <model_name>(
INPUT_DATA => <input_data>,
[SERIES_COLNAME => '<series_colname>',]
TIMESTAMP_COLNAME => '<timestamp_colname>',
TARGET_COLNAME => '<target_colname>')
[ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' , … ] ) ]
[ COMMENT = '<string_literal>' ]

https://docs.snowflake.com/en/user-guide/ml-powered-forecasting#label-analysis-forecasting-examples

Get details about trained model with below executions:

<model_name>!EXPLAIN_FEATURE_IMPORTANCE();

Returns the relative feature importance for each feature used by the model.

3. CREATE SECRET

Creates a new secret in the current/specified schema or replaces an existing secret.


OAuth: Client Credentials Flow:

CREATE [ OR REPLACE ] SECRET [ IF NOT EXISTS ] <name>
TYPE = OAUTH2
API_AUTHENTICATION = <security_integration_name>
OAUTH_SCOPES = ( '<scope_1>' [ , '<scope_2>' ... ] )
[ ENABLED = { TRUE | FALSE } ]
[ COMMENT = '<string_literal>' ]



OAuth: Authorization Code Grant Flow:

CREATE [ OR REPLACE ] SECRET [ IF NOT EXISTS ] <name>
TYPE = OAUTH2
OAUTH_REFRESH_TOKEN = '<string_literal>'
OAUTH_REFRESH_TOKEN_EXPIRY_TIME = '<string_literal>'
API_AUTHENTICATION = <security_integration_name>;
[ ENABLED = { TRUE | FALSE } ]
[ COMMENT = '<string_literal>' ]



Basic Authentication:

CREATE [ OR REPLACE ] SECRET [ IF NOT EXISTS ] <name>
TYPE = PASSWORD
USERNAME = '<username>'
PASSWORD = '<password>'
[ ENABLED = { TRUE | FALSE } ]
[ COMMENT = '<string_literal>' ]

For more details: https://docs.snowflake.com/en/sql-reference/sql/create-secret

Sounds exciting to me, seems like Snowflake will eliminate the coding needs for ML model training and usage, so people with the least python coding knowledge can also work on it and utilize their expertise.

Cheers!!!

--

--

Suraj Deogade

Snowflake Certified Architect | Matillion(Certified) | AWS (Certified) | ETL- Talend/Snaplogic | Informatica MDM