dbt-utils icon indicating copy to clipboard operation
dbt-utils copied to clipboard

`pivot` macro `quote_identifiers` not working

Open Ishankoradia opened this issue 10 months ago • 0 comments

Describe the bug

The pivot macro is not actually quoting the column even after setting quote_identifiers= true.

Steps to reproduce

I create a model that looked like this Screenshot 2024-04-11 at 15 47 55

Expected results

Was expecting the Month column to quoted in the compiled model. This is how the compiled model looks like

Screenshot 2024-04-11 at 15 48 48

Actual results

Screenshots and log output

This is error log Screenshot 2024-04-11 at 15 51 35

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_utils
    version: 1.1.1

Which database are you using dbt with?

  • [x] postgres
  • [ ] redshift
  • [x] bigquery
  • [ ] snowflake
  • [ ] other (specify: ____________)

The output of dbt --version:

Core:
  - installed: 1.6.6 
  - latest:    1.7.11 - 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:
  - bigquery: 1.6.7 - Update available!
  - postgres: 1.6.6 - 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

Additional context

Are you interested in contributing the fix?

From my investigation, it looks like in the pivot macro we never quote the pivot column. Screenshot 2024-04-11 at 15 53 26

The line no 72 should have been adapter.quote(column). After doing this, the above error goes away and the column is actually quoted. Correct me if I got it wrong.

Ishankoradia avatar Apr 11 '24 10:04 Ishankoradia