diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-10-07 09:05:34 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-10-07 09:54:39 -0400 |
commit | 8a13957db790c77b76c11f5f43fad1492a50fcf0 (patch) | |
tree | 893ad1e8ac70458a41916f78457ced6f59b50601 /lib/sqlalchemy/sql/crud.py | |
parent | ae9300cac0ec398f92d9e523273403126a709134 (diff) | |
download | sqlalchemy-8a13957db790c77b76c11f5f43fad1492a50fcf0.tar.gz |
Change autoincrement compileerror to a warning
Users are complaining that IntegrityError is no longer
raised.
Change-Id: I0855d5b7a98d4338f0910501b6e6d404ba33634d
Fixes: #3216
Diffstat (limited to 'lib/sqlalchemy/sql/crud.py')
-rw-r--r-- | lib/sqlalchemy/sql/crud.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py index f770fc513..642659c84 100644 --- a/lib/sqlalchemy/sql/crud.py +++ b/lib/sqlalchemy/sql/crud.py @@ -301,7 +301,7 @@ def _scan_cols( elif c.primary_key and \ c is not stmt.table._autoincrement_column and \ not c.nullable: - _raise_pk_with_no_anticipated_value(c) + _warn_pk_with_no_anticipated_value(c) elif compiler.isupdate: _append_param_update( @@ -379,7 +379,7 @@ def _append_param_insert_pk_returning(compiler, stmt, c, values, kw): elif not c.nullable: # no .default, no .server_default, not autoincrement, we have # no indication this primary key column will have any value - _raise_pk_with_no_anticipated_value(c) + _warn_pk_with_no_anticipated_value(c) def _create_insert_prefetch_bind_param(compiler, c, process=True, name=None): @@ -464,7 +464,7 @@ def _append_param_insert_pk(compiler, stmt, c, values, kw): elif c.default is None and c.server_default is None and not c.nullable: # no .default, no .server_default, not autoincrement, we have # no indication this primary key column will have any value - _raise_pk_with_no_anticipated_value(c) + _warn_pk_with_no_anticipated_value(c) def _append_param_insert_hasdefault( @@ -671,7 +671,7 @@ def _get_returning_modifiers(compiler, stmt): implicit_return_defaults, postfetch_lastrowid -def _raise_pk_with_no_anticipated_value(c): +def _warn_pk_with_no_anticipated_value(c): msg = ( "Column '%s.%s' is marked as a member of the " "primary key for table '%s', " @@ -689,4 +689,4 @@ def _raise_pk_with_no_anticipated_value(c): "behavior is expected for one of the columns in the primary key. " "CREATE TABLE statements are impacted by this change as well on " "most backends.") - raise exc.CompileError(msg) + util.warn(msg) |