worried-airplane-87065
05/22/2025, 6:52 PMjolly-florist-66728
05/22/2025, 6:52 PMdatetime
field from a Flyte workflow. Flyte supports dataclasses as task and workflow inputs/outputs, and datetime.datetime
is a supported type for serialization within dataclasses. However, you should not use datetime.date
(without time) as a field type, as it is not fully supported and may cause errors—use datetime.datetime
instead for date/time fields in dataclasses within Flyte workflows. All dataclass fields must be type-annotated for Flyte to serialize/deserialize them correctly.
For example:
from dataclasses import dataclass
from datetime import datetime
from flytekit import task, workflow
@dataclass
class MyData:
timestamp: datetime
@task
def make_data() -> MyData:
return MyData(timestamp=datetime.now())
@workflow
def my_wf() -> MyData:
return make_data()
See Flyte dataclass docs and datetime support issue for details.
Would you like more detail or examples on this topic?
Sources:
- Flyte dataclass docs
- datetime support issue 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.worried-airplane-87065
05/22/2025, 6:53 PMjolly-florist-66728
05/22/2025, 6:53 PM