python - 如何在 Python 中从 Informix 和 Oracle 数据库中检索图像?
问题描述
我正在编写一个 python 脚本来从 Informix/Oracle 数据库获取图像数据(blob)并将图像上传到 AWS S3。我的部分代码如下:
try:
cur = conn.cursor()
cur.execute(sql)
for row in cur:
client = trim(row[0])
date = trim(row[1])
filename = trim(row[2])
imageblob = row[3].read()
write_file(filename, imageblob)
我收到以下错误(Informix 案例):
Error: <class '_informixdb.InterfaceError'>
Traceback (most recent call last):
File "UploadImagesToS3.py", line 57, in getImageFromDB
imageblob = row[3].read()
InterfaceError: Sblob is not open
有人可以帮忙吗?代码需要与 Informix 和 Oracle DB 兼容。谢谢
解决方案
推荐阅读
- c# - 如何为选定的复选框值赋值
- apache - 从 :80 端口重定向
- laravel - laravel 7中的一对多关系
- android - React Native:从 createBottomTabNavigator 切换到 createMaterialBottomNavigator
- python - 在现有浏览器会话上使用 selenium
- arduino - Arduino 将浮点数转换为十六进制 IEEE754 单精度 32 位
- python - 使用writelines在Ipython的文本文件中写入数值参数行?
- xcode - 为什么我的列表视图不能立即在 Xcode-12-Beta 中加载?
- python - 如何在 matplotlib.pyplot 中保存没有边框/边距的图形?
- azure-keyvault - 无法使用 powershell 为托管实例提供对 Key Vault 的访问权限