A DDL-specified DEFAULT column value. :class:`.DefaultClause` is a :class:`.FetchedValue` that also generates a "DEFAULT" clause when "CREATE TABLE" is emitted. :class:`.DefaultClause` is generated automatically whenever the ``server_default``, ``server_onupdate`` arguments of
| 4047 | |
| 4048 | |
| 4049 | class DefaultClause(FetchedValue): |
| 4050 | """A DDL-specified DEFAULT column value. |
| 4051 | |
| 4052 | :class:`.DefaultClause` is a :class:`.FetchedValue` |
| 4053 | that also generates a "DEFAULT" clause when |
| 4054 | "CREATE TABLE" is emitted. |
| 4055 | |
| 4056 | :class:`.DefaultClause` is generated automatically |
| 4057 | whenever the ``server_default``, ``server_onupdate`` arguments of |
| 4058 | :class:`_schema.Column` are used. A :class:`.DefaultClause` |
| 4059 | can be passed positionally as well. |
| 4060 | |
| 4061 | For example, the following:: |
| 4062 | |
| 4063 | Column("foo", Integer, server_default="50") |
| 4064 | |
| 4065 | Is equivalent to:: |
| 4066 | |
| 4067 | Column("foo", Integer, DefaultClause("50")) |
| 4068 | |
| 4069 | """ |
| 4070 | |
| 4071 | has_argument = True |
| 4072 | |
| 4073 | def __init__( |
| 4074 | self, |
| 4075 | arg: Union[str, ClauseElement, TextClause], |
| 4076 | for_update: bool = False, |
| 4077 | _reflected: bool = False, |
| 4078 | ) -> None: |
| 4079 | util.assert_arg_type(arg, (str, ClauseElement, TextClause), "arg") |
| 4080 | super().__init__(for_update) |
| 4081 | self.arg = arg |
| 4082 | self.reflected = _reflected |
| 4083 | |
| 4084 | def __repr__(self) -> str: |
| 4085 | return "DefaultClause(%r, for_update=%r)" % (self.arg, self.for_update) |
| 4086 | |
| 4087 | |
| 4088 | class Constraint(DialectKWArgs, HasConditionalDDL, SchemaItem): |
no outgoing calls