【问题标题】:Load a SQl query in pyspark?在 pyspark 中加载 SQL 查询?
【发布时间】:2017-09-05 08:23:22
【问题描述】:

有什么方法可以使用 pyspark 直接从 oracle sql 读取 sql 脚本? 我一直在 pyspark 中加载两个表并尝试加入它们,在 pyspark 中这样做需要很长时间,我需要加入更多表(6 个表)。这在 Oracle Sql 中不需要太多时间。

那么如何使用 pyspark 读取和运行“X.sql”文件?

【问题讨论】:

    标签: sql oracle pyspark pyspark-sql


    【解决方案1】:

    所以我找到了一种解决方案:

    with open("C:\Desktop\Project\Alerts.sql") as Al:
       Alert= Al.read()
    results = sqlctx.sql(Alert)
    

    【讨论】:

      猜你喜欢
      • 2020-10-11
      • 2022-01-18
      • 2021-03-27
      • 2020-07-10
      • 2022-01-23
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 2021-11-12
      相关资源
      最近更新 更多