Snowflake: The Definitive Guide by Joyce Kay Avila

Snowflake: The Definitive Guide by Joyce Kay Avila

Author:Joyce Kay Avila [Joyce Kay Avila]
Language: eng
Format: epub, pdf
Publisher: O'Reilly Media, Inc.
Published: 2022-09-24T16:00:00+00:00


If you need to cancel queries for a specific warehouse or user rather than the session, you’ll want to use the ALTER command along with ABORT ALL QUERIES instead of a system control function.

Creating SQL & Javascript User-defined Functions (UDFs) and using Session Variables

SQL functionality can be extended by SQL user Functions (UDF), Javascript UDFs, and session variables. We took a deep dive into both SQL and Javascript User Defined Functions in the previous chapter, Creating and Managing Snowflake Architecture Objects, so we’ll focus on learning more about session variables in this section.

Snowflake supports SQL variables declared by the user, using the SET command. These session variables exist while a Snowflake session is active. Variables are distinguished in a Snowflake SQL statement by a $ sign prefix and can also contain identifier names when used with objects. You must wrap a variable inside the identifier, such as IDENTIFIER($Variable), to use a variable as an identifier. Alternatively, you can wrap the variable inside of an object in the context of a FROM clause.

To see all the variables defined in the current session, use the SHOW VARIABLES command.

Some examples of session variable functions include:

SYS_CONTEXT and SET_SYS_CONTEXT



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.