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

Method __init__

lib/sqlalchemy/sql/elements.py:1974–2075  ·  view source on GitHub ↗
(
        self,
        key: Optional[str],
        value: Any = _NoArg.NO_ARG,
        type_: Optional[_TypeEngineArgument[_T]] = None,
        unique: bool = False,
        required: Union[bool, Literal[_NoArg.NO_ARG]] = _NoArg.NO_ARG,
        quote: Optional[bool] = None,
        callable_: Optional[Callable[[], Any]] = None,
        expanding: bool = False,
        isoutparam: bool = False,
        literal_execute: bool = False,
        _compared_to_operator: Optional[OperatorType] = None,
        _compared_to_type: Optional[TypeEngine[Any]] = None,
        _is_crud: bool = False,
    )

Source from the content-addressed store, hash-verified

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,
1989 ):
1990 if required is _NoArg.NO_ARG:
1991 required = value is _NoArg.NO_ARG and callable_ is None
1992 if value is _NoArg.NO_ARG:
1993 value = None
1994
1995 if quote is not None:
1996 key = quoted_name.construct(key, quote)
1997
1998 if unique:
1999 self.key = _anonymous_label.safe_construct(
2000 id(self),
2001 (
2002 key
2003 if key is not None
2004 and not isinstance(key, _anonymous_label)
2005 else "param"
2006 ),
2007 sanitize_key=True,
2008 )
2009 self._key_is_anon = True
2010 elif key:
2011 self.key = key
2012 else:
2013 self.key = _anonymous_label.safe_construct(id(self), "param")
2014 self._key_is_anon = True
2015
2016 # identifying key that won't change across
2017 # clones, used to identify the bind's logical
2018 # identity
2019 self._identifying_key = self.key
2020
2021 # key that was passed in the first place, used to
2022 # generate new keys
2023 self._orig_key = key or "param"
2024
2025 self.unique = unique
2026 self.value = value
2027 self.callable = callable_
2028 self.isoutparam = isoutparam
2029 self.required = required
2030
2031 # indicate an "expanding" parameter; the compiler sets this

Callers

nothing calls this directly

Calls 6

is_tuple_typeFunction · 0.85
castFunction · 0.85
constructMethod · 0.80
safe_constructMethod · 0.80
coerce_compared_valueMethod · 0.45

Tested by

no test coverage detected