Query header: Dialect & Version

Dialect

PRQL allows specifying a dialect at the top of the query, which allows PRQL to compile to a database-specific SQL flavor.

Examples

PRQL

prql dialect:postgres

from employees
sort age
take 10

SQL

SELECT
  employees.*
FROM
  employees
ORDER BY
  age
LIMIT
  10

PRQL

prql dialect:mssql

from employees
sort age
take 10

SQL

SELECT
  TOP (10) employees.*
FROM
  employees
ORDER BY
  age

Supported dialects

Note that dialect support is very early — most differences are not implemented, and most dialects’ implementations are identical to generic’s. Contributions are very welcome.

  • ansi
  • bigquery
  • clickhouse
  • generic
  • hive
  • mssql
  • mysql
  • postgres
  • sqlite
  • snowflake

Version

PRQL allows specifying a version of the language in the PRQL header, like:

PRQL

prql version:1

from employees

SQL

SELECT
  employees.*
FROM
  employees

When the functionality is implemented, it will allow the language to evolve without breaking existing queries.