问题描述
我需要执行一些SQL查询(如此处)直接来自Metasore.
PS:命令SHOW/DESCRIBE 不够.
I need to do some SQL queries (as here) directly from Metasore.
PS: the commands SHOW/DESCRIBE are not enough.
如何启用作为数据库的访问权限,或者Metastore的数据库名称是什么?...在当今(2019年)有可能吗?
How to enable access from it as database, or what the database name of Metastore? ... In nowadays (2019) it is possible?
注意
-
什么是 Metastore ?
对我来说,这是Hive架构中非常重要的元素,最终用户需要对其进行访问... 所有Hive实施都需要一个元数据存储服务,用于存储元数据.它是使用关系表中的表来实现的默认情况下,Hive使用内置的Derby SQL Server" , 1.
当然,您需要您的上下文 标准" Metastore .在我公司的Hadoop集群上,我们计划标准化Metastore(本地和长期标准),也许是PostgreSQL,以及( PostgREST API 以便从外部使用一些SQL视图.)
What is Metastore?
For me is a very important element of the Hive architecture, final user need some access to it... "All Hive implementation need a metastore service, where it stores metadata. It is implemented using tables in relational database. By default, Hive uses built-in Derby SQL server", 1.
Of course, you need in your context a "standard" Metastore. On my corporation's Hadoop cluster we are planning to standardize Metastore (local and long term standard), perhaps PostgreSQL and also an (PostgREST API for external consume of some SQL-Views from it).
当Metastore是长期的本地标准时,SQL定义(表名等)将保持稳定,并且Metastore查询将是可靠的.
The SQL definitions (table names, etc.) will be stable and Metastore queries will be reliable when Metastore is a long-term local standard.
它的Metastore与Hive紧密相连,Hive是Java API,但Metastore也是标准的RDBMS,并为外部Universe提供标准的连接(通过SQL).
PS:我对Metastore的兴趣在于这种外部环境.
The Metastore it is closely connected to Hive, where it is a Java API, but Metastore is also a standard RDBMS and offers standard connection (by SQL) for the external universe.
PS: my interest on Metastore is in this external context.
推荐答案
火花壳解决方案
后台访问Metastore,它具有一流元数据方法,它返回一个数据框,即 schema
属性,该属性公开名称,类型等,并提供 getComment
方法.
Spark-shell solution
Spark access Metastore under the hood, it have a first class metadata method, that returns a dataframe, the schema
property, that expose names, types, etc. and offers getComment
method.
请参见 https://stackoverflow.com/a/57857021/287948
这篇关于如何从beeline访问Metastore?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!