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

dbt docs generate error on Snowflake when QUOTED_IDENTIFIERS_IGNORE_CASE is set to True #982

Closed
clausherther opened this issue Sep 7, 2018 · 1 comment
Assignees
Labels
bug Something isn't working snowflake

Comments

@clausherther
Copy link
Contributor

dbt docs generate returns the following error on a Snowflake instance where the QUOTED_IDENTIFIERS_IGNORE_CASE parameter is set to True

Encountered an error:
'table_schema'

That is because the following query issued by dbt to get the catalog will have upper case column names.

with tables as (

        select
            table_schema as "table_schema",
            table_name as "table_name",
            table_type as "table_type",

            -- note: this is the _role_ that owns the table
            table_owner as "table_owner",

            'Clustering Key' as "stats:clustering_key:label",
            clustering_key as "stats:clustering_key:value",
            'The key used to cluster this table' as "stats:clustering_key:description",
            (clustering_key is not null) as "stats:clustering_key:include",

            'Row Count' as "stats:row_count:label",
            row_count as "stats:row_count:value",
            'An approximate count of rows in this table' as "stats:row_count:description",
            (row_count is not null) as "stats:row_count:include",

            'Approximate Size' as "stats:bytes:label",
            bytes as "stats:bytes:value",
            'Approximate size of the table as reported by Snowflake' as "stats:bytes:description",
            (bytes is not null) as "stats:bytes:include"

        from information_schema.tables

    ),

    columns as (

        select

            table_schema as "table_schema",
            table_name as "table_name",
            null as "table_comment",

            column_name as "column_name",
            ordinal_position as "column_index",
            data_type as "column_type",
            null as "column_comment"

        from information_schema.columns

    )

    select *
    from tables
    join columns using ("table_schema", "table_name")
    where "table_schema" != 'INFORMATION_SCHEMA'
    order by "column_index"  
table_schema	table_name
ACCT	F_REGISTRATIONS
@drewbanin drewbanin added this to the 0.11.1 - Lucretia Mott milestone Sep 7, 2018
@drewbanin drewbanin added bug Something isn't working snowflake labels Sep 7, 2018
@beckjake beckjake self-assigned this Sep 12, 2018
beckjake added a commit that referenced this issue Sep 13, 2018
…identifiers-case-docs

Fix QUOTED_IDENTIFIERS_IGNORE_CASE errors (#982)
@beckjake
Copy link
Contributor

Fixed in #998

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working snowflake
Projects
None yet
Development

No branches or pull requests

3 participants