安装cx_oracle库,依赖于Azure函数应用程序

发布于 2025-02-02 11:49:47 字数 305 浏览 3 评论 0 原文

我正在尝试通过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客户端。如何安装这些依赖项,将其路径放在环境变量上,然后在每个功能触发器上执行我的代码?有可能吗?

I am trying to execute ETL pipeline through Azure function that fetches data from an Oracle DB and puts into a MySQL db.

I put cx_oracle in requirements.txt but got below error:

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory".

For python oracle library cx_oracle, it requires installation of oracle clients. How do i install those dependencies, put their path on environment variable and then start execute my code on every function trigger? Is it even possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

廻憶裏菂餘溫 2025-02-09 11:49:47

最好的解决方案是使用最新版本的CX_oracle,它并不总是需要Oracle客户端库 - 如果您需要扩展功能,这些是可选的。

Python-OracledB 1.0是以新名称从CX_oracle 8.3升级。看

安装和使用python-oracledB就像:

python -m pip install oracledb

然后您可以运行脚本,例如:

import oracledb

connection = oracledb.connect(user='scott', password=mypw, dsn='myhost/oraclepdb1')
with connection.cursor() as cursor:
  for row in cursor.execute('select city from locations'):
      print(row)

请注意, oracledb.connect()呼叫现在需要命名为“关键字”参数,
符合Python DB API规范。

如果您已经有一些脚本,并且不想更改每个呼叫的名称空间,请尝试更改
导入喜欢:

import oracledb as cx_Oracle

主页: 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:

python -m pip install oracledb

And then you can run scripts like:

import oracledb

connection = oracledb.connect(user='scott', password=mypw, dsn='myhost/oraclepdb1')
with connection.cursor() as cursor:
  for row in cursor.execute('select city from locations'):
      print(row)

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:

import oracledb as cx_Oracle

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

说不完的你爱 2025-02-09 11:49:47

默认情况下,功能在沙箱中运行,您无法安装像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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文