简体   繁体   English

从 Azure Databricks 查询 SAP 表

[英]Query on SAP table from Azure Databricks

I want to query the SAP table from databricks.我想从数据块查询 SAP 表。 I have installed the JDBC library for connecting to the SAP server.我已经安装了用于连接到 SAP 服务器的 JDBC 库。 I am able to connect and fetch records using spark.read.JDBC(url = jdbcUrl, table = query, properties = connectionProperties).我能够使用 spark.read.JDBC(url = jdbcUrl, table = query, properties = connectionProperties) 连接和获取记录。 In the table parameter, I am providing the schema and table name.在表参数中,我提供了架构和表名。 I want to fetch selective records.我想获取选择性记录。 Is there any way for providing a query?有没有办法提供查询?

You just need to use standard Spark functions like, .filter / .where - Spark will convert it into corresponding SQL query and will push it down to the database.您只需要使用标准的 Spark 函数,例如.filter / .where - Spark 会将其转换为相应的 SQL 查询并将其向下推送到数据库。 This functionality (predicate pushdown) is enabled in Spark by default as you may see indocumentation .正如您在文档中看到的那样,此功能(谓词下推)在 Spark 中默认启用。

df = spark.read.JDBC(url = jdbcUrl, table = query, 
       properties = connectionProperties)
filtered = df.filter("condition")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM