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

Quoting for database catalogs, schemas, tables, and columns #3518

Open
1 task done
dbeatty10 opened this issue Jun 13, 2023 · 0 comments
Open
1 task done

Quoting for database catalogs, schemas, tables, and columns #3518

dbeatty10 opened this issue Jun 13, 2023 · 0 comments
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Jun 13, 2023

Contributions

  • I have read the contribution docs, and understand what's expected of me.

Link to the page on docs.getdbt.com requiring updates

There are a couple things that are mostly frequently quoted within SQL:

  1. database identifier names
  2. column names and values

For example, all of the following can be quoted within SQL:

  • database / catalog names (project in BigQuery)
  • schema names (dataset in BigQuery)
  • identifier names (table / view / etc. names)
  • column names
  • column values
  • other database object names (users, roles, indexes, etc.)

We have all of the following documentation, but it rarely refers to each other:

For database, schema, and identifier names

  • quoting - Configuring quoting in projects (for database, schema, and identifier)
  • quoting - Configuring quoting in sources (for database, schema, and identifier)
  • quoted method in the Relation class - Applying quoting to relations (for database, schema, and identifier) (source)
  • as_case_sensitive in the SnowflakeRelation class (see also: dbt-snowflake #1111)

For column names

  • quote - Configuring quoting in models for column names
    • also sources, seeds, snapshots, and analyses if you click the tabs
  • quote_columns - Configuring quoting in seed files for column names
  • quoted method in the Column class via Column API - Applying quoting to relation columns for column names
  • quote_identifiers in macros within dbt_utils (like star and pivot)

For column values

For multiple purposes

  • adapter.quote - Applying quoting via the adapter-specific macro to a column name or individual components of a (database, schema, identifier) combo (or even other database objects like users or roles) (source).
    • quote_as_configured - Quote or do not quote the given database, schema, or identifier according to the quoting project configuration.

For users / groups / roles in grants

As hinted at in dbt-labs/dbt-postgres#55, we don't have any mechanism to specify that a grant should be quoted. i.e., we don't have a quote_grants config.

What part(s) of the page would you like to see updated?

It would be an improvement to merely cross-link these different pages so that the first result in a Google search is likely to eventually lead where you want to get.

Additional information

Instigating scenario: dbt-labs/dbt-core#7832

dbt-labs/dbt-core#2986 aims to unify all of these under a single quote config/property, but the earliest that might happen is v1.9+, and we'd want to clarify things for users earlier than that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

No branches or pull requests

1 participant