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
| 2013 | |
| 2014 | |
| 2015 | class 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, |
no outgoing calls