Just get column names from hive table

前端 未结 3 1710
独厮守ぢ
独厮守ぢ 2020-12-29 01:09

I know that you can get column names from a table via the following trick in hive:

hive> set hive.cli.print.header=true;
hive> select * from tablename         


        
3条回答
  •  抹茶落季
    2020-12-29 02:00

    use desc tablename from Hive CLI or beeline to get all the column names. If you want the column names in a file then run the below command from the shell.

    $ hive -e 'desc dbname.tablename;' > ~/columnnames.txt
    

    where dbname is the name of the Hive database where your table is residing You can find the file columnnames.txt in your root directory.

    $cd ~
    $ls
    

提交回复
热议问题