SHOW USERS (Databricks SQL)

Lists the users that match an optionally supplied regular expression pattern. If you don’t supply a pattern, the command lists all of the users in the system.

Syntax

SHOW USERS [ LIKE pattern_expression ]

Parameters

  • pattern_expression

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

    • The * character is used at the start and end of a pattern to match on a substring.
    • The * character is used only at end of a pattern to match the start of a username.
    • The | character is used to separate multiple different expressions, any of which can match.
    • The pattern match is case-insensitive.

Examples

-- Lists all users.
SHOW USERS;
+------------------+
|              name|
+------------------+
| user1@example.com|
| user2@example.com|
| user3@example.com|
+------------------+

-- Lists users with name containing with string pattern `SEr`
SHOW USERS LIKE '*SEr*';
+------------------+
|              name|
+------------------+
| user1@example.com|
| user2@example.com|
| user3@example.com|
+------------------+

-- Lists users with name containing 1 or `3`
SHOW USERS LIKE '*1*|*3*';
+------------------+
|              name|
+------------------+
| user1@example.com|
| user3@example.com|
+------------------+