Support Questions
Find answers, ask questions, and share your expertise

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

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

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

@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.

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.


New Contributor

yes, this works 

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

 Thanks

New Contributor

and I see, yes, i am using 2.3.3

New Contributor

Thank you very much!