dbt-labs / dbt-labs/docs.getdbt.com

Example of escaping the `quote` character in a source definition

Open
#7,735 0 comments 0 reactions 1 assignee Claimed by @runleonarun View on GitHub
content improvement
Dominant language
JavaScript
Stars
215
Forks
1.2k
Avg merge
1d 15h
Merged PRs (30d)
130

Description

### Contributions

- [x] I have read the contribution docs, and understand what's expected of me.

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

https://docs.getdbt.com/reference/resource-properties/quoting

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

Include an example for this edge case: https://github.com/dbt-labs/dbt-core/issues/11888#issuecomment-3151436707.

Example for for `dbt-postgres` is here: https://github.com/dbt-labs/dbt-core/issues/11888#issuecomment-3150697113:

```yaml
sources:
- name: my_schema
tables:
- name: my_table
identifier: my""table
quoting:
identifier: true
```

This source then gets rendered like this (which works for Postgres):

```sql
"db"."my_schema"."my""table"
```

### Caveat emptor

The exact escape sequence for this probably varies on a per adapter basis (I didn't fully confirm one way or the other):
```yaml
identifier: my""table
```

For example, the [Postgres docs](https://www.postgresql.org/docs/17/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS) say:

> To include a double quote, write two double quotes.

### Additional information

Quoting is a complicated topic! Lots more info here: https://github.com/dbt-labs/docs.getdbt.com/issues/3518

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.