โ05-11-2023 06:27 AM
I've been trying to check, via databricks SQL, which groups a user belongs to.
When I run SHOW GROUPS or SHOW USERS, everything is returned correctly.
However, when a try to run:
SHOW GROUPS WITH USER `user@domain.com`
Nothing is returned, but the user belongs to one of the existing groups.
What is the right way to execute this query and get the expected results?
โ05-22-2023 07:06 AM
Hey! The actual solution was to run SHOW GROUPS WITH USER as an administrator. This wasn't expected, since SHOW USERS and SHOW GROUPS doesn't require administrator privileges and there's nothing mentioned in the docs. Thanks!
โ05-13-2023 09:02 AM
@Marcelo Castroโ :
To show the groups that a user belongs to in Databricks using SQL, you can use the following query:
SELECT groupname FROM databricks_groups WHERE userid IN (SELECT userid FROM databricks_users WHERE username = 'user@domain.com')
This query uses the databricks_users and databricks_groups tables to get the userid associated with the username and then returns the group names associated with that userid. You can replace 'user@domain.com' with the username of the user you want to check. This should return the group names that the user belongs to.
Note that you will need the appropriate privileges to query the databricks_users and databricks_groups
tables.
โ05-21-2023 11:58 PM
Hi @Marcelo Castroโ
Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.
We'd love to hear from you.
Thanks!
โ05-22-2023 07:06 AM
Hey! The actual solution was to run SHOW GROUPS WITH USER as an administrator. This wasn't expected, since SHOW USERS and SHOW GROUPS doesn't require administrator privileges and there's nothing mentioned in the docs. Thanks!
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group