Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Parsing Error in dbt Artifacts JSON Conversion of Source with Case-Sensitive Column Names in Filters for dbt freshness #419

Open
jjose1508 opened this issue Feb 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jjose1508
Copy link

Overview

When the dbt_artifacts.upload_results(results) function is called, an error occurs during the JSON conversion process for artifacts. This happens specifically for a source configuration in src_schema.yml that includes a filter with a case-sensitive column name within apostrophes, as in filter: datediff('day', "_etl_loaded_at", current_timestamp) < 2. This filter is for dbt freshness checks . The presence of the apostrophe appears to disrupt the JSON parsing, resulting in a failure to upload artifacts.

How to reproduce

Define a source in src_schema.yml with a filter expression that includes a case-sensitive column name within an SQL function, for example:

- identifier: table
  name: table_name
  loaded_at_field: '"timestamp_column"::timestamp_ntz(9)'
  freshness:
    error_after:
      count: 36
      period: minute
    warn_after:
      count: 21
      period: minute
  filter: datediff('day', "_etl_loaded_at", current_timestamp) < 2

Run a dbt project that includes the dbt_artifacts.upload_results(results) call in an on-run-end hook.
Observe the error during the JSON conversion process when the artifact upload is attempted.

Expected behaviour

The dbt_artifacts.upload_results(results) function should process and upload artifacts without errors, even when the src_schema.yml contains filter expressions with case-sensitive column names within apostrophes. The JSON conversion process should handle these cases seamlessly to allow for successful artifact uploads.

Screenshots

Environment

Results of running dbt --version:

Core:
  - installed: 1.7.3
  - latest:    1.7.8 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - snowflake: 1.7.1 - Update available!

  At least one plugin is out of date or incompatible with dbt-core.
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

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

packages:
    - package: dbt-labs/dbt_utils
      version: 1.1.1
    - package: brooklyn-data/dbt_artifacts
      version: 2.6.2
    - package: calogica/dbt_date
      version: [">=0.7.0", "<=0.10.0"]
    - package: get-select/dbt_snowflake_monitoring
      version: 4.6.0

  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant