Skip to main content

Dialect

Enum Dialect 

Source
#[non_exhaustive]
pub enum Dialect { Snowflake, Databricks, }
Expand description

The SQL dialect a lex/parse/format request targets.

#[non_exhaustive] so further dialects can be added without it being a breaking change. Default is Dialect::Snowflake.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Snowflake

Snowflake SQL — the original and default dialect of this toolchain.

§

Databricks

Databricks SQL / Spark SQL. Behavior is being filled in across later phases; today its predicate answers describe the intended divergence but no Databricks-specific lexing, parsing, or formatting is wired up yet.

Implementations§

Source§

impl Dialect

Source

pub fn supports_dollar_quoting(self) -> bool

Dollar quoting: $$ ... $$ dollar-quoted bodies and $1 / $name positional/variable references. Snowflake only — Databricks has no $$ body or $n reference.

Source

pub fn supports_flow_operator(self) -> bool

The flow operator ->> chaining statements into a pipeline. Snowflake only.

Source

pub fn supports_copy_into(self) -> bool

COPY INTO <target> FROM <source> bulk load/unload. Snowflake only.

Source

pub fn supports_double_slash_comments(self) -> bool

// ... line comments. Snowflake accepts them; Databricks/Spark uses / as an operator and must not have a doubled slash consume the rest of the physical line.

Source

pub fn supports_semantic_view(self) -> bool

CREATE SEMANTIC VIEW ... semantic-layer DDL. Snowflake only.

Source

pub fn supports_scripting_blocks(self) -> bool

SQL scripting blocks: BEGIN ... END, declarations, control-flow statements, and the := assignment operator. Snowflake and Databricks both support compound SQL blocks.

Source

pub fn supports_stage_refs(self) -> bool

Stage references: @stage / @~ / @%table paths in FROM, COPY, and PUT/GET. Snowflake only.

Source

pub fn supports_backtick_identifiers(self) -> bool

Backtick-quoted identifiers: `col`. Databricks only (Snowflake quotes with ").

Source

pub fn supports_prefixed_strings(self) -> bool

Databricks/Spark prefixed string literals such as raw strings (r'...') and hex binary literals (X'1A').

Source

pub fn supports_null_safe_eq(self) -> bool

Databricks/Spark null-safe equality operator: <=>.

Source

pub fn supports_lateral_view(self) -> bool

LATERAL VIEW explode(...) table-generating clause. Databricks only.

Source

pub fn supports_delta_table_options(self) -> bool

Delta/Spark table DDL options: USING, LOCATION, TBLPROPERTIES, OPTIONS, and PARTITIONED BY. Databricks only.

Source

pub fn supports_lambda_expr(self) -> bool

Higher-order-function lambdas: x -> expr and (x, y) -> expr. Databricks only for now.

Source

pub fn supports_as_of_travel(self) -> bool

Time travel via VERSION AS OF / TIMESTAMP AS OF. Databricks only (Snowflake uses AT / BEFORE).

Source

pub fn supports_databricks_query_clauses(self) -> bool

Databricks/Spark query distribution clauses: DISTRIBUTE BY, SORT BY, and CLUSTER BY.

Source

pub fn supports_delta_commands(self) -> bool

Delta/Spark maintenance + cache statements — VACUUM, OPTIMIZE … ZORDER BY, INSERT OVERWRITE, CACHE/UNCACHE/REFRESH, DESCRIBE HISTORY, and the WHEN NOT MATCHED BY SOURCE/INSERT * MERGE extensions. Databricks only. The leading words (VACUUM, OPTIMIZE, CACHE, …) are recognized contextually at statement start, so they stay ordinary identifiers under Snowflake (and elsewhere under Databricks), and Snowflake output is byte-identical.

Trait Implementations§

Source§

impl Clone for Dialect

Source§

fn clone(&self) -> Dialect

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Dialect

Source§

impl Debug for Dialect

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Dialect

Source§

fn default() -> Dialect

Returns the “default value” for a type. Read more
Source§

impl Eq for Dialect

Source§

impl Hash for Dialect

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Dialect

Source§

fn eq(&self, other: &Dialect) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Dialect

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.