2017-09-05 49 views
0

有没有什么方法可以直接从oracle sql使用pyspark来读取sql脚本? 我一直在pyspark中加载两张桌子并试图加入,在pyspark花费很长时间,我需要加入更多桌子(6张桌子)。这在Oracle Sql中并不需要太多时间。在pyspark中加载SQl查询?

那么我怎样才能读取和运行一个“X.sql”与pyspark文件?

回答

0

所以我已经找到一个解决办法:

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