Hive - 获取列名称 [英] Hive - get column names

查看:127
本文介绍了Hive - 获取列名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从表中检索列名并将它们加载到另一个表或配置单元中的文本文件中?请让我知道我们是否可以做到这一点

Is it possible to retrieve column names from a table and load them into another table or a text file in hive? Please let me know if we can do this

推荐答案

没有OOTB功能允许这样做。但是,您可以使用 DESCRIBE awk 来实现该功能:

There is no OOTB feature which allows this. But you could use DESCRIBE with awk to achieve that :

bin/hive -S -e "use default; describe demo;" | awk -F" " '{print $1}' > ~/filename.txt

替换默认您可以使用数据库和表格进行操作。

Replace default and demo with database and table you want to operate on.

这篇关于Hive - 获取列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆