I am a beginner in Azure. I'm trying to add a row in Azure Tables storage using Python. I followed the simple example of Microsoft documentation :
However, I get this error : Microsoft.Azure.WebJobs.Extensions.Tables: '' is not a valid value for a partition key or row key and I don't see the table created in my MicrosoftAzure Storage Explorer.
I already have a functional azure function with a queueTrigger as an input binding. So, I added an ouptut binding Table in the configuration file "function.json":
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "dataSetId",
"type": "queueTrigger",
"direction": "in",
"queueName": "local-toprep",
"connection": "AzureWebJobsStorage"
},
{
"type": "table",
"direction": "out",
"name": "message",
"tableName": "messages",
"partitionKey": "message",
"connection": "AzureWebJobsStorage"
}
]
}
And in my main function ,I added my table "message" in the arguments and I added those lines :
rowKey = str(uuid.uuid4())
data = {
"Name": "Output binding message",
"PartitionKey": "message",
"RowKey": rowKey
}
message.set(json.dumps(data))
Thank you in advance for your help :)
CodePudding user response:
So, my problem was in host.js file. Azure table works only in version 2.
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
}
}