snowflake.snowpark.functions.invoker_role

snowflake.snowpark.functions.invoker_role() Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.39.1/src/snowflake/snowpark/_functions/scalar_functions.py#L381-L400)

Returns the name of the role that was active when the current stored procedure or user-defined function was called.

Parameters:

_emit_ast (bool, optional) – Whether to emit the abstract syntax tree (AST). Defaults to True.

Returns:

A Snowflake Column object representing the name of the active role.

Return type:

Column

Example:

>>> df = session.create_dataframe([1])
>>> result = df.select(invoker_role()).collect()
>>> assert len(result) == 1
>>> assert isinstance(result[0]["INVOKER_ROLE()"], str)
>>> assert len(result[0]["INVOKER_ROLE()"]) > 0
Copy
语言: 中文