MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / prefix_with

Method prefix_with

lib/sqlalchemy/sql/selectable.py:406–441  ·  view source on GitHub ↗

r"""Add one or more expressions following the statement keyword, i.e. SELECT, INSERT, UPDATE, or DELETE. Generative. This is used to support backend-specific prefix keywords such as those provided by MySQL. E.g.:: stmt = table.insert().prefix_with("LOW_

(
        self,
        *prefixes: _TextCoercedExpressionArgument[Any],
        dialect: str = "*",
    )

Source from the content-addressed store, hash-verified

404 ":paramref:`.HasPrefixes.prefix_with.*prefixes`",
405 )
406 def prefix_with(
407 self,
408 *prefixes: _TextCoercedExpressionArgument[Any],
409 dialect: str = "*",
410 ) -> Self:
411 r"""Add one or more expressions following the statement keyword, i.e.
412 SELECT, INSERT, UPDATE, or DELETE. Generative.
413
414 This is used to support backend-specific prefix keywords such as those
415 provided by MySQL.
416
417 E.g.::
418
419 stmt = table.insert().prefix_with("LOW_PRIORITY", dialect="mysql")
420
421 # MySQL 5.7 optimizer hints
422 stmt = select(table).prefix_with("/*+ BKA(t1) */", dialect="mysql")
423
424 Multiple prefixes can be specified by multiple calls
425 to :meth:`_expression.HasPrefixes.prefix_with`.
426
427 :param \*prefixes: textual or :class:`_expression.ClauseElement`
428 construct which
429 will be rendered following the INSERT, UPDATE, or DELETE
430 keyword.
431 :param dialect: optional string dialect name which will
432 limit rendering of this prefix to only that dialect.
433
434 """
435 self._prefixes = self._prefixes + tuple(
436 [
437 (coercions.expect(roles.StatementOptionRole, p), dialect)
438 for p in prefixes
439 ]
440 )
441 return self
442
443
444class HasSuffixes:

Callers 15

test_prefix_withMethod · 0.80
test_prefixMethod · 0.80
CoreFixturesClass · 0.80
test_prefixesMethod · 0.80
test_prefixesMethod · 0.80
test_prefixesMethod · 0.80
test_prefix_withMethod · 0.80
test_prefix_withMethod · 0.80
test_one_prefixMethod · 0.80
test_many_prefixesMethod · 0.80

Calls

no outgoing calls

Tested by 13

test_prefix_withMethod · 0.64
test_prefixMethod · 0.64
test_prefixesMethod · 0.64
test_prefixesMethod · 0.64
test_prefixesMethod · 0.64
test_prefix_withMethod · 0.64
test_prefix_withMethod · 0.64
test_one_prefixMethod · 0.64
test_many_prefixesMethod · 0.64
test_chained_prefixesMethod · 0.64
test_orm_query_basicMethod · 0.64