Azure / Azure/azure-functions-powershell-worker

Push-OutputBinding for table storage does not overwrite existing entities

Open
#303 9 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
215
Forks
61
Avg merge
21h 4m
Merged PRs (30d)
6

Description

If the rowKey already exists in the table the entity is not overwritten, but an error is raised. This makes `Push-OutputBinding` a _one-trick-pony_ wrt. table storage and any workaround defeats the purpose of making integration with _Azure Table Storage_ easy and straightforward.

```powershell
$Entity = @{
partitionKey = "SOME_PARTITION_KEY"
rowKey = "key_that_already_exists_in_the_table"
}
Push-OutputBinding -Name outputTable -Value $Entity
# results in an error "The specified entity already exists"
```

I would suggest adding a `-Force` parameter that means overwrite existing entries. This should be trivial as instead of using the `insert` operation you could use the `upsert` operation.

Not sure if this should then be an `insert or replace` or a `insert or merge`. Perhaps something that can be defined in the integration itself, but either will do as a temporary measure.

Or am I missing something since I could find no mention of this issue anywhere?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Push-OutputBinding implementation for Azure Table Storage and trace how an existing rowKey is handled. Compare the requested -Force behavior with the available insert-or-replace and insert-or-merge semantics, then add coverage for an existing entity and confirm the chosen overwrite behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, powershell
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.