将Google Cloud Function连接到Oracle数据库 [英] Connect google cloud function to an oracle database

查看:143
本文介绍了将Google Cloud Function连接到Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何将Google Cloud Function(Python)连接到Oracle数据库吗?我尝试在云函数中导入cx_Oracle库.但这显示了错误

Does anyone know, how to connect google cloud function(Python) to an Oracle database ? I tried importing cx_Oracle library in cloud function. But it shows an error

函数加载错误:DPI-1047:无法加载Oracle客户端库:libclntsh.so:无法打开共享对象文件

以下是main.py代码:

Following is main.py code:

import cx_Oracle

def import_data(request):

    request_json = request.get_json()
    if request_json and 'message' in request_json:
        con = cx_Oracle.connect("username", "password", "host:port/SID")
        print(con.version)
        con.close

以下是required.txt

Following is requirement.txt

# Function dependencies, for example:
# package>=version
cx_Oracle==6.0b1 

推荐答案

似乎Google Cloud Functions 不支持共享库(换句话说,它仅支持纯python"库),而cx_oracle依赖于此.遗憾的是,我无法找到纯Python的Oracle库,因此目前尚不支持.

It seems Google Cloud Functions does not support shared libraries (in other words, it only supports "pure python" libraries) and that cx_oracle depends on this. Sadly I haven't been able to find a pure-python Oracle library, so for now this is not supported.

您最好的选择是使用App Engine Flexible,因为它是允许使用非纯python库. cl_oracle应该可以使用它.

Your best bet is to use App Engine Flexible as it the closest equivalent service that allows non-pure python libraries. cl_oracle should work with it.

这篇关于将Google Cloud Function连接到Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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