Skip to content

Fix: differentiate seed date and datetime types#2122

Merged
treysp merged 1 commit intomainfrom
trey/seed-date-type
Feb 14, 2024
Merged

Fix: differentiate seed date and datetime types#2122
treysp merged 1 commit intomainfrom
trey/seed-date-type

Conversation

@treysp
Copy link
Contributor

@treysp treysp commented Feb 13, 2024

For seed models, SQLMesh currently converts columns from string to all date/time types using pd.to_datetime(), which always returns a pd.Timestamp type.

If a user specifies a column as type DATE in the model definition, the above approach creates a discrepancy between the Pandas dataframe type (timestamp) and the SQL engine type (date). For DuckDB, this results in an error.

This PR differentiates conversion for date and datetime types, converting the former into datetime.date objects instead of pandas timestamps.

@treysp treysp force-pushed the trey/seed-date-type branch from 9667370 to ab8d040 Compare February 13, 2024 23:25
@treysp treysp merged commit 60e447b into main Feb 14, 2024
@treysp treysp deleted the trey/seed-date-type branch February 14, 2024 17:36
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