Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify which database the user is using in hive CLI ?

Tags:

hive

Is there any way to identify which database the user is using while using the command line interface ?

like image 619
Nithin K Anil Avatar asked Aug 01 '13 06:08

Nithin K Anil


People also ask

How do you know which database is being used in hive?

To list out the databases in Hive warehouse, enter the command 'show databases'. The database creates in a default location of the Hive warehouse. In Cloudera, Hive database store in a /user/hive/warehouse.

Which of the following command will change the hive prompt to show the currently used database?

current. db=true will show the current DB for current hive session only, but if we update the .


2 Answers

To know which database user in

hive> set hive.cli.print.current.db=true

or start hive with

hive --hiveconf hive.cli.print.current.db=true

then the prompt will display

hive (db_name)>
like image 157
Nithin K Anil Avatar answered Sep 19 '22 18:09

Nithin K Anil


There are two ways to know the current database. One temporary in cli and second one is persistently.

1) in CLI just enter this command: set hive.cli.print.current.db=true;

2) In hive-site.xml paste this code:


    <property>
    <name>hive.cli.print.current.db</name>
    <value>true</value>
    </property>
     

 

In second scenario, you can automatically display the Hive dabatabase name when you open terminal.

like image 35
Venu A Positive Avatar answered Sep 21 '22 18:09

Venu A Positive