Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive, mail # user - Handling hyphens in table/database/usernames


Copy link to this message
-
Re: Handling hyphens in table/database/usernames
Sriram Krishnan 2011-11-01, 14:56
Excellent – that seems to work as I want. I tried every combination but the back tick :).

Thanks again,
Sriram

From: Jander g <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Date: Tue, 1 Nov 2011 00:01:59 -0700
To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Subject: Re: Handling hyphens in table/database/usernames

OK, I see. You can use "grant all on database default to user `sri-krish`;" to finish your work.
On Tue, Nov 1, 2011 at 2:15 PM, Sriram Krishnan <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote:
Thanks Jander.

Not supporting "-" in database/table names is fine,  we can work around that. What about usernames? Like I said, our main problem is that we have a user with a hyphenated username – and I would like to figure out if there is a "clean" way to add him to a certain role, or assign him specific privileges using a grant statement (see the 2nd example).

I have figured out a hacky way to do this, which is to update the metastore directly – the DB_PRIVS and ROLE_MAPS tables can be updated directly for this particular user. But I was hoping to use the Hive command-line, and not update the metastore directly.

Cheers,
Sriram

ps: Not a huge deal, but is there a reason why Hive won't support hyphens in database/table names?

From: Jander g <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Reply-To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Date: Mon, 31 Oct 2011 23:05:13 -0700
To: "[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>>
Subject: Re: Handling hyphens in table/database/usernames

Hive does not support '-' as a database name, which pattern is "[\\w_]+", so you can use '_' instead

On Tue, Nov 1, 2011 at 9:29 AM, Sriram Krishnan <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote:
Hi,

Does anyone know how to handle hyphens in any of the following? Specifically, we have a user with a hyphenated username – and I can't figure out a way to add him to a certain role. No amount of escaping my hyphen seems to help. I am using Hive version 0.7.1.

Any ideas would be appreciated.

Thanks,
Sriram

hive> create database if not exists sri-krish;
FAILED: Parse Error: line 1:33 mismatched input '-' expecting EOF near 'sri'

hive> grant all on database default to user sri-krish;
FAILED: Parse Error: line 1:41 mismatched input '-' expecting EOF near 'sri'
--
Thanks,
Jander
--
Thanks,
Jander