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 for web generated documentation #2047

Closed
1 of 5 tasks
bcg0006 opened this issue Jan 14, 2020 · 1 comment · Fixed by #2106
Closed
1 of 5 tasks

Bug for web generated documentation #2047

bcg0006 opened this issue Jan 14, 2020 · 1 comment · Fixed by #2106
Labels
bug Something isn't working

Comments

@bcg0006
Copy link

bcg0006 commented Jan 14, 2020

Describe the bug

I am facing the following issue with dbt docs generate
We are using Snowflake and column names with double quotation marks meaning that in the schema.yml file when we specify the column name we have to do the following: '"ColumnName"' for tests to run.
The issues is that that then we get two columns references in the web documentation we get duplicates as you can see in the Screenshots

Steps To Reproduce

dbt docs generate 
dbt docs serve 

=> with config as in additional information

Expected behavior

Support a config in the schema.yml spec which would wrap a given column in quotes. That way, you could avoid specifying a column like ’“ColumnName”’, and instead just specify ColumnName with a quote: true flag provided. The docs should handle this config gracefully and it’ll be less typing/weirdness in the schema.yml file

=> suggestion from @drewbanin

Screenshots and log output

If applicable, add screenshots or log output to help explain your problem.
image

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

dbt version: 0.15.0
python version: 3.7.5
os info: Windows-10-10.0.18362-SP0

Additional information

the schema.yml :

models:
  - name: Majority_DimUser
    columns:
      - name: '"UserKey"'
        description: UserKey is one of the unique identifier for the User
        tests:
          - not_null
          - unique

the dbt_project.yml

name: 'looker_wh'
version: '1.0'

source-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
data-paths: ["data"]
macro-paths: ["macros"]

target-path: "target"  # directory which will store compiled SQL files
clean-targets:         # directories to be removed by `dbt clean`
    - "target"
    - "dbt_modules"

quoting:
  identifier: true
  schema: true
@bcg0006 bcg0006 added bug Something isn't working triage labels Jan 14, 2020
@drewbanin drewbanin removed the triage label Jan 20, 2020
@drewbanin drewbanin added this to the Barbara Gittings milestone Jan 20, 2020
@drewbanin
Copy link
Contributor

Thanks for the report @bcg0006! I just queued this issue up for our 0.16.0 release.

I think a viable syntax might look like:

models:
  - name: Majority_DimUser
    columns:
      - name: UserKey
        description: UserKey is one of the unique identifier for the User
        quote: true # This would be new
        tests:
          - not_null
          - unique

If dbt encountered a true value for the quote config, then dbt would quote the column before interpolating it into SQL queries (like in tests). dbt would not quote the column when rendering the documentation website. I suppose it would also be good to support this config at the model-level so that you wouldn't need to quote every mixed-case column explicitly.

The other broad approach we could take here would be to fetch the columns in the destination table in a dbt test, then determine the appropriate quoting/casing for the column. I think that's a pretty heavy-handed way to go about doing this, but I did want to raise it as a possible solution.

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

Successfully merging a pull request may close this issue.

2 participants