snowflake.snowpark.functions.is_database_role_in_session

snowflake.snowpark.functions.is_database_role_in_session(role_name: Union[snowflake.snowpark.column.Column, str]) Column[source]

Returns True if the specified database role is granted to the current user and is currently in use; otherwise, returns False.

Parameters:
  • role_name (ColumnOrName) – The name of the database role to check. Can be a string or a Column.

  • _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:

Column

Example::
>>> from snowflake.snowpark.functions import lit
>>> df = session.create_dataframe([1])
>>> result = df.select(is_database_role_in_session(lit("PUBLIC")).alias("is_db_role_active")).collect()
>>> assert len(result) == 1
>>> assert isinstance(result[0]["IS_DB_ROLE_ACTIVE"], bool)
Copy