MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _no_text_coercion

Function _no_text_coercion

lib/sqlalchemy/sql/coercions.py:587–602  ·  view source on GitHub ↗
(
    element: Any,
    argname: Optional[str] = None,
    exc_cls: Type[exc.SQLAlchemyError] = exc.ArgumentError,
    extra: Optional[str] = None,
    err: Optional[Exception] = None,
)

Source from the content-addressed store, hash-verified

585
586
587def _no_text_coercion(
588 element: Any,
589 argname: Optional[str] = None,
590 exc_cls: Type[exc.SQLAlchemyError] = exc.ArgumentError,
591 extra: Optional[str] = None,
592 err: Optional[Exception] = None,
593) -> NoReturn:
594 raise exc_cls(
595 "%(extra)sTextual SQL expression %(expr)r %(argname)sshould be "
596 "explicitly declared as text(%(expr)r)"
597 % {
598 "expr": util.ellipses_string(element),
599 "argname": "for argument %s" % (argname,) if argname else "",
600 "extra": "%s " % extra if extra else "",
601 }
602 ) from err
603
604
605class _NoTextCoercion(RoleImpl):

Callers 3

_literal_coercionMethod · 0.85
_text_coercionMethod · 0.85
_text_coercionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected