MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / with_statement_hint

Method with_statement_hint

lib/sqlalchemy/sql/selectable.py:508–540  ·  view source on GitHub ↗

Add a statement hint to this :class:`_expression.Select` or other selectable object. .. tip:: :meth:`_expression.Select.with_statement_hint` generally adds hints **at the trailing end** of a SELECT statement. To place dialect-specific hints such

(self, text: str, dialect_name: str = "*")

Source from the content-addressed store, hash-verified

506
507 @_generative
508 def with_statement_hint(self, text: str, dialect_name: str = "*") -> Self:
509 """Add a statement hint to this :class:`_expression.Select` or
510 other selectable object.
511
512 .. tip::
513
514 :meth:`_expression.Select.with_statement_hint` generally adds hints
515 **at the trailing end** of a SELECT statement. To place
516 dialect-specific hints such as optimizer hints at the **front** of
517 the SELECT statement after the SELECT keyword, use the
518 :meth:`_expression.Select.prefix_with` method for an open-ended
519 space, or for table-specific hints the
520 :meth:`_expression.Select.with_hint` may be used, which places
521 hints in a dialect-specific location.
522
523 This method is similar to :meth:`_expression.Select.with_hint` except
524 that it does not require an individual table, and instead applies to
525 the statement as a whole.
526
527 Hints here are specific to the backend database and may include
528 directives such as isolation levels, file directives, fetch directives,
529 etc.
530
531 .. seealso::
532
533 :meth:`_expression.Select.with_hint`
534
535 :meth:`_expression.Select.prefix_with` - generic SELECT prefixing
536 which also can suit some database-specific HINT syntaxes such as
537 MySQL or Oracle Database optimizer hints
538
539 """
540 return self._with_hint(None, text, dialect_name)
541
542 @_generative
543 def with_hint(

Callers 3

test_statement_hintsMethod · 0.80
test_statement_hintsMethod · 0.80

Calls 1

_with_hintMethod · 0.95

Tested by 3

test_statement_hintsMethod · 0.64
test_statement_hintsMethod · 0.64