SOLVED

Error while trying to write in Azure Tables ('' is not a valid value for a partition key or row key)

New Contributor

Hi everyone,

 

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 :

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-table-output?tabs=...

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 :)

1 Reply
best response confirmed by Sarra_e (New Contributor)
Solution

I just saw the note in the documentation : "Version 3.x of the extension bundle currently does not include the Table Storage bindings. If your app requires Table Storage, you will need to continue using the 2.x version for now.". So, I updated the version of the bundle extension to version 2 in the host.json file and it worked !!

 

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }
}

 

 

Note that the text of the error mentionned in the terminal : ' '' is not a valid value for a partition key or row key' had nothing to do with the real problem.

www.000webhost.com