mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-04 06:48:27 -04:00
Corrects issue where engine.execute raised exception when given empty list. Fixes #1175.
This commit is contained in:
@@ -873,7 +873,7 @@ class Connection(Connectable):
|
||||
return [{}]
|
||||
elif len(multiparams) == 1:
|
||||
if isinstance(multiparams[0], (list, tuple)):
|
||||
if isinstance(multiparams[0][0], (list, tuple, dict)):
|
||||
if not multiparams[0] or isinstance(multiparams[0][0], (list, tuple, dict)):
|
||||
return multiparams[0]
|
||||
else:
|
||||
return [multiparams[0]]
|
||||
|
||||
@@ -78,6 +78,13 @@ class ExecuteTest(TestBase):
|
||||
except tsa.exc.DBAPIError:
|
||||
assert True
|
||||
|
||||
def test_empty_insert(self):
|
||||
try:
|
||||
result = testing.db.execute(users.insert(), [])
|
||||
assert [] == list(result)
|
||||
except:
|
||||
assert False
|
||||
|
||||
class ProxyConnectionTest(TestBase):
|
||||
@testing.fails_on('firebird') # Data type unknown
|
||||
def test_proxy(self):
|
||||
|
||||
Reference in New Issue
Block a user