Just get column names from hive table

前端 未结 3 1696
独厮守ぢ
独厮守ぢ 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:07

    If you simply want to see the column names this one line should provide it without changing any settings:

    describe database.tablename;
    

    However, if that doesn't work for your version of hive this code will provide it, but your default database will now be the database you are using:

    use database;
    describe tablename;
    

提交回复
热议问题