Working with data security commands
We covered data security commands such as GRANT
, REVOKE
, and DENY
(Hive Metastore only) in significant detail in Chapter 4, The Security Model. If you want to consult the official command reference for these commands, visit https://docs.databricks.com/sql/language-manual/index.html#security-statements. In this section, we will focus on an advanced bit of security programming and learn about row-level and column-level permissions in Databricks SQL.
Dynamic view functions
At the time of writing, Databricks SQL does not have table bindings for expressing row-level or column-level permissions for users and user groups. Instead, it uses the concept of views and dynamic view functions.
Databricks SQL exposes two dynamic view functions:
Current_user()
: This returns the username of the user executing the query.is_member(group_name)
: This returns a Boolean value indicating whether the current user is a member of the group.
For...