Dustin V
Dustin V

Reputation: 336

Sentry grant select on only one table in database

I am using Cloudera 5.4.2 with Sentry and am successfully granting access to roles on databases. My challenge now is to have a group that can read only one table from a database that has many other tables. I have not been able to grant select on a specific table where the role does not have any permissions for the database. When looking at the Cloudera documentation I do not see an example of this and the wording around granting table access makes is sound straight forward.

Here is an example of what I would like to run to get role test access to the table private_table without having access to any other tables in the database testdb.

CREATE ROLE test;
GRANT ROLE test to group `test-group`;
GRANT SELECT ON TABLE testdb.private_table TO ROLE test;

Upvotes: 0

Views: 3571

Answers (1)

Mohit
Mohit

Reputation: 1

I also faced the same issue as in it granted the privileges for that table in default schema instead of "testdb" schema, every time I ran the following command:

GRANT SELECT ON TABLE testdb.test_table TO ROLE test;

I found a way to workaround this by doing this:

USE testdb;
GRANT SELECT ON TABLE test_table TO ROLE test;

However, since all Hive/Impala queries take DB.TBL schema, GRANT should also accept it.

Upvotes: 0

Related Questions