Module: Sqlglot::Dialect
- Defined in:
- lib/sqlglot/dialect.rb
Overview
Constants for all 30 SQL dialects supported by sql-glot-rust.
Each constant holds the string name passed to the Rust FFI. Use symbols or strings interchangeably in the public API – Dialect.resolve normalizes them.
Constant Summary collapse
- ANSI =
── Official dialects ──────────────────────────────────────
"ansi"- ATHENA =
"athena"- BIGQUERY =
"bigquery"- CLICKHOUSE =
"clickhouse"- DATABRICKS =
"databricks"- DUCKDB =
"duckdb"- HIVE =
"hive"- MYSQL =
"mysql"- ORACLE =
"oracle"- POSTGRES =
"postgres"- PRESTO =
"presto"- REDSHIFT =
"redshift"- SNOWFLAKE =
"snowflake"- SPARK =
"spark"- SQLITE =
"sqlite"- STARROCKS =
"starrocks"- TRINO =
"trino"- TSQL =
"tsql"- DORIS =
── Community dialects ─────────────────────────────────────
"doris"- DREMIO =
"dremio"- DRILL =
"drill"- DRUID =
"druid"- EXASOL =
"exasol"- FABRIC =
"fabric"- MATERIALIZE =
"materialize"- PRQL =
"prql"- RISINGWAVE =
"risingwave"- SINGLESTORE =
"singlestore"- TABLEAU =
"tableau"- TERADATA =
"teradata"- ALIASES =
Common aliases accepted by the Rust library’s Dialect::from_str.
{ "postgresql" => POSTGRES, "mssql" => TSQL, "sqlserver" => TSQL, "mariadb" => MYSQL, }.freeze
- ALL =
All known dialect names (constants + aliases).
constants .reject { |c| %i[ALIASES ALL].include?(c) } .map { |c| const_get(c) } .freeze
Class Method Summary collapse
-
.resolve(name) ⇒ String?
Normalize a dialect argument to the string the Rust FFI expects.
Class Method Details
.resolve(name) ⇒ String?
Normalize a dialect argument to the string the Rust FFI expects.
Accepts symbols, strings, or nil. Unknown values raise ArgumentError.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/sqlglot/dialect.rb', line 68 def self.resolve(name) return nil if name.nil? key = name.to_s.downcase.strip return key if ALL.include?(key) return ALIASES[key] if ALIASES.key?(key) raise ArgumentError, "Unknown dialect: #{name.inspect}. " \ "Known dialects: #{ALL.sort.join(', ')}" end |