snowflake.snowpark.functions.is_role_in_session¶
- snowflake.snowpark.functions.is_role_in_session(role: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
 Returns True if the specified role is granted to the current user and is currently in use; otherwise, returns False.
- Parameters:
 role (ColumnOrName) – A Column or column name containing the role name to check.
_emit_ast (bool, optional) – Whether to emit the abstract syntax tree (AST). Defaults to True.
- Returns:
 A Snowflake Column object representing the result of the check.
- Return type:
 
Example:
>>> df = session.create_dataframe([["ANALYST"], ["PUBLIC"], ["ACCOUNTADMIN"]], schema=["role_name"]) >>> df.select(is_role_in_session(df["role_name"]).alias("is_role_active")).collect() [Row(IS_ROLE_ACTIVE=False), Row(IS_ROLE_ACTIVE=True), Row(IS_ROLE_ACTIVE=False)]