SQL Dialects
FlowScope supports 13 SQL dialects with varying levels of syntax coverage. Selecting the correct dialect ensures accurate parsing of dialect-specific functions, quoting styles, and statement syntax.
Supported Dialects
Section titled “Supported Dialects”| Dialect | Use For |
|---|---|
generic | Unknown or mixed SQL |
ansi | Standard ANSI SQL |
postgresql | PostgreSQL, CockroachDB |
snowflake | Snowflake Data Cloud |
bigquery | Google BigQuery |
duckdb | DuckDB |
redshift | Amazon Redshift |
mysql | MySQL, MariaDB |
mssql | Microsoft SQL Server |
sqlite | SQLite |
hive | Apache Hive |
databricks | Databricks SQL |
clickhouse | ClickHouse |
Selecting a Dialect
Section titled “Selecting a Dialect”Web App
Section titled “Web App”Use the dialect dropdown in the editor toolbar. The default is generic which handles most standard SQL.
Use the -d or --dialect flag:
flowscope -d snowflake queries/*.sqlflowscope --dialect bigquery analytics.sqlPass the dialect in the request:
const result = await analyzeSql({ sql: 'SELECT * FROM orders', dialect: 'postgresql'});Dialect-Specific Syntax
Section titled “Dialect-Specific Syntax”PostgreSQL
Section titled “PostgreSQL”-- Array syntaxSELECT array_agg(name) FROM users;SELECT tags[1] FROM posts;
-- Dollar quotingSELECT $tag$literal string$tag$;
-- Type castingSELECT '2024-01-01'::date;SELECT CAST(amount AS numeric(10,2));
-- Array operationsSELECT * FROM orders WHERE tags @> ARRAY['urgent'];Snowflake
Section titled “Snowflake”-- Lateral flattenSELECT f.value:name::stringFROM orders,LATERAL FLATTEN(input => items) f;
-- Semi-structured dataSELECT data:customer:name FROM events;
-- Variant typeSELECT PARSE_JSON('{"key": "value"}');
-- Time travelSELECT * FROM orders AT(TIMESTAMP => '2024-01-01'::timestamp);BigQuery
Section titled “BigQuery”-- Struct and arraySELECT STRUCT(1 AS a, 'hello' AS b);SELECT ARRAY<INT64>[1, 2, 3];
-- UnnestSELECT * FROM UNNEST([1, 2, 3]) AS num;
-- Safe navigationSELECT SAFE.PARSE_DATE('%Y-%m-%d', date_str);
-- Backtick identifiersSELECT * FROM `project.dataset.table`;DuckDB
Section titled “DuckDB”-- List comprehensionSELECT [x * 2 FOR x IN [1, 2, 3]];
-- Struct accessSELECT struct.field FROM data;
-- Positional joinsSELECT * FROM t1 POSITIONAL JOIN t2;
-- Friendly SQLSELECT * FROM 'data.parquet';SELECT * FROM read_csv_auto('file.csv');-- Backtick identifiersSELECT `column` FROM `table`;
-- LIMIT syntaxSELECT * FROM orders LIMIT 10, 20;
-- String functionsSELECT CONCAT_WS('-', year, month, day);
-- INSERT ... ON DUPLICATE KEYINSERT INTO t (id, val) VALUES (1, 'a')ON DUPLICATE KEY UPDATE val = VALUES(val);Redshift
Section titled “Redshift”-- DISTKEY and SORTKEYCREATE TABLE orders ( id INT, date DATE SORTKEY) DISTSTYLE KEY DISTKEY(id);
-- COPY commandCOPY orders FROM 's3://bucket/data'CREDENTIALS 'aws_iam_role=...'FORMAT AS PARQUET;
-- Spectrum external tablesSELECT * FROM spectrum.external_table;Identifier Quoting
Section titled “Identifier Quoting”Different dialects use different quoting styles:
| Dialect | Quote Style | Example |
|---|---|---|
| PostgreSQL | Double quotes | "Column Name" |
| MySQL | Backticks | `Column Name` |
| BigQuery | Backticks | `project.dataset.table` |
| SQL Server | Brackets | [Column Name] |
| ANSI | Double quotes | "Column Name" |
FlowScope normalizes identifiers internally for lineage tracking.
Function Support
Section titled “Function Support”FlowScope recognizes dialect-specific functions:
Aggregations
Section titled “Aggregations”| Function | Dialects |
|---|---|
ARRAY_AGG | PostgreSQL, BigQuery, Snowflake |
STRING_AGG | PostgreSQL, BigQuery |
GROUP_CONCAT | MySQL |
LISTAGG | Snowflake, Redshift |
LIST | DuckDB |
Date Functions
Section titled “Date Functions”| Function | Dialects |
|---|---|
DATE_TRUNC | PostgreSQL, Snowflake, BigQuery, DuckDB |
DATE_PART | PostgreSQL, Snowflake, Redshift |
EXTRACT | All dialects |
DATEDIFF | Snowflake, MySQL, SQL Server |
DATE_SUB | BigQuery, MySQL |
String Functions
Section titled “String Functions”| Function | Dialects |
|---|---|
CONCAT | All dialects |
SUBSTRING | ANSI standard |
SUBSTR | Oracle-style dialects |
SPLIT | BigQuery, Snowflake |
REGEXP_EXTRACT | BigQuery |
REGEXP_MATCHES | PostgreSQL |
Limitations
Section titled “Limitations”Unsupported Syntax
Section titled “Unsupported Syntax”Some dialect features produce parsing warnings:
- Procedural code (stored procedures, functions with bodies)
- Dialect-specific hints and pragmas
- Administrative commands (GRANT, REVOKE)
- Exotic statement types (EXPLAIN, ANALYZE)
FlowScope skips unsupported statements and continues with the rest.
Generic Dialect
Section titled “Generic Dialect”When using the generic dialect:
- Only ANSI-standard syntax is guaranteed
- Dialect-specific functions may not be recognized
- Some valid SQL may produce parse errors
Always select the specific dialect when known for best results.
Dialect Detection
Section titled “Dialect Detection”FlowScope does not auto-detect dialects. Common indicators to help you choose:
| Indicator | Likely Dialect |
|---|---|
| Backtick identifiers | MySQL, BigQuery |
:: type casts | PostgreSQL, DuckDB |
FLATTEN | Snowflake |
UNNEST | BigQuery |
DISTKEY | Redshift |
| Dollar quoting | PostgreSQL |