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

Method params

lib/sqlalchemy/sql/elements.py:586–605  ·  view source on GitHub ↗

Return a copy with :func:`_expression.bindparam` elements replaced. Returns a copy of this ClauseElement with :func:`_expression.bindparam` elements replaced with values taken from the given dictionary:: >>> clause = column("x") + bindparam("foo")

(
        self,
        __optionaldict: Optional[Mapping[str, Any]] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

584 return self._replace_params(True, __optionaldict, kwargs)
585
586 def params(
587 self,
588 __optionaldict: Optional[Mapping[str, Any]] = None,
589 **kwargs: Any,
590 ) -> Self:
591 """Return a copy with :func:`_expression.bindparam` elements
592 replaced.
593
594 Returns a copy of this ClauseElement with
595 :func:`_expression.bindparam`
596 elements replaced with values taken from the given dictionary::
597
598 >>> clause = column("x") + bindparam("foo")
599 >>> print(clause.compile().params)
600 {'foo':None}
601 >>> print(clause.params({"foo": 7}).compile().params)
602 {'foo':7}
603
604 """
605 return self._replace_params(False, __optionaldict, kwargs)
606
607 def _replace_params(
608 self,

Callers

nothing calls this directly

Calls 1

_replace_paramsMethod · 0.95

Tested by

no test coverage detected