- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to find out the roles / groups assigned to a schema / DB in Hive
- Labels:
-
Apache Hive
-
Apache Sentry
Created 02-10-2023 06:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I want to find out what are the roles / groups assigned to a DB / Schema in Hive, how I can get those details ? please suggest.
Thank you.
Regards,
PK
Created 02-17-2023 10:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PK,
If you have access to the Sentry Store backend use a query like this:
SELECT
r.ROLE_NAME,
g.GROUP_NAME,
p.*,
FROM_UNIXTIME(p.CREATE_TIME / 1000) as CREATE_TIME_DATE
FROM
SENTRY_ROLE r
INNER JOIN SENTRY_ROLE_GROUP_MAP rgm ON r.ROLE_ID = rgm.ROLE_ID
INNER JOIN SENTRY_GROUP g ON g.GROUP_ID = rgm.GROUP_ID
INNER JOIN SENTRY_ROLE_DB_PRIVILEGE_MAP rpm ON r.ROLE_ID = rpm.ROLE_ID
INNER JOIN SENTRY_DB_PRIVILEGE p ON p.DB_PRIVILEGE_ID = rpm.DB_PRIVILEGE_ID;
Hope it helps,
-JMP
Created 02-13-2023 10:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the specific version of HDP /CDH / CDP ?
Created 02-14-2023 04:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CDH 6.3
Created 02-14-2023 08:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use the following command reference
These are to be executed from Hive Beeline to view Role Privileges and Assignments
> SHOW ROLES;
List available roles
> SHOW CURRENT ROLES;
List roles assigned to current user/group
> SHOW ROLE GRANT GROUP <GROUP NAME>;
Lists the roles that are assigned to the specified group.
> SHOW GRANT ROLE <ROLE>;
Lists the permissions that have been granted to the specified role.
>SHOW GRANT ROLE <role name> ON <object type> <object name>
Lists the permissions that a role has on an object.
Created on 02-17-2023 09:52 AM - edited 02-17-2023 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for the reply, but if I know the role or group, I can easily get the details from above commands, but for a specific DB , if I want to find out what are the roles assigned, is there a way to do it ?
Assume, my schema name is schema1, how to find out the roles assigned to this schema ?
Thank you.
Regards,
PK
Created 02-17-2023 09:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@prakodi Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created 02-17-2023 10:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PK,
If you have access to the Sentry Store backend use a query like this:
SELECT
r.ROLE_NAME,
g.GROUP_NAME,
p.*,
FROM_UNIXTIME(p.CREATE_TIME / 1000) as CREATE_TIME_DATE
FROM
SENTRY_ROLE r
INNER JOIN SENTRY_ROLE_GROUP_MAP rgm ON r.ROLE_ID = rgm.ROLE_ID
INNER JOIN SENTRY_GROUP g ON g.GROUP_ID = rgm.GROUP_ID
INNER JOIN SENTRY_ROLE_DB_PRIVILEGE_MAP rpm ON r.ROLE_ID = rpm.ROLE_ID
INNER JOIN SENTRY_DB_PRIVILEGE p ON p.DB_PRIVILEGE_ID = rpm.DB_PRIVILEGE_ID;
Hope it helps,
-JMP
Created 02-17-2023 11:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much.
Regards,
PK
Created on 01-21-2025 12:45 PM - edited 01-21-2025 12:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @JoseManuel ,
Is there any possible query to have a similar result with Ranger (CDP 7.1.7 sp2)?
Regards,
Celso
Created 01-21-2025 04:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@CelsoC Welcome to the Cloudera Community!
As this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post. Thanks.
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
