SHOW GROUPS (Databricks SQL)

Lists the groups that match an optionally supplied regular expression pattern. If you don’t supply a pattern, the command lists all of the groups in the system. You can optionally supply an identifier to show only the groups a specific user or group belongs to.

Syntax

SHOW GROUPS { [ WITH {USER user | GROUP group} ] | [ LIKE regex_pattern ] }

Parameters

  • user

    Show only groups that contain the specified user.

  • group

    Show only groups that contain the specified group.

  • regex_pattern

    A limited regular expression pattern used to filter the results of the statement.

    • * at the start and end of a pattern matches on a substring.
    • * only at end of a pattern matches the start of a group.
    • | separates multiple regular expressions, any of which can match.
    • The pattern match is case-insensitive.

Examples

-- Lists all groups.
SHOW GROUPS;
+------------+
|        name|
+------------+
|      group1|
|      group2|
| collection1|
+------------+

-- Lists groups with name containing with string pattern `rou`.
SHOW GROUPS LIKE '*rou*';
+------------+
|        name|
+------------+
|      group1|
|      group2|
+------------+

-- Lists groups with user1 as a member.
SHOW GROUPS WITH USER `user1@example.com`;
+------------+
|        name|
+------------+
|      group1|
+------------+