class documentation
class PGCompiler(compiler.SQLCompiler): (source)
Known subclasses: sqlalchemy.dialects.postgresql.asyncpg.PGCompiler_asyncpg
, sqlalchemy.dialects.postgresql.pg8000.PGCompiler_pg8000
, sqlalchemy.dialects.postgresql.psycopg.PGCompiler_psycopg
Undocumented
Method | delete |
Render the DELETE .. USING clause specific to PostgreSQL. |
Method | fetch |
Undocumented |
Method | for |
Undocumented |
Method | format |
Undocumented |
Method | get |
Called when building a ``SELECT`` statement, position is just before column list. |
Method | limit |
Undocumented |
Method | render |
Undocumented |
Method | render |
Render the value of a bind parameter as a quoted literal. |
Method | update |
Provide a hook to override the generation of an UPDATE..FROM clause. |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | _assert |
Undocumented |
Method | _on |
Undocumented |
Method | _regexp |
Undocumented |
Inherited from SQLCompiler
:
Method | __init__ |
Construct a new :class:`.SQLCompiler` object. |
Method | bindparam |
Undocumented |
Method | construct |
Return a new :class:`.ExpandedState` for a given parameter set. |
Method | construct |
return a dictionary of bind parameter keys and values |
Method | default |
Called when a SELECT statement has no froms, and no FROM clause is to be appended. |
Method | delete |
Undocumented |
Method | escape |
Undocumented |
Method | function |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | get |
Undocumented |
Method | group |
allow dialects to customize how GROUP BY is rendered. |
Method | is |
Undocumented |
Method | order |
allow dialects to customize how ORDER BY is rendered. |
Method | post |
Undocumented |
Method | render |
Undocumented |
Method | returning |
Undocumented |
Method | update |
Provide a hook for MySQL to add LIMIT to the UPDATE |
Method | update |
Provide a hook to override the initial table clause in an UPDATE statement. |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Method | visit |
Undocumented |
Class Variable | ansi |
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... |
Class Variable | bindname |
A mapping (e.g. dict or similar) containing a lookup of characters keyed to replacement characters which will be applied to all 'bind names' used in SQL statements as a form of 'escaping'; the given characters are replaced entirely with the 'replacement' character when rendered in the SQL statement, and a similar translation is performed on the incoming names used in parameter dictionaries passed to methods like :meth:`_engine... |
Class Variable | implicit |
list of "implicit" returning columns for a toplevel INSERT or UPDATE statement, used to receive newly generated values of columns. |
Class Variable | insert |
list of columns for which default values should be evaluated before an INSERT takes place |
Class Variable | is |
Undocumented |
Class Variable | literal |
bindparameter objects that are rendered as literal values at statement execution time. |
Class Variable | post |
bindparameter objects that are rendered as bound parameter placeholders at statement execution time. |
Class Variable | postfetch |
list of columns that can be post-fetched after INSERT or UPDATE to receive server-updated values |
Class Variable | postfetch |
if True, and this in insert, use cursor.lastrowid to populate result.inserted_primary_key. |
Class Variable | render |
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 |
set to True classwide to generate RETURNING clauses before the VALUES or WHERE clause (i.e. MSSQL) |
Class Variable | translate |
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 |
Class Variable | update |
list of columns for which onupdate default values should be evaluated before an UPDATE takes place |
Instance Variable | anon |
Undocumented |
Instance Variable | bind |
a dictionary of BindParameter instances to "compiled" names that are actually present in the generated SQL |
Instance Variable | binds |
a dictionary of bind parameter keys to BindParameter instances. |
Instance Variable | bindtemplate |
template to render bound parameters based on paramstyle. |
Instance Variable | cache |
The :class:`.CacheKey` that was generated ahead of creating this :class:`.Compiled` object. |
Instance Variable | column |
Undocumented |
Instance Variable | compilation |
template used by compiler to render parameters before positional paramstyle application |
Instance Variable | compile |
Optional :class:`.CompileState` object that maintains additional state used by the compiler. |
Instance Variable | ctes |
Undocumented |
Instance Variable | ctes |
Undocumented |
Instance Variable | ctes |
Undocumented |
Instance Variable | dml |
Optional :class:`.CompileState` assigned at the same point that .isinsert, .isupdate, or .isdelete is assigned. |
Instance Variable | escaped |
Undocumented |
Instance Variable | for |
Undocumented |
Instance Variable | from |
Undocumented |
Instance Variable | has |
if True, there are bindparam() objects that have the isoutparam flag set. |
Instance Variable | inline |
Undocumented |
Instance Variable | isdelete |
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 |
Undocumented |
Instance Variable | level |
Undocumented |
Instance Variable | linting |
Undocumented |
Instance Variable | next |
Undocumented |
Instance Variable | positional |
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 | stack |
major statements such as SELECT, INSERT, UPDATE, DELETE are tracked in this stack using an entry format. |
Instance Variable | string |
The string representation of the ``statement`` |
Instance Variable | truncated |
Undocumented |
Property | current |
Return the current 'executable' that is being compiled. |
Property | effective |
The effective "returning" columns for INSERT, UPDATE or DELETE. |
Property | insert |
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. |
Property | params |
Return the bind param dictionary embedded into this compiled object, for those values that are present. |
Property | prefetch |
Undocumented |
Property | returning |
backwards compatibility; returns the effective_returning collection. |
Property | sql |
Return a Compiled that is capable of processing SQL expressions. |
Class Method | _init |
Undocumented |
Class Method | _init |
Undocumented |
Method | _add |
Undocumented |
Method | _anonymize |
Undocumented |
Method | _compose |
Undocumented |
Method | _create |
utility method used for unit tests only. |
Method | _deliver |
Undocumented |
Method | _dispatch |
Undocumented |
Method | _display |
Undocumented |
Method | _fallback |
Undocumented |
Method | _format |
Undocumented |
Method | _generate |
Undocumented |
Method | _generate |
Undocumented |
Method | _generate |
Undocumented |
Method | _generate |
Undocumented |
Method | _generate |
Undocumented |
Method | _generate |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _init |
Initialize collections related to CTEs only if a CTE is located, to save on the overhead of these collections otherwise. |
Method | _insert |
Undocumented |
Method | _label |
Render a column with necessary labels inside of a RETURNING clause. |
Method | _label |
produce labeled columns present in a select(). |
Method | _literal |
Undocumented |
Method | _literal |
Undocumented |
Method | _nested |
special API to support the use case of 'nested result sets' |
Method | _process |
Undocumented |
Method | _process |
handle special post compile parameters. |
Method | _process |
Undocumented |
Method | _render |
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. |
Method | _render |
Undocumented |
Method | _row |
Undocumented |
Method | _setup |
Undocumented |
Method | _setup |
Undocumented |
Method | _setup |
Undocumented |
Method | _truncate |
Undocumented |
Method | _truncated |
Undocumented |
Class Variable | _bind |
Undocumented |
Class Variable | _bind |
Undocumented |
Class Variable | _default |
Undocumented |
Class Variable | _get |
Undocumented |
Class Variable | _insert |
Undocumented |
Class Variable | _positional |
Undocumented |
Class Variable | _post |
Undocumented |
Class Variable | _pyformat |
Undocumented |
Class Variable | _values |
Undocumented |
Class Variable | _visited |
Undocumented |
Instance Variable | _ad |
tell the result that we encountered text() or '*' constructs in the middle of the result columns, but we also have compiled columns, so if the number of columns in cursor.description does not match how many expressions we have, that means we can't rely on positional at all and should match on name. |
Instance Variable | _cache |
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 | _insertmanyvalues |
Undocumented |
Instance Variable | _loose |
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 |
True if paramstyle is "numeric". This paramstyle is trickier than all the others. |
Instance Variable | _numeric |
Character that's used to as the identifier of a numerical bind param. For example if this char is set to ``$``, numerical binds will be rendered in the form ``$1, $2, $3``. |
Instance Variable | _ordered |
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 | _post |
When render_postcompile is used, the ``ExpandedState`` used to create the "expanded" SQL is assigned here, and then used by the ``.params`` accessor and ``.construct_params()`` methods for their return values. |
Instance Variable | _pre |
Undocumented |
Instance Variable | _pre |
Stores the original string SQL before 'post_compile' is applied, for cases where 'post_compile' were used. |
Instance Variable | _render |
whether to render out POSTCOMPILE params during the compile phase. |
Instance Variable | _result |
relates label names in the final SQL to a tuple of local column/label name, ColumnElement object (if any) and TypeEngine. CursorResult uses this for type processing and column targeting |
Instance Variable | _textual |
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 | _truncated |
Undocumented |
Property | _bind |
Undocumented |
Property | _global |
Undocumented |
Property | _inserted |
Undocumented |
Property | _inserted |
Undocumented |
Property | _like |
Undocumented |
Property | _within |
Undocumented |
Inherited from Compiled
(via SQLCompiler
):
Method | __init |
Undocumented |
Method | __str__ |
Return the string text of the generated SQL or DDL. |
Method | process |
Undocumented |
Method | visit |
Undocumented |
Class Variable | is |
Undocumented |
Instance Variable | can |
Undocumented |
Instance Variable | dialect |
Undocumented |
Instance Variable | execution |
Undocumented |
Instance Variable | preparer |
Undocumented |
Instance Variable | schema |
Execution options propagated from the statement. In some cases, sub-elements of the statement can modify these. |
Instance Variable | state |
description of the compiler's state |
Instance Variable | statement |
The statement to compile. |
Method | _execute |
Undocumented |
Class Variable | _cached |
Undocumented |
Instance Variable | _annotations |
Undocumented |
Instance Variable | _gen |
Generation time of this :class:`.Compiled`, used for reporting cache stats. |
def delete_extra_from_clause(self, delete_stmt, from_table, extra_froms, from_hints, **kw):
(source)
¶
Render the DELETE .. USING clause specific to PostgreSQL.
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 visit_json_path_getitem_op_binary(self, binary, operator, _cast_applied=False, **kw):
(source)
¶
Undocumented