Skip to content

[Bug]: variable serialization for invocation upload fails with dates for dbt-core 1.10.1 #512

@stefankeidel

Description

@stefankeidel

Overview

We're passing some variables to dbt at runtime, one of them is usually a date. When I try to do that with the latest dbt_artifacts (via git) I get a compilation error in the upload_invocations macro, seemingly because the resulting dict can now have actual dates:

Compilation Error in operation data_platform-on-run-end-0 (./dbt_project.yml)
  Object of type date is not JSON serializable

How to reproduce

Use the yaml notation to pass as a date, which apparently causes this to be an actual date in the resulting Python dict in 1.10+

dbt -x build --target dev --vars "{load_date: 2025-06-15}"

It does work when we explicitly make it a string:

dbt -x build --target dev --vars "{load_date: '2025-06-15'}"

Expected behaviour

Invocation gets uploaded regardless of datatype in vars

Screenshots

Image

Environment

Results of running dbt --version:

➜ poetry run dbt --version
Core:
  - installed: 1.10.1
  - latest:    1.10.1 - Up to date!

Plugins:
  - snowflake: 1.9.4 - Up to date!

Please paste the contents of your packages.yml file here:

packages:
  - package: Datavault-UK/automate_dv
    version: 0.11.2
  - git: https://github.com/brooklyn-data/dbt_artifacts.git
    revision: 60778945064e7487674ac6b28293fbbc0f95711f
  - package: dbt-labs/dbt_utils
    version: 1.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions