MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / BindParameter

Class BindParameter

lib/sqlalchemy/sql/elements.py:2015–2305  ·  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

2013
2014
2015class BindParameter(roles.InElementRole, KeyedColumnElement[_T]):
2016 r"""Represent a "bound expression".
2017
2018 :class:`.BindParameter` is invoked explicitly using the
2019 :func:`.bindparam` function, as in::
2020
2021 from sqlalchemy import bindparam
2022
2023 stmt = select(users_table).where(
2024 users_table.c.name == bindparam("username")
2025 )
2026
2027 Detailed discussion of how :class:`.BindParameter` is used is
2028 at :func:`.bindparam`.
2029
2030 .. seealso::
2031
2032 :func:`.bindparam`
2033
2034 """
2035
2036 __visit_name__ = "bindparam"
2037
2038 _traverse_internals: _TraverseInternalsType = [
2039 ("key", InternalTraversal.dp_anon_name),
2040 ("type", InternalTraversal.dp_type),
2041 ("callable", InternalTraversal.dp_plain_dict),
2042 ("value", InternalTraversal.dp_plain_obj),
2043 ("literal_execute", InternalTraversal.dp_boolean),
2044 ]
2045
2046 key: str
2047 _anon_map_key: Optional[str] = None
2048 type: TypeEngine[_T]
2049 value: Optional[_T]
2050
2051 _is_crud = False
2052 _is_bind_parameter = True
2053
2054 # bindparam implements its own _gen_cache_key() method however
2055 # we check subclasses for this flag, else no cache key is generated
2056 inherit_cache = True
2057
2058 def __init__(
2059 self,
2060 key: Optional[str],
2061 value: Any = _NoArg.NO_ARG,
2062 type_: Optional[_TypeEngineArgument[_T]] = None,
2063 unique: bool = False,
2064 required: Union[bool, Literal[_NoArg.NO_ARG]] = _NoArg.NO_ARG,
2065 quote: Optional[bool] = None,
2066 callable_: Optional[Callable[[], Any]] = None,
2067 expanding: bool = False,
2068 isoutparam: bool = False,
2069 literal_execute: bool = False,
2070 _compared_to_operator: Optional[OperatorType] = None,
2071 _compared_to_type: Optional[TypeEngine[Any]] = None,
2072 _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