Skip to content

Commit 7323703

Browse files
authored
Merge pull request #239 from NotSoSuper/master
proper argument for cursor.execute (for sa engine)
2 parents d48d42c + 29239cb commit 7323703

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

aiomysql/sa/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _execute(self, query, *multiparams, **params):
7474
dp = dp[0]
7575

7676
if isinstance(query, str):
77-
yield from cursor.execute(query, dp)
77+
yield from cursor.execute(query, dp or None)
7878
elif isinstance(query, ClauseElement):
7979
compiled = query.compile(dialect=self._dialect)
8080
# parameters = compiled.params

tests/sa/test_sa_connection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,14 @@ def go():
290290
[(2, 'third'), (3, 'forth')])
291291
self.loop.run_until_complete(go())
292292

293+
def test_raw_select_with_wildcard(self):
294+
@asyncio.coroutine
295+
def go():
296+
conn = yield from self.connect()
297+
yield from conn.execute(
298+
'SELECT * FROM sa_tbl WHERE name LIKE "%test%"')
299+
self.loop.run_until_complete(go())
300+
293301
def test_delete(self):
294302
@asyncio.coroutine
295303
def go():

0 commit comments

Comments
 (0)