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

Class BindParameter

lib/sqlalchemy/sql/elements.py:1931–2214  ·  view source on GitHub ↗

r"""Represent a "bound expression". :class:`.BindParameter` is invoked explicitly using the :func:`.bindparam` function, as in:: from sqlalchemy import bindparam stmt = select(users_table).where( users_table.c.name == bindparam("username") ) Detail

Source from the content-addressed store, hash-verified

1929
1930
1931class BindParameter(roles.InElementRole, KeyedColumnElement[_T]):
1932 r"""Represent a "bound expression".
1933
1934 :class:`.BindParameter` is invoked explicitly using the
1935 :func:`.bindparam` function, as in::
1936
1937 from sqlalchemy import bindparam
1938
1939 stmt = select(users_table).where(
1940 users_table.c.name == bindparam("username")
1941 )
1942
1943 Detailed discussion of how :class:`.BindParameter` is used is
1944 at :func:`.bindparam`.
1945
1946 .. seealso::
1947
1948 :func:`.bindparam`
1949
1950 """
1951
1952 __visit_name__ = "bindparam"
1953
1954 _traverse_internals: _TraverseInternalsType = [
1955 ("key", InternalTraversal.dp_anon_name),
1956 ("type", InternalTraversal.dp_type),
1957 ("callable", InternalTraversal.dp_plain_dict),
1958 ("value", InternalTraversal.dp_plain_obj),
1959 ("literal_execute", InternalTraversal.dp_boolean),
1960 ]
1961
1962 key: str
1963 type: TypeEngine[_T]
1964 value: Optional[_T]
1965
1966 _is_crud = False
1967 _is_bind_parameter = True
1968 _key_is_anon = False
1969
1970 # bindparam implements its own _gen_cache_key() method however
1971 # we check subclasses for this flag, else no cache key is generated
1972 inherit_cache = True
1973
1974 def __init__(
1975 self,
1976 key: Optional[str],
1977 value: Any = _NoArg.NO_ARG,
1978 type_: Optional[_TypeEngineArgument[_T]] = None,
1979 unique: bool = False,
1980 required: Union[bool, Literal[_NoArg.NO_ARG]] = _NoArg.NO_ARG,
1981 quote: Optional[bool] = None,
1982 callable_: Optional[Callable[[], Any]] = None,
1983 expanding: bool = False,
1984 isoutparam: bool = False,
1985 literal_execute: bool = False,
1986 _compared_to_operator: Optional[OperatorType] = None,
1987 _compared_to_type: Optional[TypeEngine[Any]] = None,
1988 _is_crud: bool = False,

Callers 12

test_inMethod · 0.90
test_not_inMethod · 0.90
_bind_paramMethod · 0.85
replMethod · 0.85
_bind_paramMethod · 0.85
_bind_paramMethod · 0.85
_bind_paramMethod · 0.85
_bind_paramMethod · 0.85
_bind_paramMethod · 0.85
_bind_paramMethod · 0.85
outparamFunction · 0.85
bindparamFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_inMethod · 0.72
test_not_inMethod · 0.72