merge the elements of this column onto "other" this is used by ORM pep-593 merge and will likely need a lot of fixes.
(
self, other: Column[Any], *, omit_defaults: bool = False
)
| 2805 | return self._schema_item_copy(c) |
| 2806 | |
| 2807 | def _merge( |
| 2808 | self, other: Column[Any], *, omit_defaults: bool = False |
| 2809 | ) -> None: |
| 2810 | """merge the elements of this column onto "other" |
| 2811 | |
| 2812 | this is used by ORM pep-593 merge and will likely need a lot |
| 2813 | of fixes. |
| 2814 | |
| 2815 | |
| 2816 | """ |
| 2817 | |
| 2818 | if self.primary_key: |
| 2819 | other.primary_key = True |
| 2820 | |
| 2821 | if self.autoincrement != "auto" and other.autoincrement == "auto": |
| 2822 | other.autoincrement = self.autoincrement |
| 2823 | |
| 2824 | if self.system: |
| 2825 | other.system = self.system |
| 2826 | |
| 2827 | if self.info: |
| 2828 | other.info.update(self.info) |
| 2829 | |
| 2830 | type_ = self.type |
| 2831 | if not type_._isnull and other.type._isnull: |
| 2832 | if isinstance(type_, SchemaEventTarget): |
| 2833 | type_ = type_.copy() |
| 2834 | |
| 2835 | other.type = type_ |
| 2836 | |
| 2837 | if isinstance(type_, SchemaEventTarget): |
| 2838 | type_._set_parent_with_dispatch(other) |
| 2839 | |
| 2840 | for impl in type_._variant_mapping.values(): |
| 2841 | if isinstance(impl, SchemaEventTarget): |
| 2842 | impl._set_parent_with_dispatch(other) |
| 2843 | |
| 2844 | if ( |
| 2845 | self._user_defined_nullable is not NULL_UNSPECIFIED |
| 2846 | and other._user_defined_nullable is NULL_UNSPECIFIED |
| 2847 | ): |
| 2848 | other.nullable = self.nullable |
| 2849 | other._user_defined_nullable = self._user_defined_nullable |
| 2850 | |
| 2851 | if ( |
| 2852 | not omit_defaults |
| 2853 | and self.default is not None |
| 2854 | and other.default is None |
| 2855 | ): |
| 2856 | new_default = self.default._copy() |
| 2857 | new_default._set_parent(other) |
| 2858 | |
| 2859 | if self.server_default and other.server_default is None: |
| 2860 | new_server_default = self.server_default |
| 2861 | if isinstance(new_server_default, FetchedValue): |
| 2862 | new_server_default = new_server_default._copy() |
| 2863 | new_server_default._set_parent(other) |
| 2864 | else: |