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 #9679

Closed
2 tasks done
jjose1508 opened this issue Feb 27, 2024 · 2 comments
Labels
bug Something isn't working external_repo The correct repo for this issue is outside of dbt Labs, so this issue can't be transferred

Comments

@jjose1508
Copy link

jjose1508 commented Feb 27, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

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.

Expected Behavior

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.

Steps To Reproduce

  1. 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
  1. Run a dbt project that includes the dbt_artifacts.upload_results(results) call in an on-run-end hook.
  2. Observe the error during the JSON conversion process when the artifact upload is attempted.

Relevant log output

No response

Environment

- OS: 
- Python: 3.10.10
- dbt: 1.7

Which database adapter are you using with dbt?

snowflake

Additional Context

No response

@jjose1508 jjose1508 added bug Something isn't working triage labels Feb 27, 2024
@jaypeedevlin
Copy link
Contributor

I think this probably belongs in https://github.com/brooklyn-data/dbt_artifacts

@dbeatty10
Copy link
Contributor

Thank you for reporting this @jjose1508 !

And thank you @jaypeedevlin for redirecting this to the correct place 🙏

Closing in favor of brooklyn-data/dbt_artifacts#419

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
@dbeatty10 dbeatty10 added external_repo The correct repo for this issue is outside of dbt Labs, so this issue can't be transferred and removed triage labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external_repo The correct repo for this issue is outside of dbt Labs, so this issue can't be transferred
Projects
None yet
Development

No branches or pull requests

3 participants