automate-dv icon indicating copy to clipboard operation
automate-dv copied to clipboard

[BUG] Column Escaping Doesn't Work with `NOT` Well

Open Moginu opened this issue 2 years ago • 5 comments

Describe the bug Now dbtvault wraps all the columns with quotes, but not would be in the quotes as well.

Versions

dbt: 1.0.4 dbtvault: 0.8.2

To Reproduce

 {{
     dbtvault.stage(
         source_model = "source_model",
         hashed_columns = {
             "hk_a": "id",
             "a_hashdiff": {
                 "is_hashdiff": true,
                 "columns": [
                     "a",
                 ]
             }
         },
         derived_columns = {
             "derived_column_a": "not column_a",
         },
     )
 }}

The compiled SQL would be like:

derived_columns AS (
    SELECT

    "not column_a" AS "eff_flag",

   FROM source_data
),

Expected behavior The not should be outside the quotes like:

derived_columns AS (
    SELECT

    not "column_a" AS "eff_flag",

   FROM source_data
),

Screenshots If applicable, add screenshots to help explain your problem.

Log files If applicable, provide dbt log files which include the problem.

Additional context Add any other context about the problem here.

Moginu avatar Apr 11 '22 04:04 Moginu