Random Pass-Through Function (Snowflake)

Sigma’s Pass-Through Functions are a great way to extend your function library to virtually everything your data warehouse supports.

For example, you can generate random numbers using one (or more) Snowflake functions.

RANDOM will return a pseudo-random 64-bit integer.

Sigma Syntax: CallNumber("RANDOM")
Result: 7436033631431387521
– This result will update each time the query is executed

Coupling the above with Snowflake’s UNIFORM function allows you to specify a range.

Sigma Syntax: CallNumber("UNIFORM", 0, 9, CallNumber("RANDOM"))
Result: 2
– This result will update each time the query is executed

You can even create UDFs (User-Defined Functions) in Snowflake (using SQL, JavaScript, or Java) and call them in Sigma. These are very useful when working with iterative functions.

Notes:

  • You’ll need to use the proper Sigma Pass-Through function for the datatype you wish to return
    • CallNumber, CallText, CallLogical, etc.
  • Be sure to wrap the Snowflake function in quotes (“SNOWFLAKE_FX”)
2 Likes