Default generator that's specific to the use of a "sentinel" column when using the insertmanyvalues feature. This default is used as part of the :func:`_schema.insert_sentinel` construct.
| 3513 | |
| 3514 | |
| 3515 | class _InsertSentinelColumnDefault(ColumnDefault): |
| 3516 | """Default generator that's specific to the use of a "sentinel" column |
| 3517 | when using the insertmanyvalues feature. |
| 3518 | |
| 3519 | This default is used as part of the :func:`_schema.insert_sentinel` |
| 3520 | construct. |
| 3521 | |
| 3522 | """ |
| 3523 | |
| 3524 | is_sentinel = True |
| 3525 | for_update = False |
| 3526 | arg = None |
| 3527 | |
| 3528 | def __new__(cls) -> _InsertSentinelColumnDefault: |
| 3529 | return object.__new__(cls) |
| 3530 | |
| 3531 | def __init__(self) -> None: |
| 3532 | pass |
| 3533 | |
| 3534 | def _set_parent(self, parent: SchemaEventTarget, **kw: Any) -> None: |
| 3535 | col = cast("Column[Any]", parent) |
| 3536 | if not col._insert_sentinel: |
| 3537 | raise exc.ArgumentError( |
| 3538 | "The _InsertSentinelColumnDefault may only be applied to a " |
| 3539 | "Column marked as insert_sentinel=True" |
| 3540 | ) |
| 3541 | elif not col.nullable: |
| 3542 | raise exc.ArgumentError( |
| 3543 | "The _InsertSentinelColumnDefault may only be applied to a " |
| 3544 | "Column that is nullable" |
| 3545 | ) |
| 3546 | |
| 3547 | super()._set_parent(parent, **kw) |
| 3548 | |
| 3549 | def _copy(self) -> _InsertSentinelColumnDefault: |
| 3550 | return _InsertSentinelColumnDefault() |
| 3551 | |
| 3552 | |
| 3553 | _SQLExprDefault = Union["ColumnElement[Any]", "TextClause"] |
no outgoing calls