Snowflake: New Features
Snowflake: New Features
2
- 20
C
Snowflake
E
8-D
-1
om y
w c
. cop
n o ot-
e -n
New Features i c
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
Mute/Unmute 3 -
2
Open the Chat window C-20
DE
8-
- 1Reactions and
om y
w c
. cop
n o ot- nonverbal feedback
i e
c o-n
e v
r 3-d
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma 1. Use drop-down to choose recipient
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
Your course name r t
a fla
m
u fromw
a
will be different s n o
a r .p ©S
whatnisk shown here
h a
ni s
ma
Join here each
day of the course
(link active about
30 minutes ahead)
3 -
2
- 20
E C
8-D
Click tile to view details -1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
Your course name r t
a fla
m
u fromw
a
will be different s n o
a r .p ©S
whatnisk shown here
h a
ni s
ma
Join here each
day of the course
(link active about
30 minutes ahead)
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
k ar ©
1 ha
n 3
nis
Type Snowflake ma Once logged in, you
will see the directory
account name,
on the left and the
username, and
Launcher tab on the
password here.
right.
The first time you log in, it may take several
2 minutes for the environment to load.
NOTE: this lab is COMPULSORY as objects used throughout the course are created in it,
so it must be completed first.
© 2023 Snowflake Computing Inc. All Rights Reserved 18
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
e -n
SNOWPARK PYTHON
i c
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
1 2 3-
2 3
Snowflake - 0
2Snowflake
SELECT * FROM …
E C Virtual Storage
Cloud
Services18-
D Warehouse Layer
-
Snowpark Connector / (JDBC or Python) om y SQL Engine
w c
. cop
Snowpark
n o ot- JVM
SDK/Secure
SDK
i ce -n Sandbox
rv 3-do
Row 1, 2, 3, 4…
e
s 2
y @ 2 0
Client
r t h ke
m a fla
s u ow
. p a Sn Server
k ar ©
1
an 2 3
i s h
a n
Snowpark SDK m Cloud Services Virtual Warehouse
• Converts language specific code • Compiles queries • Language specific UDF server
to SQL • Generates execution plan • Runs in secure sandbox
• Sends query to Snowflake • Coordinates with virtual warehouse • Executes SQL
• Serializes response to language • Executes UDFs/UDTFs and Stored
specific objects Procedures
• Can include packages from a stage
© 2023 Snowflake Computing Inc. All Rights Reserved 25
SNOWPARK DATAFRAMES
The core abstraction (class) in Snowpark is the DataFrame
● Optimized data structure conceptually like a table (2D matrix of rows/columns of datatypes)
3 -
0 2
○ Tables, views, and result sets - 2
E C
● Commonly used in programmatic paradigms for working with relational 8- D datasets
- 1
om y
○ Spark, Pandas
w c
. cop
n o ot-
i ce -n
● Includes methods (prebuilt routines or functions) toeroperate v -do on its data called transformations
@ s 23
y 2 0
● Enables powerful and flexible manipulation aof rthstructured
ke data
u m wfla
● Snowpark executes the transformation a s no“lazily”. Transformations aren’t sent to the Snowflake account
a r.p ©S
logic
nk
as SQL until the client code encounters
h a an action. Actions might be:
nis
ma
○ Show me some rows (my_dataframe.show(12))
○ Write the transformed data to a table (my_df.save_as_table(...))
○ Create a Snowflake view from the transformed data (my_df.create_or_replace_view(....))
○ Bring the data back to me, the client (my_df.collect(...))
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
from snowflake.snowpark import Session 2
- 20
E C
8-D
from snowflake.snowpark.functions import *
-1
session = Session.builder.configs(my_config_file).create() o m y
w c
. cop
n o o t -
(session.table("MY_DB.MY_SCHEMA.CUSTOMER) i ce -n Create (wait for an action-lazy)
rv
e 23-d o
.filter(lower(col("CUST_NAME")).like("john%")) s
@ 20
t y
h ke
r
a fla
.select( m
u ow
s
a Sn
. p
col("CUSTKEY") k ar © Transformations (wait for an action - lazy)
an
i s h
,col("CUST_NAME") a n
m
,col("ACCT_BALANCE))
Action (SQL created from create through
.sort(col(ACCT_BALANCE").desc())
all the transformations and then sent to
.create_or_replace_temp_view("THE_BOBS") Snowflake account - eager)
)
© 2023 Snowflake Computing Inc. All Rights Reserved 29
SNOWPARK
UDFS AND UDTFS ● Capabilities extended by creating and using
UDFs and UDTFs
● Serialized from the client to the Snowflake
account at runtime 3 -
0 2
- 2
C
E as any other UDF or UDTF
● Executed-Djust
1 8
● Created - with
o m y
w c
. cop
n o○ oSQL
t - CREATE FUNCTION statements (already
i ce -n
e rv 3-do covered)
@ s 2
y
h ke 2 0
r t
a fla
○ programmatic functions (Java, Scala, or Python)
m
u ow on the client side
s
a Sn
. p
kar © ● This visual shows Python but the same
n
isha
n architecture is used for Java & Scala UDFs
ma
and UDTFs
● Python UDFs and UDTFs get the added
advantage of access to many useful library
packages managed by Anaconda
y @ 0
OVERVIEW t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
Run custom Java, Scala, or Python code inside Snowflake bringing compute
- closer to the data.
2 3
- 20
E C
8-D
● User-defined Functions (UDFs) -1
om y
w c
. cop
○ Invoked in SELECT statements and predicate clauses n o ot-
i ce -n
e rv 3-do
○ Developed in SQL, JavaScript, Java, or Python @ s (GA 2 for all accounts regardless of provider or edition)
h y e2 0
a t
r ak account (No SQL, DDL or DML)
○ No access to or interaction with your Snowflake u m wfl
a s no
SQL UDFs & UDTFs allow and require a r.p a©single
S SELECT statement. Other types of UDFs & UDTFs do not have
k
n database operations.
h
access to an API that can perform a
ni s
a
m tabular (UDTFs)
○ Can be scalar (UDFs) or
Run custom Java, Scala, or Python code inside Snowflake bringing compute
- closer to the data.
2 3
- 20
E C
8-D
● Stored Procedures -1
om y
w c
. cop
○ Invoked using a CALL command n o ot-
i ce -n
e rv -do
○ Can be anonymous (invoke with EXECUTE IMMEDIATE s 2 3 in Snowflake Scripting or a CALL command
y @ 20
that includes WITH in the definition for allarother th kelanguages)
u m wfla
a s no
○ Developed in Snowflake Scripting, a r.pJavaScript,
© S Java, Scala, or Python
n k
h a account for SQL, DDL, or DML
○ Full access to your Snowflake
ni s
ma
○ Snowflake Scripting supports both scalar and tabular Stored Procedures (others do not)
3 -
2
20
1. Build with your tools OR
inside Snowflake C-
E
8-D
-1
om y
public class MyClass {
w c
. cop
o ot-
public static double myCustomFunctions(String
n
s)
ce -n
{
/*
i
rv 3-do
e
* Let it snow!
s 2
*/
y @ 2 0
h ke
return rval;
}
}
r t
a fla
m
u ow
s
a Sn
. p
k ar ©
n
a into Snowflake stage
i s h
2. Deploy .jar/.py JVM /
n
ma Python
.jar / .py
3. Bind and use in Snowflake
y @ 0
(PYTHON) t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
Processing Engine
a r.p ©S Python code uploaded to a stage
nk
h a
nis
ma
ce -n
TABLE FUNCTIONS
i
rv 3-do
e
s 2
y @ 2 0
r t h ke
m a fla
s u ow
(PYTHON) nisha
nk
.
ar ©
p a Sn
ma
def end_partition(self):
pass
$$;
ce -n
STORED PROCEDURES
i
rv 3-do
e
s 2
y @ 2 0
r t h ke
m a fla
s u ow
(PYTHON) nisha
nk
.
ar ©
p a Sn
ma
Snowpark
© 2023 Snowflake Computing Inc. All Rights Reserved 48
● Create an in-line stored procedure or a stored
PYTHON procedure from a .py file or .zip file
STORED PROCEDURES ○ Upload file(s) to a stage
● Requires the latest Snowpark Python library,
CREATE PROCEDURE myProc (from_table STRING,
to_table which installs additional3 - third-party
STRING,
0 2
count INT) dependencies - 2
E C
RETURNS STRING D
8- data in Snowflake, use the Snowpark
LANGUAGE PYTHON ● To access- 1
RUNTIME_VERSION = '3.8'
om y
w c
. copAPIs (session object)
library
PACKAGES = ('snowflake-snowpark-python')
n o ot-
HANDLER = 'run' i ce -○ n No creating new Session objects
e v
r 3-d o
AS
@ s 2
$$ y
h ke 2 0 ● Specify third-party Anaconda packages to install
def run(session, from_table, to_table, count): r t
a fla
m
u ow
(session.table(from_table)
a s n when you create Python stored procedures
.limit(count).
a r.p ©S
nk ● Snowpark API Restrictions:
write
h a
.save_as_table(to_table)
nis
) ma ○ session.file.get(...) and
return "SUCCESS"
$$; session.file.put(...)
only work between /tmp and the stage
call MYPROC ('BIRTH_AND_CENSUS',
'BIRTH_AND_CENSUS_COPY', ○ Cannot use:
2);
session.sql("GET…") or
© 2023 Snowflake Computing Inc. All Rights Reserved
session.sql("PUT...") 49
CALL WITH ANONYMOUS
PROCEDURE (preview) ● Stored Procedure option for JavaScript,
Java, Scala, and Python
WITH MY_ANON_SP AS PROCEDURE(ARG1 STRING, ARG2
STRING) ○ Snowflake Scripting has anonymous blocks
3 -
RETURNS STRING
0 2
● More narrow 2
- scope than TEMP procedures
LANGUAGE PYTHON
E C
-- Java, Scala, Python, or JavaScript D
8-procedures exist for the life of the
PACKAGES = ('snowflake-snowpark-python')
○ TEMP - 1
om y
HANDLER = 'my_handler_func' . c
w t-c o p
Snowflake session
n o o
AS
ce -n
i d●o Scope is the life of a single statement
$$ rv
e 23-
s
@ 20
def my_handler_func(session, arg1,arg2):
t y
h ke ● No requirement for role to have CREATE
user = (session r
a fla
m
u ow
.sql("SELECT CURRENT_USER()") a s n PROCEDURE privilege on the schema
p
r. © S
.collect()[0][0] k a
an ○ The procedure runs with the creator/caller's rights
) is h
n
ma
return f"{arg1} {arg2} {user}"
● Procedure body has access to the Snowflake
$$
CALL MY_ANON_SP('HELLO','WORLD'); session, session variables, and
parameters
MY_ANON_SP gone after
● Same API restrictions as named procedures
statement executes
All one single statement
© 2023 Snowflake Computing Inc. All Rights Reserved 50
LAUNCH YOUR JUPYTER ENVIRONMENT
● Student Jupyter environments take a few minutes to provision on initial login – do this now!
3 -
0 2
● Use the account, username and password you have been using 2
C- in previous lab work
DE
● Jupyter lab URL: https://labs.snowflakeuniversity.com/ - 1 8-
m o py
. c
w t-co
o
n no
e
ic do-
rv
e 23-
s
@ 20
t y
h ke
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
@ 0
FOR DATA SCIENCE t y
h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
C- predictions
data lake DATAFRAME: training data SPROC(): E UDF(
________ ________ 8-D
-1
Max_batch_size = n
________ ________
om y ________
________ ________
w c
. cop Stage ________
________ ________
n o ot- ________
i ce -n
e rv 3-do ):
@ s 2
y
hMedium 2 0
r t k e Snowpark-
a fla optimized
multi-node
standard
m
u ow warehouse
inference data standard
warehouse s
a Sn warehouse
. p
k ar ©
n
isha
n
ma
3-
Prepare & Transform Pre-Built Model Inference
2
- 20
E C predictions
8-D
data lake DATAFRAME: UDF(
________
-1 Max_batch_size = n
________
om y ________
________
w c
. cop ________
n o ot-
________
i ce -n ________
Stage OR rv
e - d o
s 23
):
y @ 2 0
r t h ke
m a fla multi-node
standard
s u ow standard
warehouse
. p a Sn
ar ©
warehouse
nk
isha
n inference data
ma
ML Inference Tip
Speed up inference using Vectorized UDFs
to process rows in batches & cachetools to
cache model load from stage
y @ 0
WAREHOUSES t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
-
16X 2 3
20
memory per
10X
8-D
E C-
- 1
m y cache
. c o p
node w
o ot- co
n
e -n
i c
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
Effortless execution of memory- m
u ow Accelerate subsequent run
s
intensive operations ar.pa ©Sn execution
nk
ha
Bring ML training,isin-memory analytics Provide speedup when cached
a n
m
(e.g. correlations) artifacts (Python packages,
or other memory-intensive operations intermediate results, JARs, etc) are
inside Snowflake’s secure Python/Java reused on subsequent runs
sandbox.
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
XS S M L s
XL r.pa 2XL n 3XL 4XL 5XL 6XL
a © S
nk
h a
nis
ma
● Snowpark-optimized warehouses use nodes that have 4X the CPUs and 16X the
memory as a node in a standard warehouse
ce -n
WITH A PYTHON
i
rv 3-do
e
s 2
y @ 2 0
r t h ke
m a fla
s u ow
FUNCTION OR PROCEDURE nisha
nk
.
ar ©
p a Sn
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
Transformed Data
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r
a at
Scoped URL um wfl
a s no Python Code
Unstructured Data
a r.p ©S (UDF, UDTF, Stored Procedure)
nk
h a
ni s
ma SnowflakeFile
Machine Learning
.open(file_path) Results
# custom code
# ...
# ...
3 -
Image 2
Optical0Character
- 2
C
E Recognition
Classification D
8-
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
ce -n
DATA INGESTION
i
rv 3-do
e
s 2
y @ 2 0
r t h ke
m a fla
s u ow
OPTIONS
nisha
nk
.
ar ©
p a Sn
ma
Firehose
CONFIG
3 -
2
- 20
E C
8-D
JSON or -1
om y
Avro
w c
. cop
REST
Records
n o ot-
Snowflake
i ce -n
Connector
e rv 3-do
@ s 2 File Data
y
h ke 2 0
r t
a Internal
m f l a Snowpipe
u
s now Stage
p a
ar. ©S
Service
Kafka Kafkaank Snowflake
i s h
Cluster n
Connect
a
Database
mCluster
y @ 0
OVERVIEW t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C API }
{ REST
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar © { REST API }
n
isha
n
ma
Snowflake provided
No staged files or
JAR incorporating the
PIPE needed
Ingest SDK
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y 2 0
Simplified Workmawith rth akeStreaming Native to Snowflake’s
u w f l
Architecture a s Data
n o Easily Data Cloud
r . p ©S
ka
n
No more separation of isha Serverless ingestion and Expanding ecosystem in the Data
n
streaming and batch data ma automated transformation with Cloud with consistent and strong
pipelines easy joins security & governance
y @ 0
DETAIL t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
SAMPLE CODE
Snowflake
native FDN file
format
* It is difficult to estimate Snowpipe Streaming costs due to multiple factors such as the size of records, data
types, etc. Testing to establish baselines is recommended.
● Displays the amount of data loaded and timestamp of the Snowpipe- Streaming client calls
2 3
● Latency for the view may be up to 120 minutes - 20
C E
8- D
● Note that there can be multiple events per second listed- 1
om y
○ Credits are consumed only by the actual time spent, not w c
.bycthe
o p number of events
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
k ar ©
an
i s h
a n
m
● Displays the number of rows and bytes migrated and credits used for - migration from
intermediary file format => Snowflake’s native FDN file format -2023
E C
● Latency for the view may be up to 12 hours 8 -D
1 -
● File migration may not always occur or may be pre-empted om y
w c
. cop by clustering or other DML
n o ot-
operations i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
k ar ©
an
i s h
a n
m
● Use fewer clients that write more data per second via the Ingest API-
2 3
○ insertRows will be more performant and cost-effective than calling -insertRow 20 multiple times as less
E C
time spent on locks 8 -D
-1
● Anti-pattern: many clients sending small amounts of.cdata om py
o w t-co
e n no
rv ic do-
● Pass values for the TIME, DATE and TIMESTAMP s e 23- columns as a supported type from the
y @ 20
r t h ke
java.time package m a fla
s u ow
. p a Sn
k ar ©
● Use OnErrorOption.CONTINUE an and manually check the return value from insertRows
i s h
a n
for potential ingestion errors
m for better performance
@ 0
PIPELINES t y
h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
0 2
Integration
- 2
E C
8- D
-1
om y Aggregated Data
w c
. cop data
n o ot- scientist
Snowpipe i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
Batch copy
r t
a fla
m
Ingested su ow BI
Snowflake
a n Enriched/ Modeled
r.p ©S
Ingest tool transformation
Stage
k a
data cleansed tables
an data etc.
ish
n
ma
Data
analyst
Modeled
views
(secure)
3 -
● Track change data capture (CDC) records for views 2
- 20
E C
○ Includes secure views (not materialized views) - useful for data8sharing -D scenarios
-1
○ Build streams on views with joins across multiple tables com py
w . co
n o ot-
i ce -n
e rv 3-do
● Change tracking must be enabled in the underlying @ s 2 tables
h y e2 0
a t
r ak
○ Creating a stream adds hidden metadata u f
m columnsl to the source table(s)
a s now
a r.p ©S
nk
● Currently, streams are limited h a to views that satisfy the following requirements:
ni s
ma
○ All of the underlying tables must be native tables
○ GROUP BY, QUALIFY, LIMIT not supported
○ The view may only apply the following operations:
Projections, filters, inner or cross joins and UNION ALL
@ s 2
y
h ke 2 0
r t
CREATE STREAM bird_sightings_s ma fla
s u ow
ON VIEW bird_sightings_vw; . p a Sn
k ar ©
an
i s h
n SIGHTINGS>
<insert row into BIRDS and
a
m
select * from bird_sightings_s;
REFRESH 3 -
2
SCHEDULE - 20
E C
8-D
-1
om y
w c
. cop SQL
n o ot-
COMPUTE
i ce -n DETERMINES
RESOURCE e rv 3-do REFRESH
@ s 2
y
h ke 2 0 MODE
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
DECLARATIVE
SQL
DEFINITION
3 -
● Some query constructs are not currently supported in dynamic -tables, e.g. 2
20
E C
○ Most non-deterministic functions 8-D
-1
○ UDFs o m y
w c
. cop
n o o t -
○ Shared tables i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
● Setting the lag time in DAGs r t
a fla
m
u ow
s
a Sn(a target lag)
o Specify a target “freshness” for the . pdata
k ar ©
an
o The automated process sets i s hup refreshes so that the data in the dynamic table is kept up to date within
a n
this target m
o No VWH compute is consumed if there are no changes in upstream objects (tables, DTs)
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot- SCREEN REFRESH
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
@ 0
OBSERVABILITY t y
h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
y @ 0
SNOWFLAKE t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
y @ 0
NOTIFICATIONS t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
● An integration is a Snowflake object that provides an i ce -n
interface between Snowflake and third-party
e rv -d o
s 3
services y @ 202
r t h ke
m a fla
s u channel
o w
● Outbound “push” notification integrations p a Sn Snowflake-generated messages to external public
a r. ©
nk
cloud vendor services (messageaqueues or email) for delivery
i s h
a n
m
● Type = QUEUE and direction = OUTBOUND => (AWS SNS, Google Pub/Sub, Azure Event Grid)
○ Offer more delivery options (SMS, email, and more) but more complex to configure
3 -
● Supported on 0 2AWS, Azure, and GCP
- 2
E C
○ utilizes8 D
- the cloud provider’s messaging service
-1
o m y
w c
. cop
●
n o t -
o Configurable for both serverless tasks and
ce
i do -n
rv
e 23- user-managed tasks
s
@ 20
t y
h ke
r
a fla
m
u ow
s
a Sn
a r . p ©
● Delivers error message in JSON payload
nk
isha
n
ma ● CREATE or ALTER a task including an error
integration to bind to the integration
Email body
y @ 0
ALERTS t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
CREATE OR REPLACE ALERT test_alert-202
E C
WAREHOUSE = my_warehouse 8 -D
- 1
SCHEDULE = '1 minute' om y
w c
. cop USE CRON OR MINUTE
IF( EXISTS( n o ot-
i ce -n
SELECT data_value e rv 3-do
@ s 2
CONDITION
FROM data_table y
h ke 2 0
r t
a fla
WHERE data_value m
u ow > 200
a s n
a r .p ©S
) nk
h a
) ani s
m
THEN
CALL SYSTEM$SEND_EMAIL(...);
ACTION
y @ 0
WITHIN SNOWSIGHT t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
@ 0
OPTIMIZATION t y
h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
y @ 0
SERVICE t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
● EQUALITY 3 -
2
● SUBSTRING - 20
E C
● GEO 8-D
-1
om y
w c
. cop
Examples: n o ot-
i ce -n
e rv 3-do
@ s 2
y 2 0
hallksupported
● Add EQUALITY search optimization for a r t e columns in t1:
u m wfla
as Sno
ALTER TABLE t1 ADD SEARCHr.pOPTIMIZATION;
k a ©
an
i s h
a n
● m
Add EQUALITY optimization to c1 and a subpath of c5, and a
GEO optimization to c3 and c4:
ALTER TABLE t1 ADD SEARCH OPTIMIZATION ON
EQUALITY(c1, c5:user:uuid), GEO(c3, c4);
y @ 0
SERVICE t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
ce -n
IDENTIFYING ELIGIBLE
i
rv 3-do
e
s 2
y @ 2 0
r t h ke
m a fla
s u ow
QUERIES nisha
nk
.
ar ©
p a Sn
ma
y @ 0
ENABLING THE SERVICE t h ke 2
r
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
1 - 100 Original size of the virtual warehouse times the number specified
ce -n
MONITORING
i
rv 3-do
e
s 2
y @ 2 0
r t h ke
m a fla
s u ow
QAS ACTIVITY
nisha
nk
.
ar ©
p a Sn
ma
t h ke 2
USING CONSTRAINT SUPPORT . p
s
m
u ow
a Sn
r
a fla
kar ©
n
isha
n
ma
● The Snowflake 3 -
query planner can
2
- 20
leverageDEthe C primary key (PK) / foreign
8 -
key (FK)
- 1 and uniqueness constraints to
o m y
w c
. cop unnecessary joins
identify
o - n not
e
ic do-
rv
e 23-
s
@ 20 ● Set a RELY property on these constraints
t y
h ke
r
a fla
u m w to tell the planner to evaluate for join
a s no
a r.p ©S elimination
nk
isha
n
ma ● Eliminated joins improve performance!
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
With CONSTRAINT…RELY
enabled the unnecessary
join is eliminated!
NOTE: when a Python worksheet runs in Snowsight, an anonymous stored procedure runs
the code and generates queries that execute the Snowpark commands in the code.
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
Works with all
w c
. cop
your favorite n o ot-
i ce -n
Python libraries e rv 3-do Go straight from
@ s 2 Python script to
(pandas, Altair, y
h ke 2 0
NumPy, plotly, r t
a fla web app
m
u ow
scikit-learn, etc) s
a Sn
. p
kar ©
n
isha
n
ma
3 -
2
- 20
E C
8-D
-1
om y
w c
. cop
n o ot-
i ce -n
e rv 3-do No need to write
@ s 2 a backend,
y
h ke 2 0
r t
a fla handle HTTP
Adding a widget m
u ow
s
a Sn requests, write
is the same as . p
kar © HTML, CSS,
declaring a n
variable isha JavaScript, ...
n
ma
3 -
2
- 20
Instantiate E C
8-D
-1
db/model
connectors only om y
w c
. cop
once
n o ot-
i ce -n
e rv 3-do
@ s 2
y
h ke 2 0
r t
a fla
m
u ow
s
a Sn
. p
Store query kar ©
n
results in cache isha
n
ma