Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docs/develop/python/observability.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,21 @@ These attributes are useful for querying Workflows based on the customer ID or t

You can upsert Search Attributes to add or update Search Attributes from within Workflow code.

To upsert custom Search Attributes, use the [`upsert_search_attributes()`](https://python.temporal.io/temporalio.workflow.html#upsert_search_attributes) method to pass instances of `SearchAttributePair()` containing each of your keys and starting values to a parameter to a `TypedSearchAttributes()` object:
To upsert custom Search Attributes, use the [`upsert_search_attributes()`](https://python.temporal.io/temporalio.workflow.html#upsert_search_attributes) method to pass a list of `SearchAttributeUpdate()`.
These can be created via value_set calls on search attribute keys:

```python
workflow.upsert_search_attributes(TypedSearchAttributes([
SearchAttributePair(customer_id_key, "customer_2")
]))
workflow.upsert_search_attributes([
customer_id_key.value_set("customer_2")
])
```

### Remove a Search Attribute from a Workflow {#remove-search-attribute}

To remove a Search Attribute that was previously set, set it to an empty array: `[]`.
To remove a Search Attribute that was previously set, use `value_unset call` on the Search Attribute key.

```python
workflow.upsert_search_attributes(TypedSearchAttributes([
SearchAttributePair(customer_id_key, [])
]))
workflow.upsert_search_attributes([
customer_id_key.value_unset()
])
```