MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / prefix_with

Method prefix_with

lib/sqlalchemy/sql/selectable.py:390–425  ·  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

388 ":paramref:`.HasPrefixes.prefix_with.*prefixes`",
389 )
390 def prefix_with(
391 self,
392 *prefixes: _TextCoercedExpressionArgument[Any],
393 dialect: str = "*",
394 ) -> Self:
395 r"""Add one or more expressions following the statement keyword, i.e.
396 SELECT, INSERT, UPDATE, or DELETE. Generative.
397
398 This is used to support backend-specific prefix keywords such as those
399 provided by MySQL.
400
401 E.g.::
402
403 stmt = table.insert().prefix_with("LOW_PRIORITY", dialect="mysql")
404
405 # MySQL 5.7 optimizer hints
406 stmt = select(table).prefix_with("/*+ BKA(t1) */", dialect="mysql")
407
408 Multiple prefixes can be specified by multiple calls
409 to :meth:`_expression.HasPrefixes.prefix_with`.
410
411 :param \*prefixes: textual or :class:`_expression.ClauseElement`
412 construct which
413 will be rendered following the INSERT, UPDATE, or DELETE
414 keyword.
415 :param dialect: optional string dialect name which will
416 limit rendering of this prefix to only that dialect.
417
418 """
419 self._prefixes = self._prefixes + tuple(
420 [
421 (coercions.expect(roles.StatementOptionRole, p), dialect)
422 for p in prefixes
423 ]
424 )
425 return self
426
427
428class 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