snowflake.snowpark.functions.getvariable

snowflake.snowpark.functions.getvariable(name: str) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.39.1/src/snowflake/snowpark/_functions/scalar_functions.py#L516-L533)

Retrieves the value of a session variable by its name.

Parameters:
  • name (str) – The name of the session variable to retrieve.

  • _emit_ast (bool, optional) – A flag indicating whether to emit the abstract syntax tree (AST). Defaults to True.

Returns:

A Snowflake Column object representing the value of the specified session variable.

Return type:

Column

Example::
>>> result = session.create_dataframe([1]).select(getvariable("MY_VARIABLE").alias("RESULT")).collect()
>>> assert result[0]["RESULT"] is None
Copy
Language: English