summaryrefslogtreecommitdiff
path: root/test/sql/test_defaults.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-10-15 18:41:02 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-10-15 18:41:02 +0000
commitc5571ab19a155f0c11381d65edc07c16902f3fad (patch)
tree91d1177483fccf28f5527b1842f838c4623013fe /test/sql/test_defaults.py
parentbc351a2dc423987f05f4bf88db4987be507ee0a1 (diff)
downloadsqlalchemy-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_defaults.py')
-rw-r--r--test/sql/test_defaults.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py
index baed19f88..04809b48a 100644
--- a/test/sql/test_defaults.py
+++ b/test/sql/test_defaults.py
@@ -4,7 +4,7 @@ from sqlalchemy import Sequence, Column, func
from sqlalchemy.sql import select, text
import sqlalchemy as sa
from sqlalchemy.test import testing, engines
-from sqlalchemy import MetaData, Integer, String, ForeignKey, Boolean
+from sqlalchemy import MetaData, Integer, String, ForeignKey, Boolean, exc
from sqlalchemy.test.schema import Table
from sqlalchemy.test.testing import eq_
from test.sql import _base
@@ -300,7 +300,16 @@ class DefaultTest(testing.TestBase):
12, today, 'py'),
(53, 'imthedefault', f, ts, ts, ctexec, True, False,
12, today, 'py')])
-
+
+ def test_missing_many_param(self):
+ assert_raises_message(exc.InvalidRequestError,
+ "A value is required for bind parameter 'col7', in parameter group 1",
+ t.insert().execute,
+ {'col4':7, 'col7':12, 'col8':19},
+ {'col4':7, 'col8':19},
+ {'col4':7, 'col7':12, 'col8':19},
+ )
+
def test_insert_values(self):
t.insert(values={'col3':50}).execute()
l = t.select().execute()
@@ -356,7 +365,7 @@ class DefaultTest(testing.TestBase):
l = l.first()
eq_(55, l['col3'])
-
+
class PKDefaultTest(_base.TablesTest):
__requires__ = ('subqueries',)