在 Azure HDInsight 中通过 Microsoft Power BI 使用 ODBC 直观显示 Apache Hive 数据Visualize Apache Hive data with Microsoft Power BI using ODBC in Azure HDInsight
了解如何使用 ODBC 将 Microsoft Power BI Desktop 连接到 Azure HDInsight 并直观显示 Apache Hive 数据。Learn how to connect Microsoft Power BI Desktop to Azure HDInsight using ODBC and visualize Apache Hive data.
重要
可以利用 Hive ODBC 驱动程序,通过 Power BI Desktop 中的通用 ODBC 连接器执行导入操作。You can leverage the Hive ODBC driver to do import via the generic ODBC connector in Power BI Desktop. 但是,鉴于 Hive 查询引擎的非交互性质,不建议对 BI 工作负荷执行此操作。However it is not recommended for BI workloads given non-interactive nature of the Hive query engine. 出于性能考量,HDInsight 交互式查询连接器和 HDInsight Spark 连接器是更好的选择。HDInsight Interactive Query connector and HDInsight Spark connector are better choices for their performance.
在本文中,从 hivesampletable
Hive 表将数据加载到 Power BI 中。In this article, you load the data from a hivesampletable
Hive table to Power BI. Hive 表包含一些移动电话使用情况数据。The Hive table contains some mobile phone usage data. 然后在世界地图上绘制使用情况数据:Then you plot the usage data on a world map:
这些信息也适用于新的交互式查询群集类型。The information also applies to the new Interactive Query cluster type. 有关如何使用直接查询连接到 HDInsight 交互式查询的信息,请参阅在 Azure HDInsight 中通过 Microsoft Power BI 使用直接查询可视化交互式查询 Hive 数据。For how to connect to HDInsight Interactive Query using direct query, see Visualize Interactive Query Hive data with Microsoft Power BI using direct query in Azure HDInsight.
先决条件Prerequisites
在开始阅读本文前,必须具备以下项:Before going through this article, you must have the following items:
- HDInsight 群集。HDInsight cluster. 该群集可以是包含 Hive 的 HDInsight 群集,也可以是新发布的交互式查询群集。The cluster can be either a HDInsight cluster with Hive or a newly released Interactive Query cluster. 有关创建群集的信息,请参阅创建群集。For creating clusters, see Create cluster.
- Microsoft Power BI Desktop 。Microsoft Power BI Desktop. 可从 Microsoft 下载中心下载副本。You can download a copy from the Microsoft Download Center.
创建 Hive ODBC 数据源Create Hive ODBC data source
请参阅创建 Hive ODBC 数据源。See Create Hive ODBC data source.
从 HDInsight 加载数据Load data from HDInsight
所有 HDInsight 群集都随附了 hivesampletable Hive 表。The hivesampletable Hive table comes with all HDInsight clusters.
启动 Power BI Desktop。Start Power BI Desktop.
在顶部菜单中,导航到“主页” > “获取数据” > “更多...”。 From the top menu, navigate to Home > Get Data > More....
在“获取数据” 对话框中,选择左侧的“其他” ,选择右侧的 ODBC,然后选择底部的“连接” 。From the Get Data dialog, select Other from the left, select ODBC from the right, and then select Connect on the bottom.
在“从 ODBC” 对话框中,从下拉列表中选择在上一部分中创建的数据源名称,From the From ODBC dialog, select the data source name you created in the last section from the drop-down list. 然后选择“确定”。 Then select OK.
第一次使用时,将打开“ODBC 驱动程序” 对话框。For the first use, an ODBC driver dialog will open. 从左侧菜单中选择“默认值或自定义” 。Select Default or Custom from the left menu. 然后选择“连接”以打开导航器 。Then select Connect to open Navigator.
在“导航器” 对话框中,依次展开“ODBC”>“HIVE”>“默认” ,选择 hivesampletable,然后选择“加载” 。From the Navigator dialog, expand ODBC > HIVE > default, select hivesampletable, and then select Load.
可视化数据Visualize data
从上一过程继续进行。Continue from the last procedure.
在“可视化”窗格中,选择“地图” 。From the Visualizations pane, select Map. 它是一个地球图标。It is a globe icon.
在“字段” 窗格中,选择 country 和 devicemake。From the Fields pane, select country and devicemake. 可以在地图上看到绘制的数据。You can see the data plotted on the map.
展开地图。Expand the map.
后续步骤Next steps
本文介绍了如何使用 Power BI 直观显示 HDInsight 中的数据。In this article, you learned how to visualize data from HDInsight using Power BI. 要了解更多信息,请参阅下列文章:To learn more, see the following articles:
- 在 Azure HDInsight 中使用 Apache Zeppelin 运行 Apache Hive 查询。Use Apache Zeppelin to run Apache Hive queries in Azure HDInsight.
- 使用 Microsoft Hive ODBC 驱动程序将 Excel 连接到 HDInsight。Connect Excel to HDInsight with the Microsoft Hive ODBC Driver.
- 使用 Power Query 将 Excel 连接到 Apache Hadoop。Connect Excel to Apache Hadoop by using Power Query.
- 使用针对 Visual Studio 的 Data Lake 工具连接到 Azure HDInsight 并运行 Apache Hive 查询。Connect to Azure HDInsight and run Apache Hive queries using Data Lake Tools for Visual Studio.
- 使用用于 Visual Studio Code 的 Azure HDInsight 工具。Use Azure HDInsight Tool for Visual Studio Code.
- 将数据上传到 HDInsight。Upload Data to HDInsight.