将多个 blob 输入 azure 函数 python
Input multiple blobs into azure function python
我在 python 工作,负责 Azure 功能。我正在尝试读入两个 blob,一个被触发,一个静态 blob。
当我读入它们时,两个 blob 都指向触发的 blob(URI 相同)。如何正确输入和使用两个blob?
我的绑定看起来像:
{
"name": "techdatablob",
"type": "blobTrigger",
"direction": "in",
"path": "path1/{name}",
"connection": "example"
},
{
"name": "crmdatablob",
"type": "blob",
"direction": "in",
"path": "path2/data.xlsx",
"connection": "example"
},
{
"name": "outputblob",
"type": "blob",
"direction": "out",
"path": "path3/out.xlsx",
"connection": "example"
}
init.py 文件开头为:
def main(techdatablob: func.InputStream, crmdatablob: func.InputStream, outputblob: func.Out[func.InputStream]):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {techdatablob.name}\n"
f"Blob Size: {techdatablob.length} bytes")
print(techdatablob.uri)
print(crmdatablob.uri)
When I read them in, both blobs point to the triggered blob (URI is
the same). How can input and use two blobs correctly?
事实上,您已经输入了多个 blob,问题来自 azure 函数 blob 绑定元数据不是来自函数宿主,因此 blob 名称、blob 长度、uri 等内容无法获得正确的值。但实际上他们的数据是不一样的(对象也不一样)。
你可以做如下测试:
import logging
import azure.functions as func
def main(techdatablob: func.InputStream, crmdatablob: func.InputStream) -> None:
logging.info("-----"+techdatablob.read().decode('utf-8'))
logging.info("-----"+crmdatablob.read().decode('utf-8'))
查看此错误页面:
https://github.com/Azure/azure-functions-python-worker/issues/576
我觉得问题不在你这边,是功能设计的问题。使用storage sdk获取metadata应该没有问题
我在 python 工作,负责 Azure 功能。我正在尝试读入两个 blob,一个被触发,一个静态 blob。
当我读入它们时,两个 blob 都指向触发的 blob(URI 相同)。如何正确输入和使用两个blob?
我的绑定看起来像:
{
"name": "techdatablob",
"type": "blobTrigger",
"direction": "in",
"path": "path1/{name}",
"connection": "example"
},
{
"name": "crmdatablob",
"type": "blob",
"direction": "in",
"path": "path2/data.xlsx",
"connection": "example"
},
{
"name": "outputblob",
"type": "blob",
"direction": "out",
"path": "path3/out.xlsx",
"connection": "example"
}
init.py 文件开头为:
def main(techdatablob: func.InputStream, crmdatablob: func.InputStream, outputblob: func.Out[func.InputStream]):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {techdatablob.name}\n"
f"Blob Size: {techdatablob.length} bytes")
print(techdatablob.uri)
print(crmdatablob.uri)
When I read them in, both blobs point to the triggered blob (URI is the same). How can input and use two blobs correctly?
事实上,您已经输入了多个 blob,问题来自 azure 函数 blob 绑定元数据不是来自函数宿主,因此 blob 名称、blob 长度、uri 等内容无法获得正确的值。但实际上他们的数据是不一样的(对象也不一样)。
你可以做如下测试:
import logging
import azure.functions as func
def main(techdatablob: func.InputStream, crmdatablob: func.InputStream) -> None:
logging.info("-----"+techdatablob.read().decode('utf-8'))
logging.info("-----"+crmdatablob.read().decode('utf-8'))
查看此错误页面:
https://github.com/Azure/azure-functions-python-worker/issues/576
我觉得问题不在你这边,是功能设计的问题。使用storage sdk获取metadata应该没有问题