Quoting identifiers

To use identifiers that are otherwise invalid, surround them with backticks. Depending on the dialect, these will remain as backticks or be converted to double-quotes.

PRQL

1. prql target:sql.mysql
2. from employees
3. select `first name`

SQL

1. SELECT
2. `first name`
3. FROM
4. employees

PRQL

1. prql target:sql.postgres
2. from employees
3. select `first name`

SQL

1. SELECT
2. "first name"
3. FROM
4. employees

PRQL

1. from `dir/*.parquet`

SQL

1. SELECT
2. *
3. FROM
4. "dir/*.parquet"

BigQuery also uses backticks to surround project & dataset names (even if valid identifiers) in the SELECT statement:

PRQL

1. prql target:sql.bigquery
2. from `project-foo.dataset.table`
3. join `project-bar.dataset.table` [==col_bax]

SQL

1. SELECT
2. `project-foo.dataset.table`.*,
3. `project-bar.dataset.table`.*
4. FROM
5. `project-foo.dataset.table`
6. JOIN `project-bar.dataset.table` ON `project-foo.dataset.table`.col_bax = `project-bar.dataset.table`.col_bax

Quoting schemas

Note

This is currently not great and we are working on improving it; see <https://github.com/PRQL/prql/issues/1535> for progress.

If supplying a schema without a column — for example in a from or join transform, that also needs to be a quoted identifier:

PRQL

1. from `music.albums`

SQL

1. SELECT
2. *
3. FROM
4. music.albums