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.
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 Snowflake 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 Snowflake 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?
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.
This is based around the PostgreSQL spec, and is also part of the inheritance chain for several other dialects which were heavily inspired by this one. The Snowflake dialect depends directly on this one, and if you’re running AWS Redshift or Greenplum this is the dialect to use (until someone makes a specific dialect).