From bfbd0fdca68dccd4d8844332b5d27963f1cf876b Mon Sep 17 00:00:00 2001 From: EddieWhi Date: Tue, 21 Jan 2025 13:05:04 +0000 Subject: [PATCH 1/5] Use value_set to update search attributes --- docs/develop/python/observability.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/develop/python/observability.mdx b/docs/develop/python/observability.mdx index 22b705482d..d39af64b7a 100644 --- a/docs/develop/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -218,20 +218,20 @@ 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 Attributes that was previously set, use a 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() +]) ``` From 583f6c0ccc6191e66cc5f47559a9831c31bc0c45 Mon Sep 17 00:00:00 2001 From: Erica Sadun <156466156+fairlydurable@users.noreply.github.com> Date: Tue, 21 Jan 2025 07:27:36 -0700 Subject: [PATCH 2/5] Update docs/develop/python/observability.mdx --- docs/develop/python/observability.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/develop/python/observability.mdx b/docs/develop/python/observability.mdx index d39af64b7a..7d620a4bbf 100644 --- a/docs/develop/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -218,7 +218,8 @@ 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 a list of `SearchAttributeUpdate()`. These can be created via value_set calls on search attribute keys: +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([ From 58f03432fb3628a24a5f7b74f9ed56fb7775a911 Mon Sep 17 00:00:00 2001 From: Erica Sadun <156466156+fairlydurable@users.noreply.github.com> Date: Tue, 21 Jan 2025 07:28:04 -0700 Subject: [PATCH 3/5] Update docs/develop/python/observability.mdx --- docs/develop/python/observability.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/python/observability.mdx b/docs/develop/python/observability.mdx index 7d620a4bbf..4aef8c473f 100644 --- a/docs/develop/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -229,7 +229,7 @@ workflow.upsert_search_attributes([ ### Remove a Search Attribute from a Workflow {#remove-search-attribute} -To remove a Search Attributes that was previously set, use a value_unset call on the search attribute key. +To remove a Search Attribute that was previously set, use a `value_unset call` on the search attribute key. ```python workflow.upsert_search_attributes([ From 0ddd6686f3f75e4147160a085ad47dcb8f5dc08a Mon Sep 17 00:00:00 2001 From: Erica Sadun <156466156+fairlydurable@users.noreply.github.com> Date: Tue, 21 Jan 2025 07:28:58 -0700 Subject: [PATCH 4/5] Update docs/develop/python/observability.mdx --- docs/develop/python/observability.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/python/observability.mdx b/docs/develop/python/observability.mdx index 4aef8c473f..56d8937877 100644 --- a/docs/develop/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -229,7 +229,7 @@ workflow.upsert_search_attributes([ ### Remove a Search Attribute from a Workflow {#remove-search-attribute} -To remove a Search Attribute that was previously set, use a `value_unset call` on the search attribute key. +To remove a Search Attribute that was previously set, use `value_unset call` on the Search Attribute key. ```python workflow.upsert_search_attributes([ From f38fe8610adfdc4817b427dcbe55079b1e77a74a Mon Sep 17 00:00:00 2001 From: Erica Sadun <156466156+fairlydurable@users.noreply.github.com> Date: Tue, 21 Jan 2025 07:29:15 -0700 Subject: [PATCH 5/5] Update docs/develop/python/observability.mdx --- docs/develop/python/observability.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/python/observability.mdx b/docs/develop/python/observability.mdx index 56d8937877..d01f8a8dec 100644 --- a/docs/develop/python/observability.mdx +++ b/docs/develop/python/observability.mdx @@ -219,7 +219,7 @@ 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 a list of `SearchAttributeUpdate()`. -These can be created via value_set calls on search attribute keys: +These can be created via value_set calls on Search Attribute keys: ```python workflow.upsert_search_attributes([