class documentation

class SQLCompiler(Compiled):

Known subclasses: sqlalchemy.sql.compiler.StrSQLCompiler, sqlalchemy.databases.firebird.FBCompiler, sqlalchemy.databases.mssql.MSSQLCompiler, sqlalchemy.databases.mysql.MySQLCompiler, sqlalchemy.databases.oracle.OracleCompiler, sqlalchemy.databases.postgresql.PGCompiler, sqlalchemy.databases.sqlite.SQLiteCompiler, sqlalchemy.databases.sybase.SybaseSQLCompiler

View In Hierarchy

Default implementation of .Compiled.

Compiles _expression.ClauseElement objects into SQL strings.

Method __init__ Construct a new .SQLCompiler object.
Method construct​_params return a dictionary of bind parameter keys and values
Method default​_from Called when a SELECT statement has no froms, and no FROM clause is to be appended.
Method delete​_extra​_from​_clause Provide a hook to override the generation of an DELETE..FROM clause.
Method get​_select​_precolumns Called when building a SELECT statement, position is just before column list.
Method group​_by​_clause allow dialects to customize how GROUP BY is rendered.
Method order​_by​_clause allow dialects to customize how ORDER BY is rendered.
Method render​_literal​_value Render the value of a bind parameter as a quoted literal.
Method update​_from​_clause Provide a hook to override the generation of an UPDATE..FROM clause.
Method update​_limit​_clause Provide a hook for MySQL to add LIMIT to the UPDATE
Method update​_tables​_clause Provide a hook to override the initial table clause in an UPDATE statement.
Class Variable ansi​_bind​_rules No summary
Class Variable insert​_single​_values​_expr When an INSERT is compiled with a single set of parameters inside a VALUES expression, the string is assigned here, where it can be used for insert batching schemes to rewrite the VALUES expression.
Class Variable literal​_execute​_params bindparameter objects that are rendered as literal values at statement execution time.
Class Variable postfetch​_lastrowid if True, and this in insert, use cursor.lastrowid to populate result.inserted_primary_key.
Class Variable render​_table​_with​_column​_in​_update​_from set to True classwide to indicate the SET clause in a multi-table UPDATE statement should qualify columns with the table name (i.e. MySQL only)
Class Variable returning​_precedes​_values set to True classwide to generate RETURNING clauses before the VALUES or WHERE clause (i.e. MSSQL)
Class Variable translate​_select​_structure if not None, should be a callable which accepts (select_stmt, **kw) and returns a select object. this is used for structural changes mostly to accommodate for LIMIT/OFFSET schemes
Instance Variable escaped​_bind​_names Undocumented
Instance Variable has​_out​_parameters if True, there are bindparam() objects that have the isoutparam flag set.
Instance Variable isdelete Undocumented
Instance Variable positiontup for a compiled construct that uses a positional paramstyle, will be a sequence of strings, indicating the names of bound parameters in order.
Instance Variable post​_compile​_params bindparameter objects that are rendered as bound parameter placeholders at statement execution time.
Instance Variable returning holds the "returning" collection of columns if the statement is CRUD and defines returning columns either implicitly or explicitly
Method ​_add​_to​_result​_map Undocumented
Method ​_anonymize Undocumented
Method ​_apply​_numbered​_params Undocumented
Method ​_compose​_select​_body Undocumented
Method ​_create​_result​_map utility method used for unit tests only.
Method ​_display​_froms​_for​_select Undocumented
Method ​_fallback​_column​_name Undocumented
Method ​_format​_frame​_clause Undocumented
Method ​_generate​_delimited​_and​_list Undocumented
Method ​_generate​_delimited​_list Undocumented
Method ​_generate​_generic​_binary Undocumented
Method ​_generate​_generic​_unary​_modifier Undocumented
Method ​_generate​_generic​_unary​_operator Undocumented
Method ​_generate​_prefixes Undocumented
Method ​_get​_operator​_dispatch Undocumented
Method ​_get​_set​_input​_sizes​_lookup Undocumented
Method ​_init​_cte​_state Initialize collections related to CTEs only if a CTE is located, to save on the overhead of these collections otherwise.
Method ​_label​_returning​_column Render a column with necessary labels inside of a RETURNING clause.
Method ​_label​_select​_column produce labeled columns present in a select().
Method ​_literal​_execute​_expanding​_parameter Undocumented
Method ​_literal​_execute​_expanding​_parameter​_literal​_binds Undocumented
Method ​_nested​_result special API to support the use case of 'nested result sets'
Method ​_process​_parameters​_for​_postcompile handle special post compile parameters.
Method ​_render​_cte​_clause No summary
Method ​_row​_limit​_clause Undocumented
Method ​_setup​_crud​_hints Undocumented
Method ​_setup​_select​_hints Undocumented
Method ​_setup​_select​_stack Undocumented
Method ​_truncate​_bindparam Undocumented
Method ​_truncated​_identifier Undocumented
Method bindparam​_string Undocumented
Method delete​_table​_clause Undocumented
Method escape​_literal​_column Undocumented
Method fetch​_clause Undocumented
Method for​_update​_clause Undocumented
Method format​_from​_hint​_text Undocumented
Method function​_argspec Undocumented
Method get​_crud​_hint​_text Undocumented
Method get​_cte​_preamble Undocumented
Method get​_from​_hint​_text Undocumented
Method get​_render​_as​_alias​_suffix Undocumented
Method get​_select​_hint​_text Undocumented
Method get​_statement​_hint​_text Undocumented
Method is​_subquery Undocumented
Method limit​_clause Undocumented
Method post​_process​_text Undocumented
Method render​_literal​_bindparam Undocumented
Method returning​_clause Undocumented
Method visit​_alias Undocumented
Method visit​_between​_op​_binary Undocumented
Method visit​_binary Undocumented
Method visit​_bindparam Undocumented
Method visit​_case Undocumented
Method visit​_cast Undocumented
Method visit​_clauselist Undocumented
Method visit​_collation Undocumented
Method visit​_column Undocumented
Method visit​_compound​_select Undocumented
Method visit​_contains​_op​_binary Undocumented
Method visit​_cte Undocumented
Method visit​_custom​_op​_binary Undocumented
Method visit​_custom​_op​_unary​_modifier Undocumented
Method visit​_custom​_op​_unary​_operator Undocumented
Method visit​_delete Undocumented
Method visit​_empty​_set​_expr Undocumented
Method visit​_empty​_set​_op​_expr Undocumented
Method visit​_endswith​_op​_binary Undocumented
Method visit​_extract Undocumented
Method visit​_false Undocumented
Method visit​_fromclause Undocumented
Method visit​_funcfilter Undocumented
Method visit​_function Undocumented
Method visit​_function​_as​_comparison​_op​_binary Undocumented
Method visit​_grouping Undocumented
Method visit​_ilike​_op​_binary Undocumented
Method visit​_index Undocumented
Method visit​_insert Undocumented
Method visit​_is​_false​_unary​_operator Undocumented
Method visit​_is​_true​_unary​_operator Undocumented
Method visit​_join Undocumented
Method visit​_label Undocumented
Method visit​_label​_reference Undocumented
Method visit​_lambda​_element Undocumented
Method visit​_lateral Undocumented
Method visit​_like​_op​_binary Undocumented
Method visit​_mod​_binary Undocumented
Method visit​_next​_value​_func Undocumented
Method visit​_not​_between​_op​_binary Undocumented
Method visit​_not​_contains​_op​_binary Undocumented
Method visit​_not​_endswith​_op​_binary Undocumented
Method visit​_not​_ilike​_op​_binary Undocumented
Method visit​_not​_in​_op​_binary Undocumented
Method visit​_not​_like​_op​_binary Undocumented
Method visit​_not​_match​_op​_binary Undocumented
Method visit​_not​_regexp​_match​_op​_binary Undocumented
Method visit​_not​_startswith​_op​_binary Undocumented
Method visit​_null Undocumented
Method visit​_over Undocumented
Method visit​_regexp​_match​_op​_binary Undocumented
Method visit​_regexp​_replace​_op​_binary Undocumented
Method visit​_release​_savepoint Undocumented
Method visit​_rollback​_to​_savepoint Undocumented
Method visit​_savepoint Undocumented
Method visit​_scalar​_function​_column Undocumented
Method visit​_select Undocumented
Method visit​_select​_statement​_grouping Undocumented
Method visit​_sequence Undocumented
Method visit​_startswith​_op​_binary Undocumented
Method visit​_subquery Undocumented
Method visit​_table Undocumented
Method visit​_table​_valued​_alias Undocumented
Method visit​_table​_valued​_column Undocumented
Method visit​_tablesample Undocumented
Method visit​_textclause Undocumented
Method visit​_textual​_label​_reference Undocumented
Method visit​_textual​_select Undocumented
Method visit​_true Undocumented
Method visit​_tuple Undocumented
Method visit​_type​_coerce Undocumented
Method visit​_typeclause Undocumented
Method visit​_unary Undocumented
Method visit​_update Undocumented
Method visit​_values Undocumented
Method visit​_withingroup Undocumented
Class Variable ​_default​_stack​_entry Undocumented
Class Variable insert​_prefetch Undocumented
Class Variable update​_prefetch Undocumented
Instance Variable ​_cache​_key​_bind​_match a mapping that will relate the BindParameter object we compile to those that are part of the extracted collection of parameters in the cache key, if we were given a cache key.
Instance Variable ​_loose​_column​_name​_matching tell the result object that the SQL statement is textual, wants to match up to Column objects, and may be using the ._tq_label in the SELECT rather than the base name.
Instance Variable ​_numeric​_binds True if paramstyle is "numeric". This paramstyle is trickier than all the others.
Instance Variable ​_ordered​_columns if False, means we can't be sure the list of entries in _result_columns is actually the rendered order. Usually True unless using an unordered TextualSelect.
Instance Variable ​_render​_postcompile whether to render out POSTCOMPILE params during the compile phase.
Instance Variable ​_result​_columns Undocumented
Instance Variable ​_textual​_ordered​_columns tell the result object that the column names as rendered are important, but they are also "ordered" vs. what is in the compiled object here.
Instance Variable anon​_map Undocumented
Instance Variable bind​_names Undocumented
Instance Variable binds Undocumented
Instance Variable bindtemplate Undocumented
Instance Variable cache​_key Undocumented
Instance Variable column​_keys Undocumented
Instance Variable compile​_state Optional .CompileState object that maintains additional state used by the compiler.
Instance Variable cte​_positional Undocumented
Instance Variable ctes Undocumented
Instance Variable ctes​_by​_level​_name Undocumented
Instance Variable ctes​_recursive Undocumented
Instance Variable execution​_options Undocumented
Instance Variable for​_executemany Undocumented
Instance Variable from​_linter Undocumented
Instance Variable inline Undocumented
Instance Variable isinsert Undocumented
Instance Variable isplaintext Undocumented
Instance Variable isupdate class-level defaults which can be set at the instance level to define if this Compiled instance represents INSERT/UPDATE/DELETE
Instance Variable label​_length Undocumented
Instance Variable level​_name​_by​_cte Undocumented
Instance Variable linting Undocumented
Instance Variable positional Undocumented
Instance Variable stack Undocumented
Instance Variable string Undocumented
Instance Variable truncated​_names Undocumented
Property ​_bind​_processors Undocumented
Property ​_global​_attributes Undocumented
Property ​_inserted​_primary​_key​_from​_lastrowid​_getter Undocumented
Property ​_inserted​_primary​_key​_from​_returning​_getter Undocumented
Property ​_like​_percent​_literal Undocumented
Property current​_executable Return the current 'executable' that is being compiled.
Property params Return the bind param dictionary embedded into this compiled object, for those values that are present.
Property prefetch Undocumented
Property sql​_compiler Return a Compiled that is capable of processing SQL expressions.

Inherited from Compiled:

Method __str__ Return the string text of the generated SQL or DDL.
Method ​_execute​_on​_connection Undocumented
Method process Undocumented
Method visit​_unsupported​_compilation Undocumented
Class Variable ​_cached​_metadata Undocumented
Instance Variable ​_annotations Undocumented
Instance Variable ​_gen​_time Undocumented
Instance Variable can​_execute Undocumented
Instance Variable dialect Undocumented
Instance Variable preparer Undocumented
Instance Variable schema​_translate​_map Undocumented
Instance Variable statement Undocumented
def __init__(self, dialect, statement, cache_key=None, column_keys=None, for_executemany=False, linting=NO_LINTING, **kwargs):
Construct a new .SQLCompiler object.
Parameters
dialect.Dialect to be used
statement_expression.ClauseElement to be compiled
cache​_keyUndocumented
column​_keysa list of column names to be compiled into an INSERT or UPDATE statement.
for​_executemanywhether INSERT / UPDATE statements should expect that they are to be invoked in an "executemany" style, which may impact how the statement will be expected to return the values of defaults and autoincrement / sequences and similar. Depending on the backend and driver in use, support for retrieving these values may be disabled which means SQL expressions may be rendered inline, RETURNING may not be rendered, etc.
lintingUndocumented
**kwargsadditional keyword arguments to be consumed by the superclass.
def construct_params(self, params=None, _group_number=None, _check=True, extracted_parameters=None):
return a dictionary of bind parameter keys and values
def default_from(self):

Called when a SELECT statement has no froms, and no FROM clause is to be appended.

Gives Oracle a chance to tack on a FROM DUAL to the string output.

def delete_extra_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw):

Provide a hook to override the generation of an DELETE..FROM clause.

This can be used to implement DELETE..USING for example.

MySQL and MSSQL override this.

def get_select_precolumns(self, select, **kw):
def group_by_clause(self, select, **kw):
allow dialects to customize how GROUP BY is rendered.
def order_by_clause(self, select, **kw):
allow dialects to customize how ORDER BY is rendered.
def render_literal_value(self, value, type_):

Render the value of a bind parameter as a quoted literal.

This is used for statement sections that do not accept bind parameters on the target driver/database.

This should be implemented by subclasses using the quoting services of the DBAPI.

def update_from_clause(self, update_stmt, from_table, extra_froms, from_hints, **kw):

Provide a hook to override the generation of an UPDATE..FROM clause.

MySQL and MSSQL override this.

def update_limit_clause(self, update_stmt):
Provide a hook for MySQL to add LIMIT to the UPDATE
def update_tables_clause(self, update_stmt, from_table, extra_froms, **kw):

Provide a hook to override the initial table clause in an UPDATE statement.

MySQL overrides this.

ansi_bind_rules: bool =
SQL 92 doesn't allow bind parameters to be used in the columns clause of a SELECT, nor does it allow ambiguous expressions like "? = ?". A compiler subclass can set this flag to False if the target driver/DB enforces this
insert_single_values_expr =

When an INSERT is compiled with a single set of parameters inside a VALUES expression, the string is assigned here, where it can be used for insert batching schemes to rewrite the VALUES expression.

New in version 1.3.8.
literal_execute_params =
bindparameter objects that are rendered as literal values at statement execution time.
postfetch_lastrowid: bool =
if True, and this in insert, use cursor.lastrowid to populate result.inserted_primary_key.
render_table_with_column_in_update_from: bool =
set to True classwide to indicate the SET clause in a multi-table UPDATE statement should qualify columns with the table name (i.e. MySQL only)
returning_precedes_values: bool =
set to True classwide to generate RETURNING clauses before the VALUES or WHERE clause (i.e. MSSQL)
translate_select_structure =
if not None, should be a callable which accepts (select_stmt, **kw) and returns a select object. this is used for structural changes mostly to accommodate for LIMIT/OFFSET schemes
escaped_bind_names: dict =

Undocumented

has_out_parameters: bool =
if True, there are bindparam() objects that have the isoutparam flag set.
isdelete: bool =

Undocumented

positiontup =

for a compiled construct that uses a positional paramstyle, will be a sequence of strings, indicating the names of bound parameters in order.

This is used in order to render bound parameters in their correct order, and is combined with the _sql.Compiled.params dictionary to render parameters.

See Also

:ref:`faq_sql_expression_string` - includes a usage example for debugging use cases.

post_compile_params =
bindparameter objects that are rendered as bound parameter placeholders at statement execution time.
returning =
holds the "returning" collection of columns if the statement is CRUD and defines returning columns either implicitly or explicitly
def _add_to_result_map(self, keyname, name, objects, type_):

Undocumented

def _anonymize(self, name):

Undocumented

def _apply_numbered_params(self):

Undocumented

def _compose_select_body(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs):

Undocumented

@util.preload_module('sqlalchemy.engine.cursor')
def _create_result_map(self):
utility method used for unit tests only.
def _display_froms_for_select(self, select_stmt, asfrom, lateral=False, **kw):

Undocumented

def _fallback_column_name(self, column):

Undocumented

def _format_frame_clause(self, range_, **kw):

Undocumented

def _generate_delimited_and_list(self, clauses, **kw):

Undocumented

def _generate_delimited_list(self, elements, separator, **kw):

Undocumented

def _generate_generic_binary(self, binary, opstring, eager_grouping=False, **kw):

Undocumented

def _generate_generic_unary_modifier(self, unary, opstring, **kw):

Undocumented

def _generate_generic_unary_operator(self, unary, opstring, **kw):

Undocumented

def _generate_prefixes(self, stmt, prefixes, **kw):

Undocumented

def _get_operator_dispatch(self, operator_, qualifier1, qualifier2):

Undocumented

@util.memoized_instancemethod
def _get_set_input_sizes_lookup(self, include_types=None, exclude_types=None):

Undocumented

@util.memoized_instancemethod
def _init_cte_state(self):
Initialize collections related to CTEs only if a CTE is located, to save on the overhead of these collections otherwise.
def _label_returning_column(self, stmt, column, column_clause_args=None):

Render a column with necessary labels inside of a RETURNING clause.

This method is provided for individual dialects in place of calling the _label_select_column method directly, so that the two use cases of RETURNING vs. SELECT can be disambiguated going forward.

New in version 1.4.21.
def _label_select_column(self, select, column, populate_result_map, asfrom, column_clause_args, name=None, proxy_name=None, fallback_label_name=None, within_columns_clause=True, column_is_repeated=False, need_column_expressions=False):
produce labeled columns present in a select().
def _literal_execute_expanding_parameter(self, name, parameter, values):

Undocumented

def _literal_execute_expanding_parameter_literal_binds(self, parameter, values):

Undocumented

@contextlib.contextmanager
def _nested_result(self):
special API to support the use case of 'nested result sets'
def _process_parameters_for_postcompile(self, parameters=None, _populate_self=False):

handle special post compile parameters.

These include:

  • "expanding" parameters -typically IN tuples that are rendered on a per-parameter basis for an otherwise fixed SQL statement string.
  • literal_binds compiled with the literal_execute flag. Used for things like SQL Server "TOP N" where the driver does not accommodate N as a bound parameter.
def _render_cte_clause(self, nesting_level=None, include_following_stack=False):
include_following_stack
Also render the nesting CTEs on the next stack. Useful for SQL structures like UNION or INSERT that can wrap SELECT statements containing nesting CTEs.
def _row_limit_clause(self, cs, **kwargs):

Undocumented

def _setup_crud_hints(self, stmt, table_text):

Undocumented

def _setup_select_hints(self, select):

Undocumented

def _setup_select_stack(self, select, compile_state, entry, asfrom, lateral, compound_index):

Undocumented

def _truncate_bindparam(self, bindparam):

Undocumented

def _truncated_identifier(self, ident_class, name):

Undocumented

def bindparam_string(self, name, positional_names=None, post_compile=False, expanding=False, escaped_from=None, **kw):
def delete_table_clause(self, delete_stmt, from_table, extra_froms):
def escape_literal_column(self, text):
def fetch_clause(self, select, **kw):
def format_from_hint_text(self, sqltext, table, hint, iscrud):

Undocumented

def function_argspec(self, func, **kwargs):
def get_crud_hint_text(self, table, text):

Undocumented

def get_cte_preamble(self, recursive):
def get_render_as_alias_suffix(self, alias_name_text):

Undocumented

def get_select_hint_text(self, byfroms):

Undocumented

def get_statement_hint_text(self, hint_texts):

Undocumented

def is_subquery(self):

Undocumented

def render_literal_bindparam(self, bindparam, render_literal_value=NO_ARG, **kw):

Undocumented

def visit_alias(self, alias, asfrom=False, ashint=False, iscrud=False, fromhints=None, subquery=False, lateral=False, enclosing_alias=None, from_linter=None, **kwargs):
def visit_between_op_binary(self, binary, operator, **kw):

Undocumented

def visit_binary(self, binary, override_operator=None, eager_grouping=False, from_linter=None, lateral_from_linter=None, **kw):

Undocumented

def visit_bindparam(self, bindparam, within_columns_clause=False, literal_binds=False, skip_bind_expression=False, literal_execute=False, render_postcompile=False, **kwargs):

Undocumented

def visit_case(self, clause, **kwargs):

Undocumented

def visit_cast(self, cast, **kwargs):
def visit_clauselist(self, clauselist, **kw):

Undocumented

def visit_collation(self, element, **kw):

Undocumented

def visit_column(self, column, add_to_result_map=None, include_table=True, result_map_targets=(), **kwargs):

Undocumented

def visit_compound_select(self, cs, asfrom=False, compound_index=None, **kwargs):

Undocumented

def visit_contains_op_binary(self, binary, operator, **kw):

Undocumented

def visit_cte(self, cte, asfrom=False, ashint=False, fromhints=None, visiting_cte=None, from_linter=None, **kwargs):

Undocumented

def visit_custom_op_binary(self, element, operator, **kw):

Undocumented

def visit_custom_op_unary_modifier(self, element, operator, **kw):

Undocumented

def visit_custom_op_unary_operator(self, element, operator, **kw):

Undocumented

def visit_delete(self, delete_stmt, **kw):

Undocumented

def visit_empty_set_op_expr(self, type_, expand_op):

Undocumented

def visit_endswith_op_binary(self, binary, operator, **kw):

Undocumented

def visit_fromclause(self, fromclause, **kwargs):

Undocumented

def visit_funcfilter(self, funcfilter, **kwargs):

Undocumented

def visit_function(self, func, add_to_result_map=None, **kwargs):

Undocumented

def visit_function_as_comparison_op_binary(self, element, operator, **kw):

Undocumented

def visit_grouping(self, grouping, asfrom=False, **kwargs):

Undocumented

def visit_ilike_op_binary(self, binary, operator, **kw):

Undocumented

def visit_index(self, index, **kwargs):

Undocumented

def visit_insert(self, insert_stmt, **kw):

Undocumented

def visit_is_false_unary_operator(self, element, operator, **kw):

Undocumented

def visit_is_true_unary_operator(self, element, operator, **kw):

Undocumented

def visit_join(self, join, asfrom=False, from_linter=None, **kwargs):
def visit_label(self, label, add_to_result_map=None, within_label_clause=False, within_columns_clause=False, render_label_as_label=None, result_map_targets=(), **kw):

Undocumented

def visit_label_reference(self, element, within_columns_clause=False, **kwargs):

Undocumented

def visit_lambda_element(self, element, **kw):

Undocumented

def visit_lateral(self, lateral_, **kw):

Undocumented

def visit_like_op_binary(self, binary, operator, **kw):

Undocumented

def visit_next_value_func(self, next_value, **kw):

Undocumented

def visit_not_between_op_binary(self, binary, operator, **kw):

Undocumented

def visit_not_contains_op_binary(self, binary, operator, **kw):

Undocumented

def visit_not_endswith_op_binary(self, binary, operator, **kw):

Undocumented

def visit_not_ilike_op_binary(self, binary, operator, **kw):

Undocumented

def visit_not_in_op_binary(self, binary, operator, **kw):
def visit_not_like_op_binary(self, binary, operator, **kw):

Undocumented

def visit_not_match_op_binary(self, binary, operator, **kw):

Undocumented

def visit_not_startswith_op_binary(self, binary, operator, **kw):

Undocumented

def visit_null(self, expr, **kw):

Undocumented

def visit_over(self, over, **kwargs):

Undocumented

def visit_release_savepoint(self, savepoint_stmt):

Undocumented

def visit_rollback_to_savepoint(self, savepoint_stmt):

Undocumented

def visit_savepoint(self, savepoint_stmt):

Undocumented

def visit_scalar_function_column(self, element, **kw):

Undocumented

def visit_select(self, select_stmt, asfrom=False, insert_into=False, fromhints=None, compound_index=None, select_wraps_for=None, lateral=False, from_linter=None, **kwargs):

Undocumented

def visit_select_statement_grouping(self, grouping, **kwargs):

Undocumented

def visit_startswith_op_binary(self, binary, operator, **kw):

Undocumented

def visit_subquery(self, subquery, **kw):

Undocumented

def visit_table(self, table, asfrom=False, iscrud=False, ashint=False, fromhints=None, use_schema=True, from_linter=None, **kwargs):

Undocumented

def visit_table_valued_alias(self, element, **kw):

Undocumented

def visit_table_valued_column(self, element, **kw):

Undocumented

def visit_tablesample(self, tablesample, asfrom=False, **kw):

Undocumented

def visit_textclause(self, textclause, add_to_result_map=None, **kw):

Undocumented

def visit_textual_label_reference(self, element, within_columns_clause=False, **kwargs):

Undocumented

def visit_textual_select(self, taf, compound_index=None, asfrom=False, **kw):

Undocumented

def visit_tuple(self, clauselist, **kw):

Undocumented

def visit_type_coerce(self, type_coerce, **kw):

Undocumented

def visit_typeclause(self, typeclause, **kw):

Undocumented

def visit_unary(self, unary, add_to_result_map=None, result_map_targets=(), **kw):

Undocumented

def visit_update(self, update_stmt, **kw):

Undocumented

def visit_values(self, element, asfrom=False, from_linter=None, **kw):

Undocumented

def visit_withingroup(self, withingroup, **kwargs):

Undocumented

_default_stack_entry =

Undocumented

insert_prefetch: tuple =

Undocumented

update_prefetch: tuple =

Undocumented

_cache_key_bind_match =
a mapping that will relate the BindParameter object we compile to those that are part of the extracted collection of parameters in the cache key, if we were given a cache key.
_loose_column_name_matching =
tell the result object that the SQL statement is textual, wants to match up to Column objects, and may be using the ._tq_label in the SELECT rather than the base name.
_numeric_binds =
True if paramstyle is "numeric". This paramstyle is trickier than all the others.
_ordered_columns: bool =
if False, means we can't be sure the list of entries in _result_columns is actually the rendered order. Usually True unless using an unordered TextualSelect.
_render_postcompile: bool =
whether to render out POSTCOMPILE params during the compile phase.
_result_columns =
_textual_ordered_columns: bool =
tell the result object that the column names as rendered are important, but they are also "ordered" vs. what is in the compiled object here.
anon_map =

Undocumented

bind_names =

Undocumented

binds: dict =

Undocumented

bindtemplate =

Undocumented

cache_key =
column_keys =

Undocumented

compile_state =

Optional .CompileState object that maintains additional state used by the compiler.

Major executable objects such as _expression.Insert, _expression.Update, _expression.Delete, _expression.Select will generate this state when compiled in order to calculate additional information about the object. For the top level object that is to be executed, the state can be stored here where it can also have applicability towards result set processing.

New in version 1.4.
cte_positional: dict =

Undocumented

ctes =

Undocumented

ctes_by_level_name: dict =

Undocumented

ctes_recursive: bool =

Undocumented

execution_options =
for_executemany =

Undocumented

from_linter =

Undocumented

inline: bool =

Undocumented

isinsert: bool =

Undocumented

isplaintext: bool =

Undocumented

isupdate: bool =
class-level defaults which can be set at the instance level to define if this Compiled instance represents INSERT/UPDATE/DELETE
label_length =

Undocumented

level_name_by_cte: dict =

Undocumented

linting =

Undocumented

positional =

Undocumented

stack: list =

Undocumented

string =
truncated_names: dict =

Undocumented

@util.memoized_property
_bind_processors =

Undocumented

@util.memoized_property
_global_attributes =

Undocumented

@util.memoized_property
@util.preload_module('sqlalchemy.engine.result')
_inserted_primary_key_from_lastrowid_getter =

Undocumented

@util.memoized_property
@util.preload_module('sqlalchemy.engine.result')
_inserted_primary_key_from_returning_getter =

Undocumented

@util.memoized_property
_like_percent_literal =

Undocumented

@property
current_executable =

Return the current 'executable' that is being compiled.

This is currently the _sql.Select, _sql.Insert, _sql.Update, _sql.Delete, _sql.CompoundSelect object that is being compiled. Specifically it's assigned to the self.stack list of elements.

When a statement like the above is being compiled, it normally is also assigned to the .statement attribute of the _sql.Compiler object. However, all SQL constructs are ultimately nestable, and this attribute should never be consulted by a visit_ method, as it is not guaranteed to be assigned nor guaranteed to correspond to the current statement being compiled.

New in version 1.3.21: For compatibility with previous versions, use the following recipe:

statement = getattr(self, "current_executable", False)
if statement is False:
    statement = self.stack[-1]["selectable"]

For versions 1.4 and above, ensure only .current_executable is used; the format of "self.stack" may change.

@property
params =

Return the bind param dictionary embedded into this compiled object, for those values that are present.

See Also

:ref:`faq_sql_expression_string` - includes a usage example for debugging use cases.

@property
prefetch =

Undocumented

@property
sql_compiler =

Return a Compiled that is capable of processing SQL expressions.

If this compiler is one, it would likely just return 'self'.