如何在bluemix spark上添加jar到python笔记本? [英] how to add a jar to python notebook on bluemix spark?

查看:144
本文介绍了如何在bluemix spark上添加jar到python笔记本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在python中使用spark jdbc。第一步是添加一个jar:

I would like to use spark jdbc with python. First step was to add a jar:

%AddJar http://central.maven.org/maven2/org/apache/hive/hive-jdbc/2.0.0/hive-jdbc-2.0.0.jar -f

但是,响应:

ERROR: Line magic function `%AddJar` not found.

如何在python脚本中添加JDBC jar文件?

How can I add JDBC jar files in a python script?

推荐答案

目前,这不仅仅是来自python笔记本;但它被理解为一项重要的要求。在支持此功能之前,您可以执行的操作来自您的python笔记本的同一个spark服务实例,从那里创建一个scala笔记本和%AddJar 。然后,同一个spark服务实例的所有python笔记本都可以访问它。对于从scala nb添加jar时处于活动状态的py笔记本,您需要重新启动它们的内核。

Presently, this is not possible only from a python notebook; but it is understood as an important requirement. What you can do until this is supported, is from the same spark service instance of your python notebook, create a scala notebook and %AddJar from there. Then all python notebooks of that same spark service instance can access it. For py notebooks that were active when you added the jar from the scala nb, you will need to restart their kernels.

请注意,这适用于Jupyter 4+上的笔记本实例,但不一定适用于早期的IPython笔记本实例;从笔记本中检查帮助 - >关于菜单中的版本。最近创建的任何新笔记本实例都将在Jupyter 4 +上。

Note that this works for notebook instances on Jupyter 4+ but not necessarily for earlier IPython notebook instances; check the version from the Help -> About menu from a notebook. Any new notebook instances created recently will be on Jupyter 4+.

这篇关于如何在bluemix spark上添加jar到python笔记本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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