MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/dialects/mysql/enumerated.py:41–78  ·  view source on GitHub ↗

Construct an ENUM. E.g.:: Column("myenum", ENUM("foo", "bar", "baz")) :param enums: The range of valid values for this ENUM. Values in enums are not quoted, they will be escaped and surrounded by single quotes when generating the schema. This object

(self, *enums: Union[str, Type[enum.Enum]], **kw: Any)

Source from the content-addressed store, hash-verified

39 native_enum = True
40
41 def __init__(self, *enums: Union[str, Type[enum.Enum]], **kw: Any) -> None:
42 """Construct an ENUM.
43
44 E.g.::
45
46 Column("myenum", ENUM("foo", "bar", "baz"))
47
48 :param enums: The range of valid values for this ENUM. Values in
49 enums are not quoted, they will be escaped and surrounded by single
50 quotes when generating the schema. This object may also be a
51 PEP-435-compliant enumerated type.
52
53 :param strict: This flag has no effect.
54
55 .. versionchanged:: The MySQL ENUM type as well as the base Enum
56 type now validates all Python data values.
57
58 :param charset: Optional, a column-level character set for this string
59 value. Takes precedence to 'ascii' or 'unicode' short-hand.
60
61 :param collation: Optional, a column-level collation for this string
62 value. Takes precedence to 'binary' short-hand.
63
64 :param ascii: Defaults to False: short-hand for the ``latin1``
65 character set, generates ASCII in schema.
66
67 :param unicode: Defaults to False: short-hand for the ``ucs2``
68 character set, generates UNICODE in schema.
69
70 :param binary: Defaults to False: short-hand, pick the binary
71 collation type that matches the column's character set. Generates
72 BINARY in schema. This does not affect the type of data stored,
73 only the collation of character data.
74
75 """
76 kw.pop("strict", None)
77 self._enum_init(enums, kw) # type: ignore[arg-type]
78 _StringType.__init__(self, length=self.length, **kw)
79
80 @classmethod
81 def adapt_emulated_to_native(

Callers

nothing calls this directly

Calls 3

_enum_initMethod · 0.80
popMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected