diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-16 12:39:51 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-01-16 18:44:21 -0500 |
| commit | 8860117c9655a4bdeafebab1c6ef12c6a6198e66 (patch) | |
| tree | 7fc8743f78b6d4f1ae183265abec76e11560232c /test/sql | |
| parent | 6137d223be8e596fb2d7c78623ab22162db8ea6e (diff) | |
| download | sqlalchemy-8860117c9655a4bdeafebab1c6ef12c6a6198e66.tar.gz | |
introduce generalized decorator to prevent invalid method calls
This introduces the ``_exclusive_against()`` utility decorator
that can be used to prevent repeated invocations of methods that
typically should only be called once.
An informative error message is now raised for a selected set of DML
methods (currently all part of :class:`_dml.Insert` constructs) if they are
called a second time, which would implicitly cancel out the previous
setting. The methods altered include:
:class:`_sqlite.Insert.on_conflict_do_update`,
:class:`_sqlite.Insert.on_conflict_do_nothing` (SQLite),
:class:`_postgresql.Insert.on_conflict_do_update`,
:class:`_postgresql.Insert.on_conflict_do_nothing` (PostgreSQL),
:class:`_mysql.Insert.on_duplicate_key_update` (MySQL)
Fixes: #5169
Change-Id: I9278fa87cd3470dcf296ff96bb0fb17a3236d49d
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_update.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/sql/test_update.py b/test/sql/test_update.py index 946a01651..26b0f6217 100644 --- a/test/sql/test_update.py +++ b/test/sql/test_update.py @@ -672,7 +672,7 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL): stmt = table1.update().ordered_values(("myid", 1), ("name", "d1")) assert_raises_message( - exc.ArgumentError, + exc.InvalidRequestError, "This statement already has ordered values present", stmt.values, {"myid": 2, "name": "d2"}, |
