mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-28 19:44:50 -04:00
Small improvement on FlushError can't delete error message
Output in the error message the table name and the column name.
This commit is contained in:
@@ -441,9 +441,9 @@ def _collect_delete_commands(base_mapper, uowtransaction, table,
|
||||
state, state_dict, col)
|
||||
if value is None:
|
||||
raise orm_exc.FlushError(
|
||||
"Can't delete from table "
|
||||
"Can't delete from table %s "
|
||||
"using NULL for primary "
|
||||
"key value")
|
||||
"key value on column %s" % (table, col))
|
||||
|
||||
if update_version_id is not None and \
|
||||
table.c.contains_column(mapper.version_id_col):
|
||||
|
||||
@@ -2505,7 +2505,8 @@ class PartialNullPKTest(fixtures.MappedTest):
|
||||
s.delete(t1)
|
||||
assert_raises_message(
|
||||
orm_exc.FlushError,
|
||||
"Can't delete from table using NULL for primary key value",
|
||||
"Can't delete from table t1 using NULL "
|
||||
"for primary key value on column t1.col2",
|
||||
s.commit
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user