IS_ORGANIZATION_USER_GROUP_IN_SESSION
functionsupportedAccounts, users, sessions, warehousesAssuming a role was imported from an organization user group, verifies whether the role is in the user’s active primary or secondary role hierarchy for the session. The function returns FALSE if the specified role is not linked to an organization user group.
Syntax
IS_ORGANIZATION_USER_GROUP_IN_SESSION( '<string_literal>' )
Parameters
| Name | Required | Description |
|---|---|---|
'string_literal' | required | The name of an role. |
Usage notes
- The IS_ORGANIZATION_USER_GROUP_IN_SESSION function is similar to the IS_DATABASE_ROLE_IN_SESSION and IS_ROLE_IN_SESSION functions. The following usage notes apply to all of these context functions:
- Use one syntax.
- Name syntax: Only one role name can be passed as an argument.
- The argument must be a string and use the same casing as how the role is stored in Snowflake. For details, see Identifier requirements.
- Column syntax: Only one column can be passed as an argument.
- The column must have a STRING data type.
- Specify the column as one of the following: column_name
- table_name.column_name
- schema_name.table_name.column_name
- database_name.schema_name.table_name.column_name
- Virtual columns: A virtual column, which contains the result of a calculated value from an expression rather than the calculated value being stored in the table, is not supported. Copy code SELECT IS_ROLE_IN_SESSION(UPPER(authz_role)) FROM t1; A virtual column is supported only when the expression has an alias for the column name: Copy code CREATE VIEW v2 AS SELECT authz_role, UPPER(authz_role) AS upper_authz_role FROM t2; SELECT IS_ROLE_IN_SESSION(upper_authz_role) FROM v2;
- Policies: If you use these functions with a masking policy or row access policy, verify that your Snowflake account is Enterprise Edition or higher. Snowflake recommends using this function when the policy conditions need to evaluate role hierarchy and inherited privileges.
- Result cache: If you use this function in a masking policy or row access policy and neither the policy nor the table or column protected by the policy change from a previous query, you can use the RESULT_SCAN function to return the results of a query on the protected table. The result cache applies when using the nonliteral syntax only.
- These functions cannot be used in the materialized view definition because the functions are not deterministic and Snowflake cannot determine what data to materialize.