brooklyn-data / dbt_artifacts

A dbt package for modelling dbt metadata. https://brooklyn-data.github.io/dbt_artifacts
Apache License 2.0
309 stars 113 forks source link

[Bug]: Object of type date is not JSON serializable #416

Open taylorterwin opened 6 months ago

taylorterwin commented 6 months ago

Overview

When using dbt_artifacts package on dbt versions > 1.4 version, running errors upon uploading artifacts with following error for on-run-end: - "{{ dbt_artifacts.upload_results(results) }}"), and it does not upload full artifacts to Snowflake as per functionalities.

`21:29:18 Running with dbt=1.6.9

21:29:18 Registered adapter: snowflake=1.6.6

21:29:19 [WARNING]: Configuration paths exist in your dbt_project.yml file which do not apply to any resources. There are 2 unused configuration paths: - models.PLI_PROJECT.presentation.analytics - models.PLI_PROJECT.example

21:29:19 Found 74 models, 1 snapshot, 7 analyses, 21 tests, 1 seed, 1 operation, 16 sources, 0 exposures, 0 metrics, 882 macros, 0 groups, 0 semantic models

21:29:22 Concurrency: 4 threads (target='dev')

21:29:25 Running 1 on-run-end hook

21:29:27 Database error while running on-run-end

21:29:27 Finished running 4 tests in 0 hours 0 minutes and 7.87 seconds (7.87s).

21:29:27 Completed with 1 error and 0 warnings:

21:29:27 on-run-end failed, error: Object of type date is not JSON serializable

21:29:27 Done. PASS=4 WARN=0 ERROR=1 SKIP=0 TOTAL=5

Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'start', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f41496b4220>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f41496b43d0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f41496b4dc0>]}
`

How to reproduce

dbt version 1.6 with snowflake adapter 1.6.6 run dbt artifacts dbt run --select dbt_artifacts

Expected behaviour

completed on-run-end-hook and upload of artifacts to snowflake

Environment

dbt=1.6.9
snowflake=1.6.6

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

`packages:

  - package: dbt-labs/codegen

    version: 0.10.0

  - package: calogica/dbt_expectations

    version: [">=0.9.0", "<0.10.0"]

    # <see https://github.com/calogica/dbt-expectations/releases/latest> for the latest version tag

  - package: brooklyn-data/dbt_artifacts

    version: 2.6.2  

  - package: dbt-labs/dbt_utils

    version: 1.1.1

  - package: dbt-labs/dbt_external_tables

    version: <2.0.0`