diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-10-15 18:41:02 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-10-15 18:41:02 +0000 |
| commit | c5571ab19a155f0c11381d65edc07c16902f3fad (patch) | |
| tree | 91d1177483fccf28f5527b1842f838c4623013fe /test/sql/test_query.py | |
| parent | bc351a2dc423987f05f4bf88db4987be507ee0a1 (diff) | |
| download | sqlalchemy-c5571ab19a155f0c11381d65edc07c16902f3fad.tar.gz | |
- an executemany() now requires that all bound parameter
sets require that all keys are present which are
present in the first bound parameter set. The structure
and behavior of an insert/update statement is very much
determined by the first parameter set, including which
defaults are going to fire off, and a minimum of
guesswork is performed with all the rest so that performance
is not impacted. For this reason defaults would otherwise
silently "fail" for missing parameters, so this is now guarded
against. [ticket:1566]
Diffstat (limited to 'test/sql/test_query.py')
| -rw-r--r-- | test/sql/test_query.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 470a694fb..fe11c62bf 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -43,12 +43,23 @@ class QueryTest(TestBase): assert users.count().scalar() == 1 def test_insert_heterogeneous_params(self): - users.insert().execute( + """test that executemany parameters are asserted to match the parameter set of the first.""" + + assert_raises_message(exc.InvalidRequestError, + "A value is required for bind parameter 'user_name', in parameter group 2", + users.insert().execute, {'user_id':7, 'user_name':'jack'}, {'user_id':8, 'user_name':'ed'}, {'user_id':9} ) - assert users.select().execute().fetchall() == [(7, 'jack'), (8, 'ed'), (9, None)] + + # this succeeds however. We aren't yet doing + # a length check on all subsequent parameters. + users.insert().execute( + {'user_id':7}, + {'user_id':8, 'user_name':'ed'}, + {'user_id':9} + ) def test_update(self): users.insert().execute(user_id = 7, user_name = 'jack') |
