Skip to main content

GeneratorConfig

Struct GeneratorConfig 

Source
pub struct GeneratorConfig {
Show 110 fields pub pretty: bool, pub indent: String, pub max_text_width: usize, pub identifier_quote: char, pub identifier_quote_style: IdentifierQuoteStyle, pub uppercase_keywords: bool, pub normalize_identifiers: bool, pub dialect: Option<DialectType>, pub normalize_functions: NormalizeFunctions, pub string_escape: char, pub case_sensitive_identifiers: bool, pub identifiers_can_start_with_digit: bool, pub always_quote_identifiers: bool, pub null_ordering_supported: bool, pub ignore_nulls_in_func: bool, pub nvl2_supported: bool, pub limit_fetch_style: LimitFetchStyle, pub limit_is_top: bool, pub limit_only_literals: bool, pub single_string_interval: bool, pub interval_allows_plural_form: bool, pub cte_recursive_keyword_required: bool, pub values_as_table: bool, pub wrap_derived_values: bool, pub tablesample_seed_keyword: &'static str, pub tablesample_requires_parens: bool, pub tablesample_size_is_rows: bool, pub tablesample_keywords: &'static str, pub tablesample_with_method: bool, pub alias_post_tablesample: bool, pub aggregate_filter_supported: bool, pub multi_arg_distinct: bool, pub quantified_no_paren_space: bool, pub supports_median: bool, pub supports_select_into: bool, pub locking_reads_supported: bool, pub rename_table_with_db: bool, pub semi_anti_join_with_side: bool, pub supports_table_alias_columns: bool, pub join_hints: bool, pub table_hints: bool, pub query_hints: bool, pub query_hint_sep: &'static str, pub supports_column_join_marks: bool, pub index_using_no_space: bool, pub supports_unlogged_tables: bool, pub supports_create_table_like: bool, pub like_property_inside_schema: bool, pub alter_table_include_column_keyword: bool, pub supports_table_copy: bool, pub alter_set_type: &'static str, pub alter_set_wrapped: bool, pub tz_to_with_time_zone: bool, pub supports_convert_timezone: bool, pub json_type_required_for_extraction: bool, pub json_path_bracketed_key_supported: bool, pub json_path_single_quote_escape: bool, pub quote_json_path: bool, pub json_key_value_pair_sep: &'static str, pub copy_params_are_wrapped: bool, pub copy_params_eq_required: bool, pub copy_has_into_keyword: bool, pub supports_window_exclude: bool, pub unnest_with_ordinality: bool, pub lowercase_window_frame_keywords: bool, pub normalize_window_frame_between: bool, pub array_concat_is_var_len: bool, pub array_size_dim_required: Option<bool>, pub can_implement_array_any: bool, pub array_size_name: &'static str, pub supports_between_flags: bool, pub is_bool_allowed: bool, pub ensure_bools: bool, pub extract_allows_quotes: bool, pub normalize_extract_date_parts: bool, pub try_supported: bool, pub supports_uescape: bool, pub supports_to_number: bool, pub supports_single_arg_concat: bool, pub last_day_supports_date_part: bool, pub supports_exploding_projections: bool, pub supports_unix_seconds: bool, pub supports_like_quantifiers: bool, pub supports_decode_case: bool, pub set_op_modifiers: bool, pub update_statement_supports_from: bool, pub collate_is_func: bool, pub duplicate_key_update_with_set: bool, pub insert_overwrite: &'static str, pub returning_end: bool, pub matched_by_source: bool, pub create_function_return_as: bool, pub parameter_default_equals: bool, pub computed_column_with_type: bool, pub unpivot_aliases_are_identifiers: bool, pub star_except: &'static str, pub hex_func: &'static str, pub with_properties_prefix: &'static str, pub pad_fill_pattern_is_required: bool, pub index_on: &'static str, pub groupings_sep: &'static str, pub struct_delimiter: (&'static str, &'static str), pub struct_curly_brace_notation: bool, pub array_bracket_only: bool, pub struct_field_sep: &'static str, pub except_intersect_support_all_clause: bool, pub parameter_token: &'static str, pub named_placeholder_token: &'static str, pub data_type_specifiers_allowed: bool, pub schema_comment_with_eq: bool,
}
Expand description

Configuration for the SQL Generator.

This is a comprehensive port of the Python sqlglot Generator class attributes. It controls every aspect of SQL output: formatting, quoting, dialect-specific syntax, feature support flags, and more.

Most users should start from GeneratorConfig::default() and override only the fields they need. Dialect-specific presets are applied automatically when dialect is set via the higher-level transpilation API.

§Key fields

FieldDefaultPurpose
dialectNoneTarget SQL dialect (e.g. PostgreSQL, MySQL, BigQuery)
prettyfalseEnable multi-line, indented output
indent" "Indentation string used when pretty is true
max_text_width80Soft line-width limit for pretty-printing
normalize_functionsUpperFunction name casing (Upper, Lower, None)
identifier_quote_style"…"Quote characters for identifiers
uppercase_keywordstrueWhether SQL keywords are upper-cased

Fields§

§pretty: bool

Pretty print with indentation

§indent: String

Indentation string (default 2 spaces)

§max_text_width: usize

Maximum text width before wrapping (default 80)

§identifier_quote: char

Quote identifier style (deprecated, use identifier_quote_style instead)

§identifier_quote_style: IdentifierQuoteStyle

Identifier quote style with separate start/end characters

§uppercase_keywords: bool

Uppercase keywords

§normalize_identifiers: bool

Normalize identifiers to lowercase when generating

§dialect: Option<DialectType>

Dialect type for dialect-specific generation

§normalize_functions: NormalizeFunctions

How to output function names (UPPER, lower, or as-is)

§string_escape: char

String escape character

§case_sensitive_identifiers: bool

Whether identifiers are case-sensitive

§identifiers_can_start_with_digit: bool

Whether unquoted identifiers can start with a digit

§always_quote_identifiers: bool

Whether to always quote identifiers regardless of reserved keyword status Used by dialects like Athena/Presto that prefer quoted identifiers

§null_ordering_supported: bool

Whether null ordering (NULLS FIRST/LAST) is supported in ORDER BY True: Full Support, false: No support

§ignore_nulls_in_func: bool

Whether ignore nulls is inside the agg or outside FIRST(x IGNORE NULLS) OVER vs FIRST(x) IGNORE NULLS OVER

§nvl2_supported: bool

Whether the NVL2 function is supported

§limit_fetch_style: LimitFetchStyle

How to output LIMIT clauses

§limit_is_top: bool

Whether to generate the limit as TOP instead of LIMIT

§limit_only_literals: bool

Whether limit and fetch allows expressions or just literals

§single_string_interval: bool

Whether INTERVAL uses single quoted string (‘1 day’ vs 1 DAY)

§interval_allows_plural_form: bool

Whether the plural form of date parts (e.g., “days”) is supported in INTERVALs

§cte_recursive_keyword_required: bool

Whether WITH RECURSIVE keyword is required (vs just WITH for recursive CTEs)

§values_as_table: bool

Whether VALUES can be used as a table source

§wrap_derived_values: bool

Wrap derived values in parens (standard but Spark doesn’t support)

§tablesample_seed_keyword: &'static str

Keyword for TABLESAMPLE seed: “SEED” or “REPEATABLE”

§tablesample_requires_parens: bool

Whether parentheses are required around the table sample’s expression

§tablesample_size_is_rows: bool

Whether a table sample clause’s size needs to be followed by ROWS keyword

§tablesample_keywords: &'static str

The keyword(s) to use when generating a sample clause

§tablesample_with_method: bool

Whether the TABLESAMPLE clause supports a method name, like BERNOULLI

§alias_post_tablesample: bool

Whether the table alias comes after tablesample (Oracle, Hive)

§aggregate_filter_supported: bool

Whether aggregate FILTER (WHERE …) is supported

§multi_arg_distinct: bool

Whether DISTINCT can be followed by multiple args in an AggFunc

§quantified_no_paren_space: bool

Whether ANY/ALL quantifiers have no space before (: ANY( vs ANY (

§supports_median: bool

Whether MEDIAN(expr) is supported; if not, generates PERCENTILE_CONT

§supports_select_into: bool

Whether SELECT … INTO is supported

§locking_reads_supported: bool

Whether locking reads (SELECT … FOR UPDATE/SHARE) are supported

§rename_table_with_db: bool

Whether a table is allowed to be renamed with a db

§semi_anti_join_with_side: bool

Whether JOIN sides (LEFT, RIGHT) are supported with SEMI/ANTI join kinds

§supports_table_alias_columns: bool

Whether named columns are allowed in table aliases

§join_hints: bool

Whether join hints should be generated

§table_hints: bool

Whether table hints should be generated

§query_hints: bool

Whether query hints should be generated

§query_hint_sep: &'static str

What kind of separator to use for query hints

§supports_column_join_marks: bool

Whether Oracle-style (+) join markers are supported (Oracle, Exasol)

§index_using_no_space: bool

Whether CREATE INDEX USING method should have no space before column parens true: USING btree(col), false: USING btree (col)

§supports_unlogged_tables: bool

Whether UNLOGGED tables can be created

§supports_create_table_like: bool

Whether CREATE TABLE LIKE statement is supported

§like_property_inside_schema: bool

Whether the LikeProperty needs to be inside the schema clause

§alter_table_include_column_keyword: bool

Whether the word COLUMN is included when adding a column with ALTER TABLE

§supports_table_copy: bool

Whether CREATE TABLE .. COPY .. is supported (false = CLONE instead)

§alter_set_type: &'static str

The syntax to use when altering the type of a column

§alter_set_wrapped: bool

Whether to wrap in AlterSet, e.g., ALTER … SET ()

§tz_to_with_time_zone: bool

Whether TIMESTAMP WITH TIME ZONE is used (vs TIMESTAMPTZ)

§supports_convert_timezone: bool

Whether CONVERT_TIMEZONE() is supported

§json_type_required_for_extraction: bool

Whether the JSON extraction operators expect a value of type JSON

§json_path_bracketed_key_supported: bool

Whether bracketed keys like [“foo”] are supported in JSON paths

§json_path_single_quote_escape: bool

Whether to escape keys using single quotes in JSON paths

§quote_json_path: bool

Whether to quote the generated expression of JsonPath

§json_key_value_pair_sep: &'static str

What delimiter to use for separating JSON key/value pairs

§copy_params_are_wrapped: bool

Whether parameters from COPY statement are wrapped in parentheses

§copy_params_eq_required: bool

Whether values of params are set with “=” token or empty space

§copy_has_into_keyword: bool

Whether COPY statement has INTO keyword

§supports_window_exclude: bool

Whether EXCLUDE in window specification is supported

§unnest_with_ordinality: bool

UNNEST WITH ORDINALITY (presto) instead of UNNEST WITH OFFSET (bigquery)

§lowercase_window_frame_keywords: bool

Whether window frame keywords (ROWS/RANGE/GROUPS, PRECEDING/FOLLOWING) should be lowercase Exasol uses lowercase for these specific keywords

§normalize_window_frame_between: bool

Whether to normalize single-bound window frames to BETWEEN form e.g., ROWS 1 PRECEDING → ROWS BETWEEN 1 PRECEDING AND CURRENT ROW

§array_concat_is_var_len: bool

Whether ARRAY_CONCAT can be generated with varlen args

§array_size_dim_required: Option<bool>

Whether exp.ArraySize should generate the dimension arg too None -> Doesn’t support, false -> optional, true -> required

§can_implement_array_any: bool

Whether any(f(x) for x in array) can be implemented

§array_size_name: &'static str

Function used for array size

§supports_between_flags: bool

Whether SYMMETRIC and ASYMMETRIC flags are supported with BETWEEN

§is_bool_allowed: bool

Whether comparing against booleans (e.g. x IS TRUE) is supported

§ensure_bools: bool

Whether conditions require booleans WHERE x = 0 vs WHERE x

§extract_allows_quotes: bool

Whether to generate an unquoted value for EXTRACT’s date part argument

§normalize_extract_date_parts: bool

Whether to normalize date parts in EXTRACT

§try_supported: bool

Whether the conditional TRY(expression) function is supported

§supports_uescape: bool

Whether the UESCAPE syntax in unicode strings is supported

§supports_to_number: bool

Whether the function TO_NUMBER is supported

§supports_single_arg_concat: bool

Whether CONCAT requires >1 arguments

§last_day_supports_date_part: bool

Whether LAST_DAY function supports a date part argument

§supports_exploding_projections: bool

Whether a projection can explode into multiple rows

§supports_unix_seconds: bool

Whether UNIX_SECONDS(timestamp) is supported

§supports_like_quantifiers: bool

Whether LIKE and ILIKE support quantifiers such as LIKE ANY/ALL/SOME

§supports_decode_case: bool

Whether multi-argument DECODE(…) function is supported

§set_op_modifiers: bool

Whether set op modifiers apply to the outer set op or select

§update_statement_supports_from: bool

Whether FROM is supported in UPDATE statements

§collate_is_func: bool

Whether COLLATE is a function instead of a binary operator

§duplicate_key_update_with_set: bool

Whether to include “SET” keyword in “INSERT … ON DUPLICATE KEY UPDATE”

§insert_overwrite: &'static str

INSERT OVERWRITE TABLE x override

§returning_end: bool

Whether to generate INSERT INTO … RETURNING or INSERT INTO RETURNING …

§matched_by_source: bool

Whether MERGE … WHEN MATCHED BY SOURCE is allowed

§create_function_return_as: bool

Whether create function uses an AS before the RETURN

§parameter_default_equals: bool

Whether to use = instead of DEFAULT for parameter defaults (TSQL style)

§computed_column_with_type: bool

Whether to include the type of a computed column in the CREATE DDL

§unpivot_aliases_are_identifiers: bool

Whether UNPIVOT aliases are Identifiers (false means they’re Literals)

§star_except: &'static str

The keyword to use when generating a star projection with excluded columns

§hex_func: &'static str

The HEX function name

§with_properties_prefix: &'static str

The keywords to use when prefixing WITH based properties

§pad_fill_pattern_is_required: bool

Whether the text pattern/fill (3rd) parameter of RPAD()/LPAD() is optional

§index_on: &'static str

The string used for creating an index on a table

§groupings_sep: &'static str

The separator for grouping sets and rollups

§struct_delimiter: (&'static str, &'static str)

Delimiters for STRUCT type

§struct_curly_brace_notation: bool

Whether Struct expressions use curly brace notation: {‘key’: value} (DuckDB)

§array_bracket_only: bool

Whether Array expressions omit the ARRAY keyword: [1, 2] instead of ARRAY[1, 2]

§struct_field_sep: &'static str

Separator between struct field name and type (“: “ for Hive, “ “ for others)

§except_intersect_support_all_clause: bool

Whether EXCEPT and INTERSECT operations can return duplicates

§parameter_token: &'static str

Parameter token character (@ for TSQL, $ for PostgreSQL)

§named_placeholder_token: &'static str

Named placeholder token (: for most, % for PostgreSQL)

§data_type_specifiers_allowed: bool

Whether data types support additional specifiers like CHAR or BYTE (oracle)

§schema_comment_with_eq: bool

Whether schema comments use = sign (COMMENT=‘value’ vs COMMENT ‘value’) StarRocks and Doris use naked COMMENT syntax without =

Trait Implementations§

Source§

impl Clone for GeneratorConfig

Source§

fn clone(&self) -> GeneratorConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GeneratorConfig

Source§

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

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

impl Default for GeneratorConfig

Source§

fn default() -> Self

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

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<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.