Skip to content

fix: handle SampleWindow serialization (#542) - #543

Merged
mtcarlone merged 4 commits into
brooklyn-data:mainfrom
Borisdejonge:fix/542-sample-window-serialization
Nov 6, 2026
Merged

mtcarlone merged 4 commits into
brooklyn-data:mainfrom
Borisdejonge:fix/542-sample-window-serialization

Conversation

@Borisdejonge

Copy link
Copy Markdown

Overview

Fixes #542

When using dbt's --sample flag, the SampleWindow object in invocation_args_dict
is not JSON serializable. This fix handles it the same way warn_error_options is
handled - by converting it to a serializable dict before passing to safe_copy_mapping.

Update type - breaking / non-breaking

  • Minor bug fix
  • Documentation improvements
  • Quality of Life improvements
  • New features (non-breaking change)
  • New features (breaking change)
  • Other (non-breaking change)
  • Other (breaking change)
  • Release preparation

What does this solve?

Fixes #542 - SampleWindow object not JSON serializable when using --sample flag.

The --sample flag (introduced in dbt for event_time based sampling) adds a
SampleWindow Python object to invocation_args_dict. This object cannot be
serialized to JSON, causing upload_invocations to fail.

Outstanding questions

None - the fix follows the existing pattern used for warn_error_options.

What databases have you tested with?

  • Snowflake
  • Google BigQuery
  • Databricks
  • Spark
  • N/A

Boris de Jonge and others added 4 commits February 3, 2026 11:31
Each DuckDB env now runs a model with
--sample '{"start": "2024-01-01", "end": "2099-12-31"}'; before this fix
that run's upload hook failed because dbt Core passes the window as a
SampleWindow object. On dbt Core (latest and 1.10),
assert_sample_window_uploaded then checks the window landed in
invocation_args. The Fusion env runs the step without the content check:
Fusion doesn't put the sample in invocation_args.
@mtcarlone
mtcarlone self-requested a review as a code owner November 6, 2026 23:02
@mtcarlone mtcarlone added this to the 3.0.0 milestone Nov 6, 2026
@mtcarlone
mtcarlone merged commit eacf422 into brooklyn-data:main Nov 6, 2026
6 checks passed
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.

[Bug]: SampleWindow object not JSON serializable when using --sample flag

2 participants