Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Capture SHOW PRIVILEGES into a TABLE

Capture SHOW PRIVILEGES into a TABLE

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

Re: Capture SHOW PRIVILEGES into a TABLE

Master Guru
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.