sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[Bug] Upserting datetime search attribute fails

Open accupham opened this issue 7 months ago • 3 comments

What are you really trying to do?

I'm trying to update a workflow with a search attribute checkout_time of type datetime using the python SDK. The checkout_time datetime search attribute exists on that particular namespace.

Describe the bug

from datetime import datetime
from temporalio import workflow
from temporalio.common import SearchAttributeKey, SearchAttributeValue

t = datetime.fromisoformat("2024-07-05T15:43:07.875302" ) # <- yes, workflow is deterministic
k = SearchAttributeKey.for_datetime("checkout_time")
u = k.value_set(t)
workflow.upsert_search_attributes([u])


Results in this worker error:

2024-07-05T20:46:30.554682Z WARN temporal_sdk_core::worker::workflow: Error while completing workflow activation error=status: InvalidArgument, message: "BadSearchAttributes: invalid value for search attribute checkout of type Datetime: 2024-07-05T15:43:07.875302", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "server": "temporal", "date": "Fri, 05 Jul 2024 15:43:07 GMT"} }

Environment/Versions

  • OS and processor: [Intel Mac]

accupham avatar Jul 05 '24 20:07 accupham