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.

Beeline : Hive property to print current database name

Solved Go to solution

Beeline : Hive property to print current database name

When using HiveCLI, if we

SET hive.cli.print.current.db = true;

Then the command prompt for Hive CLI displays the current database name until the end of the session as shown below:

hive mydb >

I tried using the same property in Beeline but had no effect. Is there a different way of achieving this in Beeline ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Beeline : Hive property to print current database name

Super Mentor

@Dinesh Chitlangia

I did not try the following myswlf but looks promising:

In BeeLine in beeline mode use the --showDbInPrompt command line option instead.

As per: https://issues.apache.org/jira/browse/HIVE-13899

.

As per: https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients


--showDbInPrompt=[true/false] : Display the current database name in prompt. Default is false.

Usage: beeline --showDbInPrompt=true

View solution in original post

6 REPLIES 6
Highlighted

Re: Beeline : Hive property to print current database name

Super Mentor

@Dinesh Chitlangia

I did not try the following myswlf but looks promising:

In BeeLine in beeline mode use the --showDbInPrompt command line option instead.

As per: https://issues.apache.org/jira/browse/HIVE-13899

.

As per: https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients


--showDbInPrompt=[true/false] : Display the current database name in prompt. Default is false.

Usage: beeline --showDbInPrompt=true

View solution in original post

Highlighted

Re: Beeline : Hive property to print current database name

@Jay SenSharma - Thank you for prompt response.

I see this only works for Beeline version 2.3.0 and latest.

I am currently using 1.2.1 and thus this will have no effect. However, I appreciate your help. I will try for a workaround for version 1.2.1, if nothing else works I will upgrade to 2.3.0 and accept your answer.

Highlighted

Re: Beeline : Hive property to print current database name

Super Mentor

@Dinesh Chitlangia

Thank you. Yes, this flag is added later in beeline "--showDbInPrompt", Before that ( HIVE-14123 , fixed in 2.3.0) there was not option to display the database name.


Highlighted

Re: Beeline : Hive property to print current database name

New Contributor

yes, this works 

beeline --showDbInPrompt=true -u "jdbc:hive2://...."

 Thanks

Highlighted

Re: Beeline : Hive property to print current database name

New Contributor

and I see, yes, i am using 2.3.3

Highlighted

Re: Beeline : Hive property to print current database name

New Contributor

Thank you very much!

Don't have an account?
Coming from Hortonworks? Activate your account here