diff options
| author | Denis Kataev <denis.a.kataev+git@gmail.com> | 2018-03-12 11:40:34 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-11-07 18:26:40 -0500 |
| commit | de804d7245dd203bc63e4493162bcdf5e8646440 (patch) | |
| tree | 1a6287f154e4631ed7602687b2ed74a64abab2cc /lib/sqlalchemy/sql/schema.py | |
| parent | 15ac07f7b6c235131361f289d75d174c49afb0b5 (diff) | |
| download | sqlalchemy-de804d7245dd203bc63e4493162bcdf5e8646440.tar.gz | |
Implement SQLite ON CONFLICT for constraints
Implemented the SQLite ``ON CONFLICT`` clause as understood at the DDL
level, e.g. for primary key, unique, and CHECK constraints as well as
specified on a :class:`.Column` to satisfy inline primary key and NOT NULL.
Pull request courtesy Denis Kataev.
Fixes: #4360
Change-Id: I4cd4bafa8fca41e3101c87dbbfe169741bbda3f4
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/431
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 88050b87e..14d706720 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -913,7 +913,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause): return self._schema_item_copy(table) -class Column(SchemaItem, ColumnClause): +class Column(DialectKWArgs, SchemaItem, ColumnClause): """Represents a column in a database table.""" __visit_name__ = 'column' @@ -1284,9 +1284,10 @@ class Column(SchemaItem, ColumnClause): if 'info' in kwargs: self.info = kwargs.pop('info') - if kwargs: - raise exc.ArgumentError( - "Unknown arguments passed to Column: " + repr(list(kwargs))) + self._extra_kwargs(**kwargs) + + def _extra_kwargs(self, **kwargs): + self._validate_dialect_kwargs(kwargs) # @property # def quote(self): @@ -2748,7 +2749,7 @@ class CheckConstraint(ColumnCollectionConstraint): def __init__(self, sqltext, name=None, deferrable=None, initially=None, table=None, info=None, _create_rule=None, - _autoattach=True, _type_bound=False): + _autoattach=True, _type_bound=False, **kw): r"""Construct a CHECK constraint. :param sqltext: @@ -2787,7 +2788,7 @@ class CheckConstraint(ColumnCollectionConstraint): name=name, deferrable=deferrable, initially=initially, _create_rule=_create_rule, info=info, _type_bound=_type_bound, _autoattach=_autoattach, - *columns) + *columns, **kw) if table is not None: self._set_parent_with_dispatch(table) |
