如何在 Zeppelin notebook 和 pyspark 中导入 Delta Lake 模块? [英] How to import Delta Lake module in Zeppelin notebook and pyspark?

查看:36
本文介绍了如何在 Zeppelin notebook 和 pyspark 中导入 Delta Lake 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在带有 pyspark 的 Zeppelin 笔记本中使用 Delta Lake,但似乎无法成功导入模块.例如

I am trying to use Delta Lake in a Zeppelin notebook with pyspark and seems it cannot import the module successfully. e.g.

%pyspark
from delta.tables import *

失败并出现以下错误:

ModuleNotFoundError: 没有名为delta"的模块

ModuleNotFoundError: No module named 'delta'

但是,使用delta格式保存/读取数据帧是没有问题的.如果使用scala spark %spark

However, there is no problem to save/read the data frame using delta format. And the module can be loaded successfully if using scala spark %spark

有没有办法在 Zeppelin 和 pyspark 中使用 Delta Lake?

Is there any way to use Delta Lake in Zeppelin and pyspark?

推荐答案

终于成功将其加载到 zeppelin pyspark 上.必须明确包含 jar 文件

Finally managed to load it on zeppelin pyspark. Have to explicitly include the jar file

%pyspark
sc.addPyFile("**LOCATION_OF_DELTA_LAKE_JAR_FILE**")
from delta.tables import *

这篇关于如何在 Zeppelin notebook 和 pyspark 中导入 Delta Lake 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆