summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2019-05-16 02:09:05 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2019-05-16 02:09:05 +0000
commitef618f041998c2bb463a3476a51b45b74715a5eb (patch)
treeb46f8cabcc4449fcef7c571d2816d85bc27e7322 /lib/sqlalchemy
parent89e6beaf46ebdd626e292eb20f7b6ae0c3a9ae5c (diff)
parent05bcd4c6eb600b0ab7866183315c05384575db64 (diff)
downloadsqlalchemy-ef618f041998c2bb463a3476a51b45b74715a5eb.tar.gz
Merge "Turn FlushError for identity already exists into a warning."
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/persistence.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index f1a73c7cd..e686b61c3 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -402,24 +402,24 @@ def _organize_states_for_save(base_mapper, states, uowtransaction):
if not uowtransaction.was_already_deleted(existing):
if not uowtransaction.is_deleted(existing):
- raise orm_exc.FlushError(
+ util.warn(
"New instance %s with identity key %s conflicts "
"with persistent instance %s"
% (state_str(state), instance_key, state_str(existing))
)
+ else:
+ base_mapper._log_debug(
+ "detected row switch for identity %s. "
+ "will update %s, remove %s from "
+ "transaction",
+ instance_key,
+ state_str(state),
+ state_str(existing),
+ )
- base_mapper._log_debug(
- "detected row switch for identity %s. "
- "will update %s, remove %s from "
- "transaction",
- instance_key,
- state_str(state),
- state_str(existing),
- )
-
- # remove the "delete" flag from the existing element
- uowtransaction.remove_state_actions(existing)
- row_switch = existing
+ # remove the "delete" flag from the existing element
+ uowtransaction.remove_state_actions(existing)
+ row_switch = existing
if (has_identity or row_switch) and mapper.version_id_col is not None:
update_version_id = mapper._get_committed_state_attr_by_column(