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

[Stephen Girard] Change database quoting to false by default #1329

Closed
drewbanin opened this issue Mar 2, 2019 · 1 comment
Closed

[Stephen Girard] Change database quoting to false by default #1329

drewbanin opened this issue Mar 2, 2019 · 1 comment
Assignees

Comments

@drewbanin
Copy link
Contributor

Issue

Issue description

In dbt <= 0.12.2, the default database quoting config was set to True. In practice, this didn't typically have any effect as the following things are true:

  • dbt did not use database names when building models
  • dbt did not interpolate database names when compiling ref statements
  • snowflake-connector-python uses the unquoted database identifier as the default database when connecting to Snowflake

As such, we can keep dbt's behavior consistent (and prevent folks from needing to update their profiles to capitalize database names) if we change the default database quoting config to FALSE on Snowflake. This would be appropriate for the 0.13.0 release, as it is indeed a minor version bump.

Results

In a typical Snowflake dbt project (with a lowercased database in the profile), users will see:

$ dbt run --model debug
Running with dbt=0.13.0-a2
Found 48 models, 0 tests, 0 archives, 0 analyses, 193 macros, 1 operations, 1 seed files, 1 sources

Encountered an error:
Database Error
  002003 (02000): 8e826a00-acf2-4ead-9c64-adfe8bfc69bf: SQL compilation error:
  Database '"analytics"' does not exist.

The fix would be for the user to go and upcase the database config in their targets. This error would happen in a bunch of different places, but I think the first occurrence will generally be from the list_relation method:

2019-03-02 17:53:27,882 (MainThread): On list_relations_without_caching:
    select
      table_catalog as database,
      table_name as name,
      table_schema as schema,
      case when table_type = 'BASE TABLE' then 'table'
           when table_type = 'VIEW' then 'view'
           else table_type
      end as table_type
    from "analytics".information_schema.tables  /* This database doesn't exist! */
    where table_schema ilike 'snowplow'
      and table_catalog ilike 'analytics'

System information

The output of dbt --version:

0.13.0-a2
@drewbanin drewbanin added this to the Stephen Girard milestone Mar 2, 2019
@drewbanin drewbanin self-assigned this Mar 2, 2019
@drewbanin
Copy link
Contributor Author

fixed here: #1332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant