MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _InsertSentinelColumnDefault

Class _InsertSentinelColumnDefault

lib/sqlalchemy/sql/schema.py:3824–3859  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

3822
3823
3824class _InsertSentinelColumnDefault(ColumnDefault):
3825 """Default generator that's specific to the use of a "sentinel" column
3826 when using the insertmanyvalues feature.
3827
3828 This default is used as part of the :func:`_schema.insert_sentinel`
3829 construct.
3830
3831 """
3832
3833 is_sentinel = True
3834 for_update = False
3835 arg = None
3836
3837 def __new__(cls) -> _InsertSentinelColumnDefault:
3838 return object.__new__(cls)
3839
3840 def __init__(self) -> None:
3841 pass
3842
3843 def _set_parent(self, parent: SchemaEventTarget, **kw: Any) -> None:
3844 col = cast("Column[Any]", parent)
3845 if not col._insert_sentinel:
3846 raise exc.ArgumentError(
3847 "The _InsertSentinelColumnDefault may only be applied to a "
3848 "Column marked as insert_sentinel=True"
3849 )
3850 elif not col.nullable:
3851 raise exc.ArgumentError(
3852 "The _InsertSentinelColumnDefault may only be applied to a "
3853 "Column that is nullable"
3854 )
3855
3856 super()._set_parent(parent, **kw)
3857
3858 def _copy(self) -> _InsertSentinelColumnDefault:
3859 return _InsertSentinelColumnDefault()
3860
3861
3862_SQLExprDefault = Union["ColumnElement[Any]", "TextClause"]

Callers 5

insert_sentinelFunction · 0.85
_copyMethod · 0.85
orm_insert_sentinelFunction · 0.85

Calls

no outgoing calls