Dialects Reference

SQLFluff is designed to be flexible in supporting a variety of dialects. Not all potential dialects are supported so far, but several have been implemented by the community. Below are a list of the currently available dialects. Each inherits from another, up to the root ansi dialect.

For a canonical list of supported dialects, run the sqlfluff dialects command, which will output a list of the current dialects available on your installation of SQLFluff.

Note

For technical users looking to add new dialects or add new features to existing ones, the dependent nature of how dialects have been implemented is to try and reduce the amount of repetition in how different elements are defined. As an example, when we say that the AWS Redshift dialect inherits from the PostgreSQL dialect this is not because there is an agreement between those projects which means that features in one must end up in the other, but that the design of the AWS Redshift dialect was heavily inspired by the postgres dialect and therefore when defining the dialect within sqlfuff it makes sense to use PostgreSQL as a starting point rather than starting from scratch.

Consider when adding new features to a dialect:

  • Should I be adding it just to this dialect, or adding it to a parent dialect?

  • If I’m creating a new dialect, which dialect would be best to inherit from?

  • Will the feature I’m adding break any downstream dependencies within dialects which inherit from this one?

ANSI

Label: ansi

Default Casing: UPPERCASE

Quotes: String Literals: '', Identifiers: ""

This is the base dialect which holds most of the definitions of common SQL commands and structures. If the dialect which you’re actually using isn’t specifically implemented by SQLFluff, using this dialect is a good place to start.

This dialect doesn’t intend to be brutal in adhering to (and only to) the ANSI SQL spec (mostly because ANSI charges for access to that spec). It aims to be a representation of vanilla SQL before any other project adds their spin to it, and so may contain a slightly wider set of functions than actually available in true ANSI SQL.

AWS Athena

Label: athena

Inherits from: ANSI

Default Casing: lowercase

Quotes: String Literals: '', "" or ``, Identifiers: "" or ``

The dialect for Athena on Amazon Web Services (AWS).

Google BigQuery

Label: bigquery

Inherits from: ANSI

Default Casing: BigQuery resolves unquoted column identifiers case insensitively, and table/dataset identifiers case sensitively (by default, unless is_case_insensitive is set for the latter). Unless specified, columns are returned in the case which they were defined in, which means columns can be re-cased in the result set without aliasing e.g. if a table is defined with CREATE TEMPORARY TABLE foo (col1 int, COL2 int) then SELECT * FROM foo returns col1 and COL2 in the result, but SELECT COL1, col2 FROM foo returns COL1 and col2 in the result.

Quotes: String Literals: '', "", @ or @@ (with the quoted options, also supporting variants prefixes with r/R (for raw/regex expressions) or b/B (for byte strings)), Identifiers: "" or ``.

The dialect for BigQuery on Google Cloud Platform (GCP).

ClickHouse

Label: clickhouse

Inherits from: ANSI

Default Casing: Clickhouse is case sensitive throughout, regardless of quoting. An unquoted reference to an object using the wrong case will raise an UNKNOWN_IDENTIFIER error.

Quotes: String Literals: '', Identifiers: "" or ``. Note as above, that because identifiers are always resolved case sensitively, the only reason for quoting identifiers is when they contain invalid characters or reserved keywords.

The dialect for ClickHouse.

Databricks

Label: databricks

Inherits from: Apache Spark SQL

The dialect for Databricks.

IBM Db2

Label: db2

Inherits from: ANSI

The dialect for IBM Db2.

DuckDB

Label: duckdb

Inherits from: PostgreSQL

Default Casing: DuckDB stores all identifiers in the case they were defined, however all identifier resolution is case-insensitive (when unquoted, and more unusually, also when quoted). See the DuckDB Identifiers Documentation for more details.

Quotes: String Literals: '', Identifiers: "" or ''

The dialect for DuckDB.

Exasol

Label: exasol

Inherits from: ANSI

The dialect for Exasol.

Greenplum

Label: greenplum

Inherits from: PostgreSQL

The dialect for Greenplum.

Apache Hive

Label: hive

Inherits from: ANSI

The dialect for Apache Hive.

MariaDB

Label: mariadb

Inherits from: MySQL

Default Casing: lowercase

Quotes: String Literals: '', "" or @, Identifiers: ``.

The dialect for MariaDB.

Materialize

Label: materialize

Inherits from: PostgreSQL

The dialect for Materialize.

MySQL

Label: mysql

Inherits from: ANSI

Default Casing: lowercase

Quotes: String Literals: '', "" or @, Identifiers: ``.

The dialect for MySQL.

Oracle

Label: oracle

Inherits from: ANSI

The dialect for Oracle SQL. Note: this does not include PL/SQL.

PostgreSQL

Label: postgres

Inherits from: ANSI

Default Casing: lowercase

Quotes: String Literals: '', Identifiers: "".

This is based around the PostgreSQL spec. Many other SQL dialects are often based on the PostreSQL syntax. If you’re running an unsupported dialect, then this is often the dialect to use (until someone makes a specific dialect).

AWS Redshift

Label: redshift

Inherits from: PostgreSQL

Default Casing: lowercase (unless configured to be case sensitive with all identifiers using the enable_case_sensitive_identifier configuration value, see the Redshift Names & Identifiers Docs).

Quotes: String Literals: '', Identifiers: "".

The dialect for Redshift on Amazon Web Services (AWS).

Snowflake

Label: snowflake

Inherits from: ANSI

Default Casing: UPPERCASE

Quotes: String Literals: '', Identifiers: ""

The dialect for Snowflake, which has much of its syntax inherited from PostgreSQL.

Salesforce Object Query Language (SOQL)

Label: soql

Inherits from: ANSI

The dialect for SOQL (Salesforce Object Query Language).

Apache Spark SQL

Label: sparksql

Inherits from: ANSI

Default Casing: SparkSQL is case insensitive with both quoted and unquoted identifiers (_”delimited”_ identifiers in Spark terminology). See the Spark Identifiers docs.

Quotes: String Literals: '' or "", Identifiers: ``.

The dialect for Apache Spark SQL. This includes relevant syntax from Apache Hive for commands that permit Hive Format. Spark SQL extensions provided by the Delta Lake project are also implemented in this dialect.

This implementation focuses on the Ansi Compliant Mode introduced in Spark3, instead of being Hive Compliant. The introduction of ANSI Compliance provides better data quality and easier migration from traditional DBMS.

Versions of Spark prior to 3.x will only support the Hive dialect.

SQLite

Label: sqlite

Inherits from: ANSI

Default Casing: Not specified in the docs, but through testing it appears that SQLite stores column names in whatever case they were defined, but is always case-insensitive when resolving those names.

Quotes: String Literals: '' (or "" if not otherwise resolved to an identifier), Identifiers: "", [] or ``. See the SQLite Keywords Docs for more details.

The dialect for SQLite.

Teradata

Label: teradata

Inherits from: ANSI

The dialect for Teradata.

Trino

Label: trino

Inherits from: ANSI

Default Casing: lowercase, although the case of a reference is used in the result set column label. If a column is defined using CREATE TEMPORARY TABLE foo (COL1 int), then SELECT * FROM foo returns a column labelled col1, however SELECT COL1 FROM foo returns a column labelled COL1.

Quotes: String Literals: '', Identifiers: ""

The dialect for Trino.

Microsoft T-SQL

Label: tsql

Inherits from: ANSI

The dialect for T-SQL (aka Transact-SQL).

Vertica

Label: vertica

Inherits from: ANSI

The dialect for Vertica.