Skip to content

Commit f6194f2

Browse files
EddieWhifairlydurablejsundai
authored
EDU-3817: Use value_set/unset to update search attributes (#3300)
* Use value_set to update search attributes * Update docs/develop/python/observability.mdx * Update docs/develop/python/observability.mdx * Update docs/develop/python/observability.mdx * Update docs/develop/python/observability.mdx --------- Co-authored-by: Erica Sadun <[email protected]> Co-authored-by: Jwahir Sundai <[email protected]>
1 parent 7ac6e26 commit f6194f2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

docs/develop/python/observability.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,20 +211,21 @@ These attributes are useful for querying Workflows based on the customer ID or t
211211

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

214-
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:
214+
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()`.
215+
These can be created via value_set calls on Search Attribute keys:
215216

216217
```python
217-
workflow.upsert_search_attributes(TypedSearchAttributes([
218-
SearchAttributePair(customer_id_key, "customer_2")
219-
]))
218+
workflow.upsert_search_attributes([
219+
customer_id_key.value_set("customer_2")
220+
])
220221
```
221222

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

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

226227
```python
227-
workflow.upsert_search_attributes(TypedSearchAttributes([
228-
SearchAttributePair(customer_id_key, [])
229-
]))
228+
workflow.upsert_search_attributes([
229+
customer_id_key.value_unset()
230+
])
230231
```

0 commit comments

Comments
 (0)