class documentation

Undocumented

Method with_hint Add an indexing or other executional context hint for the given selectable to this :class:`_expression.Select` or other selectable object.
Method with_statement_hint Add a statement hint to this :class:`_expression.Select` or other selectable object.
Method _with_hint Undocumented
Class Variable _has_hints_traverse_internals Undocumented
Class Variable _hints Undocumented
Class Variable _statement_hints Undocumented
@_generative
def with_hint(self, selectable: _FromClauseArgument, text: str, dialect_name: str = '*') -> Self: (source)

Add an indexing or other executional context hint for the given selectable to this :class:`_expression.Select` or other selectable object. The text of the hint is rendered in the appropriate location for the database backend in use, relative to the given :class:`_schema.Table` or :class:`_expression.Alias` passed as the ``selectable`` argument. The dialect implementation typically uses Python string substitution syntax with the token ``%(name)s`` to render the name of the table or alias. E.g. when using Oracle, the following:: select(mytable).\ with_hint(mytable, "index(%(name)s ix_mytable)") Would render SQL as:: select /*+ index(mytable ix_mytable) */ ... from mytable The ``dialect_name`` option will limit the rendering of a particular hint to a particular backend. Such as, to add hints for both Oracle and Sybase simultaneously:: select(mytable).\ with_hint(mytable, "index(%(name)s ix_mytable)", 'oracle').\ with_hint(mytable, "WITH INDEX ix_mytable", 'mssql') .. seealso:: :meth:`_expression.Select.with_statement_hint`

def with_statement_hint(self, text: str, dialect_name: str = '*') -> Self: (source)

Add a statement hint to this :class:`_expression.Select` or other selectable object. This method is similar to :meth:`_expression.Select.with_hint` except that it does not require an individual table, and instead applies to the statement as a whole. Hints here are specific to the backend database and may include directives such as isolation levels, file directives, fetch directives, etc. .. versionadded:: 1.0.0 .. seealso:: :meth:`_expression.Select.with_hint` :meth:`_expression.Select.prefix_with` - generic SELECT prefixing which also can suit some database-specific HINT syntaxes such as MySQL optimizer hints

def _with_hint(self, selectable: Optional[_FromClauseArgument], text: str, dialect_name: str) -> Self: (source)

Undocumented

_has_hints_traverse_internals: _TraverseInternalsType = (source)

Undocumented

_hints: util.immutabledict[Tuple[FromClause, str], str] = (source)

Undocumented

_statement_hints: Tuple[Tuple[str, str], ...] = (source)

Undocumented