DBT relationship test does not correctly support column quoting
See original GitHub issueDescribe the bug
When defining a relationship test (In this case between Person and Invitation) the generated DBT test does not link the relationship back to the destination table column definition. Hence, it does not recognise that a column in a relationship test may require quoting.
Steps To Reproduce
With a Source as follows:

The following test is generated, incorrectly leaving the quotes off the column named Id in the generated sql test.

The following error occurs:

Expected behavior
I would expect DBT to link the column with the definition and respect the quoting setting chosen. For convenience, it may be useful to also add column quoting configuration at the model and source level.
Screenshots and log output
As above
System information
Which database are you using dbt with?
- [ x] postgres
- redshift
- bigquery
- snowflake
- other (specify: ____________)
The output of dbt --version:
installed version: 0.16.1
latest version: 0.16.1
The operating system you’re using:
Mac
The output of python --version:
Python 3.7.3
Additional context
A valid work-around (via Drew) is to quote the Id column manually in the relationships test. You’ll need to use two sets of quotes — one to denote that the value is a string (for yaml) and the next to be passed into the SQL query.

Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (9 by maintainers)

Top Related StackOverflow Question
There’s also
quote_columns, which is a seed-only config item that lives on its own level but surely belongs inside thequotingconfig item (or will it bequote?!) ascolumns😬Really fair point. I guess I could’ve hoped that you would’ve magically stumbled upon https://docs.getdbt.com/reference/resource-properties/quote/.
Why do we call it
quotingfor database/schema/identifier names, but thenquotefor column names? Adding this to my list of nomenclature we might make more consistent in advance of dbt v1.0.Oof, this is old.