DBT (Data Build Tool) quoting refers to the process of wrapping a string or identifier in quotes in SQL statements. This helps to prevent ambiguity and ensure that the SQL engine recognizes the string or identifier as a single entity, rather than interpreting it as multiple separate entities.
In DBT, two types of quotes are commonly used: single quotes ('
) and double quotes ("
). The choice of quote depends on the underlying SQL engine and the specific use case.
For example, in PostgreSQL and Redshift, single quotes are used to define string literals:
select 'hello world';
In BigQuery, double quotes are used for string literals:
select "hello world";
In SQL statements that include table or column names, quoting is used to prevent reserved keywords from being interpreted as such by the SQL engine, and to allow for names that include spaces or special characters. For example:
select "column 1" from "table name";
It’s important to note that the rules for quoting may vary between SQL engines, so it’s always best to consult the documentation for the specific SQL engine being used in a given project.
quoting:
database: true
schema: true
identifier: true
Get more useful articles on dbt