SQLRemoveSourceSeparator  type: None#

class lumen.transforms.sql.SQLRemoveSourceSeparator(*, separator, comments, error_level, identify, optimize, pretty, read, unsupported_level, write, controls, name)#

Class to exclude the source and separator.


Parameters#

comments

type: bool
default: False
Whether to include comments in the output SQL

error_level

type: sqlglot.ErrorLevel
default: <ErrorLevel.RAISE: 'RAISE'>
Error level for parsing

identify

type: bool
default: False
Delimit all identifiers, e.g. turn FROM database.table into FROM "database"."table".This is useful for dialects that don’t support unquoted identifiers.

optimize

type: bool
default: False
Whether to optimize the generated SQL query; may produce invalid results, especially withduckdb’s read_* functions.

pretty

type: bool
default: False
Prettify output SQL, i.e. add newlines and indentation

read

type: str
default: None
Source dialect for parsing; if None, automatically detects

separator

type: str
default: '__@__'
Separator used to split the source and table name in the SQL query.

unsupported_level

type: sqlglot.ErrorLevel
default: <ErrorLevel.WARN: 'WARN'>
When using to_sql, how to handle unsupported dialect features.

write

type: str
default: None
Target dialect for output; if None, defaults to read dialect


Methods#

SQLRemoveSourceSeparator.apply(sql_in: str) str#

Exclude the source and separator from the SQL query.

Parameters:

sql_in (string) – The initial SQL query to be manipulated.

Returns:

New SQL query derived from the above query.

Return type:

string

SQLRemoveSourceSeparator.parse_sql(sql_in: str) Expression#

Parse SQL string into sqlglot AST.

Parameters:

sql_in (string) – SQL string to parse

Returns:

Parsed SQL expression

Return type:

sqlglot.Expression

SQLRemoveSourceSeparator.to_spec(context: dict[str, Any] | None = None) dict[str, Any]#

Exports the full specification to reconstruct this component.

Return type:

Resolved and instantiated Component object

SQLRemoveSourceSeparator.to_sql(expression: Expression) str#

Convert sqlglot expression back to SQL string.

Parameters:

expression (sqlglot.Expression) – Expression to convert to SQL

Returns:

SQL string representation

Return type:

string