Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Capture SHOW PRIVILEGES into a TABLE

avatar
Explorer

How can I insert the SHOW statements results into a HIVE table please?

 

Something like: 

 

CREATE TABLE Capture_Previliges AS SHOW GRANT ROLE <ROLE_NAME>;

 

I want to capture this information into a table to further process and perform some audits please. If there isn't a simple way then what would be my options?

 

Want this below kind of info in a table:

 

0: jdbc:hive2://localhost:10000> show grant user ashutosh on table hivejiratable;
+-----------+----------------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+
| database  |     table      | partition  | column  | principal_name  | principal_type  | privilege  | grant_option  |   grant_time   | grantor  |
+-----------+----------------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+
| default   | hivejiratable  |            |         | ashutosh        | USER            | DELETE     | false         | 1398303419000  | thejas   |
| default   | hivejiratable  |            |         | ashutosh        | USER            | SELECT     | false         | 1398303407000  | thejas   |
+-----------+----------------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+

 

1 REPLY 1

avatar
Mentor
There's no current way to do this today, aside of scripting it by using the regular SHOW GRANT commands and then parsing the output into a file and then into a table.