You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by "Ryan P (JIRA)" <ji...@apache.org> on 2015/03/08 01:39:38 UTC

[jira] [Comment Edited] (SENTRY-620) Allow database prefix in GRANT ON TABLE statement.

    [ https://issues.apache.org/jira/browse/SENTRY-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14351846#comment-14351846 ] 

Ryan P edited comment on SENTRY-620 at 3/8/15 12:39 AM:
--------------------------------------------------------

Hey [~johndee] this functionality actually does exists you just need to wrap the table qualifier in back-ticks. 

i.e.
0: jdbc:hive2://ryan-p-2.ent.cloudera.com:100> grant select on `default.testpatch` to role test;
No rows affected (0.343 seconds)
0: jdbc:hive2://ryan-p-2.ent.cloudera.com:100> show grant role test;
+-----------+------------+------------+---------+-----------------+-----------------+------------+---------------+-------------------+----------+--+
| database  |   table    | partition  | column  | principal_name  | principal_type  | privilege  | grant_option  |    grant_time     | grantor  |
+-----------+------------+------------+---------+-----------------+-----------------+------------+---------------+-------------------+----------+--+
| default   | test       |            |         | test            | ROLE            | *          | false         | 1425774500157000  | --       |
| default   | server1    |            |         | test            | ROLE            | *          | false         | 1421854212609000  | --       |
| default   | testpatch  |            |         | test            | ROLE            | select     | false         | 1425774558034000  | --       |
+-----------+------------+------------+---------+-----------------+-----------------+------------+---------------+-------------------+----------+--+
3 rows selected (0.217 seconds)

*Note this is also true of roles with special characters such as `role-name`


was (Author: ryan p):
Hey [~johndee] this functionality actually does exists you just need to wrap the table qualifier in back-ticks. 

i.e.
0: jdbc:hive2://ryan-p-2.ent.cloudera.com:100> grant select on `default.testpatch` to role test;
No rows affected (0.343 seconds)
0: jdbc:hive2://ryan-p-2.ent.cloudera.com:100> show grant role test;
+-----------+------------+------------+---------+-----------------+-----------------+------------+---------------+-------------------+----------+--+
| database  |   table    | partition  | column  | principal_name  | principal_type  | privilege  | grant_option  |    grant_time     | grantor  |
+-----------+------------+------------+---------+-----------------+-----------------+------------+---------------+-------------------+----------+--+
| default   | test       |            |         | test            | ROLE            | *          | false         | 1425774500157000  | --       |
| default   | server1    |            |         | test            | ROLE            | *          | false         | 1421854212609000  | --       |
| default   | testpatch  |            |         | test            | ROLE            | select     | false         | 1425774558034000  | --       |
+-----------+------------+------------+---------+-----------------+-----------------+------------+---------------+-------------------+----------+--+
3 rows selected (0.217 seconds)


> Allow database prefix in GRANT ON TABLE statement. 
> ---------------------------------------------------
>
>                 Key: SENTRY-620
>                 URL: https://issues.apache.org/jira/browse/SENTRY-620
>             Project: Sentry
>          Issue Type: Bug
>            Reporter: Johndee Burks
>            Priority: Minor
>
> Currently you get the following error if you do the following command. 
> {code}
> 0: jdbc:hive2://jrepo2-1.ent.cloudera.com:100> grant select on table testdatabase.j1 to role jrole;
> Error: Error while compiling statement: FAILED: ParseException line 1:29 mismatched input '.' expecting TO near 'testdatabase' in grant privileges (state=42000,code=40000)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)