Skip to content

fix(dagster-polars): load pl.Date columns into BigQuery as DATE - #363

Open
Sam-Razavi wants to merge 2 commits into
dagster-io:mainfrom
Sam-Razavi:fix/polars-bigquery-date-columns
Open

Sam-Razavi wants to merge 2 commits into
dagster-io:mainfrom
Sam-Razavi:fix/polars-bigquery-date-columns

Conversation

@Sam-Razavi

Copy link
Copy Markdown

Fixes #253

Summary & Motivation

  • PolarsBigQueryTypeHandler converted frames with DataFrame.to_pandas(), which casts pl.Date to datetime64. BigQuery therefore created TIMESTAMP columns instead of DATE.
  • Use to_pandas(date_as_object=True) so pl.Date stays as datetime.date and the BigQuery client infers DATE. Datetime and string columns are unchanged.

How I Tested These Changes

  • Added dagster_polars_tests/test_bigquery.py (first BigQuery handler tests). The regression test mocks the BigQuery client and asserts the schema inferred for the frame passed to load_table_from_dataframe: DATE for pl.Date, TIMESTAMP for pl.Datetime, STRING for strings. It fails without the fix and passes with it.
  • ruff check, ruff format --check and ty check pass. Not tested against a live BigQuery project.

Changelog

Entry added to libraries/dagster-polars/CHANGELOG.md.

Sam Razavi added 2 commits October 12, 2026 18:37
PolarsBigQueryTypeHandler converted frames with DataFrame.to_pandas(),
which casts pl.Date to datetime64, so BigQuery created TIMESTAMP columns.
Use date_as_object=True so the BigQuery client infers DATE.

Adds the first BigQuery handler tests, including a regression test for
this behaviour.

Fixes dagster-io#253

This branch has not been deployed

No deployments
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.

Dagster Polars Bigquery IO manager does not store dates as date but datetime

1 participant