Skip to content

Conversation

dansola
Copy link
Contributor

@dansola dansola commented Sep 29, 2025

Why are the changes needed?

What changes were proposed in this pull request?

This workflow

@fl.task(container_image=image)
def get_timestamp() -> pd.Timestamp:
    return pd.Timestamp("2024-09-29 15:30:45")


@fl.workflow
def timestamp_wf() -> pd.Timestamp:
    return get_timestamp()

gives this error:

TypeTransformerFailedError: Failed to convert 
outputs of task 'timestamp_wf.get_timestamp' at 
position 0.
Failed to convert type <class 
'pandas._libs.tslibs.timestamps.Timestamp'> to type 
<class 'pandas._libs.tslibs.timestamps.Timestamp'>.
Error Message: Expected value of type <class 
'datetime.datetime'> but got '2024-09-29 15:30:45' 
of type <class 
'pandas._libs.tslibs.timestamps.Timestamp'>.

We need a pandas timestamp type transformer.

How was this patch tested?

Tested locally and remotely. For remote run, just installed flytekit from the da72500c93e1ff1107a24f1e67eb453a443e4d82 commit on the image.

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

This pull request introduces the PandasTimestampTransformer class to convert between pandas.Timestamp and Flyte DATETIME literals, addressing a type conversion error in workflows. It includes updates to import statements and has been tested for functionality both locally and remotely.

from flytekit.types.schema.types_pandas import ( # noqa: F401
PandasSchemaReader,
PandasSchemaWriter,
PandasTimestampTransformer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make this a separate import, and move the timestamp transformer into a separate file?

The "schema" folder name refers to the old Flyte Schema type, which was deprecated by the structureddataset type. Could we put it in the basic_dfs.py file alongside the rest of the Dataframe stuff for pandas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants