class MSSQLCompiler(compiler.SQLCompiler):
Known subclasses: sqlalchemy.databases.mssql.MSSQLStrictCompiler
Undocumented
Method | __init__ |
Construct a new .SQLCompiler object. |
Method | _check_can_use_fetch_limit |
Undocumented |
Method | _get_limit_or_fetch |
Undocumented |
Method | _render_json_extract_from_binary |
Undocumented |
Method | _row_limit_clause |
MSSQL 2012 supports OFFSET/FETCH operators Use it instead subquery with row_number |
Method | _schema_aliased_table |
Undocumented |
Method | _use_top |
Undocumented |
Method | _with_legacy_schema_aliasing |
Undocumented |
Method | delete_extra_from_clause |
Render the DELETE .. FROM clause specific to MSSQL. |
Method | delete_table_clause |
If we have extra froms make sure we render any alias as hint. |
Method | fetch_clause |
Undocumented |
Method | for_update_clause |
Undocumented |
Method | get_crud_hint_text |
Undocumented |
Method | get_cte_preamble |
Undocumented |
Method | get_from_hint_text |
Undocumented |
Method | get_select_precolumns |
MS-SQL puts TOP, it's version of LIMIT here |
Method | label_select_column |
Undocumented |
Method | limit_clause |
Undocumented |
Method | order_by_clause |
allow dialects to customize how ORDER BY is rendered. |
Method | returning_clause |
Undocumented |
Method | translate_select_structure |
Look for LIMIT and OFFSET in a select statement, and if so tries to wrap it in a subquery with row_number() criterion. MSSQL 2012 and above are excluded |
Method | update_from_clause |
Render the UPDATE..FROM clause specific to MSSQL. |
Method | visit_alias |
Undocumented |
Method | visit_binary |
Move bind parameters to the right-hand side of an operator, where possible. |
Method | visit_char_length_func |
Undocumented |
Method | visit_column |
Undocumented |
Method | visit_concat_op_binary |
Undocumented |
Method | visit_current_date_func |
Undocumented |
Method | visit_empty_set_expr |
Undocumented |
Method | visit_extract |
Undocumented |
Method | visit_false |
Undocumented |
Method | visit_is_distinct_from_binary |
Undocumented |
Method | visit_is_not_distinct_from_binary |
Undocumented |
Method | visit_json_getitem_op_binary |
Undocumented |
Method | visit_json_path_getitem_op_binary |
Undocumented |
Method | visit_length_func |
Undocumented |
Method | visit_match_op_binary |
Undocumented |
Method | visit_now_func |
Undocumented |
Method | visit_rollback_to_savepoint |
Undocumented |
Method | visit_savepoint |
Undocumented |
Method | visit_sequence |
Undocumented |
Method | visit_table |
Undocumented |
Method | visit_true |
Undocumented |
Method | visit_try_cast |
Undocumented |
Class Variable | extract_map |
Undocumented |
Class Variable | returning_precedes_values |
set to True classwide to generate RETURNING clauses before the VALUES or WHERE clause (i.e. MSSQL) |
Instance Variable | tablealiases |
Undocumented |
Inherited from SQLCompiler
:
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 | group_by_clause |
allow dialects to customize how GROUP BY is rendered. |
Method | render_literal_value |
Render the value of a bind parameter as a quoted literal. |
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) |
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 | _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 | escape_literal_column |
Undocumented |
Method | format_from_hint_text |
Undocumented |
Method | function_argspec |
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 | post_process_text |
Undocumented |
Method | render_literal_bindparam |
Undocumented |
Method | visit_between_op_binary |
Undocumented |
Method | visit_bindparam |
Undocumented |
Method | visit_case |
Undocumented |
Method | visit_cast |
Undocumented |
Method | visit_clauselist |
Undocumented |
Method | visit_collation |
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_op_expr |
Undocumented |
Method | visit_endswith_op_binary |
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_scalar_function_column |
Undocumented |
Method | visit_select |
Undocumented |
Method | visit_select_statement_grouping |
Undocumented |
Method | visit_startswith_op_binary |
Undocumented |
Method | visit_subquery |
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_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
(via SQLCompiler
):
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 |
.SQLCompiler
object.Parameters | |
*args | Undocumented |
**kwargs | additional keyword arguments to be consumed by the superclass. |
dialect | .Dialect to be used |
statement | _expression.ClauseElement to be compiled |
column_keys | a list of column names to be compiled into an INSERT or UPDATE statement. |
for_executemany | whether 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. |
Render the DELETE .. FROM clause specific to MSSQL.
Yes, it has the FROM keyword twice.
Render the UPDATE..FROM clause specific to MSSQL.
In MSSQL, if the UPDATE statement involves an alias of the table to be updated, then the table itself must be added to the FROM list as well. Otherwise, it is optional. Here, we add it regardless.
Undocumented