| 559 | _attribute_options: _AttributeOptions |
| 560 | |
| 561 | def __init__(self, *arg: Any, **kw: Any): |
| 562 | self._attribute_options = attr_opts = kw.pop( |
| 563 | "attribute_options", _DEFAULT_ATTRIBUTE_OPTIONS |
| 564 | ) |
| 565 | |
| 566 | self._use_existing_column = kw.pop("use_existing_column", False) |
| 567 | |
| 568 | self._has_dataclass_arguments = ( |
| 569 | attr_opts is not None |
| 570 | and attr_opts != _DEFAULT_ATTRIBUTE_OPTIONS |
| 571 | and any( |
| 572 | attr_opts[i] is not _NoArg.NO_ARG |
| 573 | for i, attr in enumerate(attr_opts._fields) |
| 574 | if attr != "dataclasses_default" |
| 575 | ) |
| 576 | ) |
| 577 | |
| 578 | insert_default = kw.get("insert_default", _NoArg.NO_ARG) |
| 579 | self._has_insert_default = insert_default is not _NoArg.NO_ARG |
| 580 | self._default_scalar_value = _NoArg.NO_ARG |
| 581 | |
| 582 | if attr_opts.dataclasses_default is not _NoArg.NO_ARG: |
| 583 | kw["default"] = attr_opts.dataclasses_default |
| 584 | |
| 585 | self.deferred_group = kw.pop("deferred_group", None) |
| 586 | self.deferred_raiseload = kw.pop("deferred_raiseload", None) |
| 587 | self.deferred = kw.pop("deferred", _NoArg.NO_ARG) |
| 588 | self.active_history = kw.pop("active_history", False) |
| 589 | |
| 590 | self._sort_order = kw.pop("sort_order", _NoArg.NO_ARG) |
| 591 | |
| 592 | # note that this populates "default" into the Column, so that if |
| 593 | # we are a dataclass and "default" is a dataclass default, it is still |
| 594 | # used as a Core-level default for the Column in addition to its |
| 595 | # dataclass role |
| 596 | self.column = cast("Column[_T]", Column(*arg, **kw)) |
| 597 | |
| 598 | self.foreign_keys = self.column.foreign_keys |
| 599 | self._has_nullable = "nullable" in kw and kw.get("nullable") not in ( |
| 600 | None, |
| 601 | SchemaConst.NULL_UNSPECIFIED, |
| 602 | ) |
| 603 | util.set_creation_order(self) |
| 604 | |
| 605 | def _copy(self, **kw: Any) -> Self: |
| 606 | new = self.__class__.__new__(self.__class__) |