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
| 1929 | |
| 1930 | |
| 1931 | class 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, |
no outgoing calls