安装cx_oracle库,依赖于Azure函数应用程序
我正在尝试通过Azure函数执行ETL管道,该功能从Oracle DB获取数据并将其放入MySQL DB中。
我将cx_oracle放在unignts.txt中,但要低于错误:
cx_oracle.databaseerror:dpi-1047:无法找到一个64位oracle oracle客户端库:“ libclntsh.so:so:无法打开共享对象文件:没有此类文件或目录”。
对于Python Oracle库CX_oracle,它需要安装Oracle客户端。如何安装这些依赖项,将其路径放在环境变量上,然后在每个功能触发器上执行我的代码?有可能吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好的解决方案是使用最新版本的CX_oracle,它并不总是需要Oracle客户端库 - 如果您需要扩展功能,这些是可选的。
Python-OracledB 1.0是以新名称从CX_oracle 8.3升级。看
。
安装和使用python-oracledB就像:
然后您可以运行脚本,例如:
请注意,
oracledb.connect()
呼叫现在需要命名为“关键字”参数,符合Python DB API规范。
如果您已经有一些脚本,并且不想更改每个呼叫的名称空间,请尝试更改
导入
喜欢:主页: oracle.github.io/python-oracledb/
快速开始:快速启动python-oracledB安装
文档:
/a>
source: github.com/oracle/python-oracledb
upgrading:
The best solution is to use the latest version of cx_Oracle which doesn't always need Oracle Client libraries - these are optional if you want extended functionality.
Python-oracledb 1.0 is the upgrade from cx_Oracle 8.3, under a new name. See
the release
announcement.
Installing and using python-oracledb is like:
And then you can run scripts like:
Note that
oracledb.connect()
calls now require named "keyword" parameters,conforming to the Python DB API specification.
If you already have some scripts and don't want to change the namespace on every call try changing the
import
like:Home page: oracle.github.io/python-oracledb/
Quick start: Quick Start python-oracledb Installation
Documentation: python-oracle.readthedocs.io/en/latest/index.html
PyPI: pypi.org/project/oracledb/
Source: github.com/oracle/python-oracledb
Upgrading: Upgrading from cx_Oracle 8.3 to python-oracledb
默认情况下,功能在沙箱中运行,您无法安装像Oracle客户端这样的第三方工具。一种解决方案是在Docker容器中包装您的应用 +依赖项,并配置您的功能以运行容器。
文档
By default, Functions are running in a sandbox and you can't install 3rd party tools like the Oracle client. One solution is to package your app + dependencies in a Docker container and configure your Function to run the container.
Documentation