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] v1 satellite not escaping column names if keyword #328

Open
maxmue opened this issue Feb 25, 2025 · 0 comments
Open

[BUG] v1 satellite not escaping column names if keyword #328

maxmue opened this issue Feb 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@maxmue
Copy link

maxmue commented Feb 25, 2025

Describe the bug

In my source table, I have a column names called order and default. Therefore, in my staging model, I put - "\"order\"" in the hashdiff list, and in the v0 satellite, I put - "\"order\"", too.

However, the v1 satellite macro puts non-escaped ORDER and DEFAULT in the code. I fixed this by doing {{ datavault4dbt.sat_v1(yaml_metadata=yaml_metadata) | replace("DEFAULT", "\"DEFAULT\"") }} but that's merely a dirty hack.

Environment

  • dbt version: cloud/latest
  • datavault4dbt version: v1.9.3
  • Database/Platform: Redshift

To Reproduce

Please provide:

Staging model:

{%- set yaml_metadata -%}
source_model: the_source_model
ldts: "timestamp"
rsrc: "!..."
hashed_columns:
  hk_foo_h:
    - id

  ...

  hd_foo_v0_s:
    is_hashdiff: true
    columns:
      - "\"default\""
      - ...
{%- endset -%}

{{ datavault4dbt.stage(yaml_metadata=yaml_metadata) }}

V1 Satellite:

{%- set yaml_metadata -%}
parent_hashkey: hk_foo_h
src_hashdiff: hd_foo_v0_s
src_payload:
  - "\"default\""
  - ...
source_model: stg_foo
{%- endset -%}

{{ datavault4dbt.sat_v0(yaml_metadata=yaml_metadata) }}

V1 Satellite:

{{ config(materialized="view") }}

{%- set yaml_metadata -%}
sat_v0: 'foo_v1'
hashkey: 'hk_foo_h'
hashdiff: 'hd_foo_v0_s'
ledts_alias: 'loadenddate'
add_is_current_flag: true
{%- endset -%}

{{ datavault4dbt.sat_v1(yaml_metadata=yaml_metadata) }}

Expected behavior

Column names are escaped in v1 satellite (if keyword). I'm fine with all being escaped.

@maxmue maxmue added the bug Something isn't working label Feb 25, 2025
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