【HXE:1.1】Power BI + HANA? Yes!
1. What is Power BI?
Power BI is a suite of business analytics tools to analyze data and share insights. Power BI dashboards provide a 360-degree view for business users with their most important metrics in one place, updated in real time, and available on all of their devices.
Power BI Desktop is a feature-rich data mashup and report authoring tool. Combine data from disparate databases, files, and web services with visual tools that help you understand and fix data quality and formatting issues automatically.
With the Power BI service, publish reports securely to your organization and setup automatic data refresh so everyone has the latest information. And you can access your data and reports from anywhere with the Power BI Mobile apps, which update automatically with any changes to your data.
Power BI最好的一点在于:免费!免费!免费!(仅限非商业用户)但是只有Windows版本。
2. 相关文章
参考以下几篇文章:
- DirectQuery 和 SAP HANA
- SAP HANA connection in Power BI Desktop
- Use ODBC-Based Querying Tool with SAP HANA, express edition
- 视频:SAP HANA Express Edition: Setup, Install and configure ODBC - SAP HANA Academy
- Consuming SAP HANA Express Edition information models in Microsoft Power BI using live connection
- How To – Install the HANA Client and Create ODBC
- How To: Configure an ODBC driver to connect to a SAP HANA database
研究之后,发现可以通过ODBC接口,来连接Power BI和HANA数据库。但是网上的文章都没有一个完整的流程,接下来我将以在Windows下Power BI连接HXE为例子,详细讲述过程。
3. 检查预先条件
- SAP HANA, express edition. 如果你还没有安装,可以参考这篇文章完成相关配置:
【HXE】SAP HANA, express edition - Power BI Desktop. 推荐下载渠道:Power BI Desktop下载
4. 连接Power BI和HXE
4.1 安装HANA
用 HXEDownloadManager_win 下载 hdb_client_windows
下载后可以按照文章:SAP HANA connection in Power BI Desktop的第四步开始安装:
Run “hdbsetup.exe”
Set the installation path and click “Next”
Review and click “Install”
Installation in Progress
Installation finished successfully
4.2 获取HXE相关信息
运行HXE虚拟机,输入命令:
/sbin/ifconfig
获取HXE虚拟机的IP地址信息(红色部分即为IP地址)。
红色部分即为IP地址
4.3 ODBC设置
按照下面两篇文章进行配置
- How To – Install the HANA Client and Create ODBC,第二页
-
Use ODBC-Based Querying Tool with SAP HANA, express edition
打开 控制面板—管理工具—ODBC数据库(64位)
控制面板—管理工具—ODBC数据库(64位)
Data Source Name: DSN_HXE
Description = HXE Tenant
Server:Port = hxehost:39015
-----------------------------------
Data Source Name: DSN_SYSTEMDB
Description = SYSTEM Database
Server:Port = hxehost:39013
配置好连接之后,可以点击“Connect”按钮,测试连接,输入User: SYSTEM 以及DB密码
切换到 系统DSN 选项卡,之后选择 添加输入配置信息如下:
Data Source Name: DSN_HXE
Description = HXE Tenant
Server:Port = hxehost:39015
-----------------------------------
Data Source Name: DSN_SYSTEMDB
Description = SYSTEM Database
Server:Port = hxehost:39013
4.4 Power BI配置
打开Power BI,点击左上角 文件—Options and settings—Options
选择 DirectQuery—勾选 Treat SAP HANA as a realtional source 之后确认
注意事项 成功连接
5. 排错 & 其他
Error 1
配置好所有链接之后,发现还是无法连接,参考文章:Can't connect to SAP Hana using ODBC之后发现,找到原因:
在Power BI中,设置接口连接的时候需要输入IP地址,直接输入数字,而非hostname
Error 2
连接出现报错 “user is not authorized (2950)”,参考文章:Prevent error activating calculated view in new schemas: user is not authorized (2950),成功解决。
其他
注意:Power BI只能获取HANA数据库的Calculation View,不能直接获取Table,如果需要读取Table,则需要在Table的基础上创建Calculation Views,才能读取Table。
如何创建Calculation View,可参考这篇文章:SAP HANA Calculation View Tutorial