Skip to content

Commit

Permalink
Merge pull request #239 from NotSoSuper/master
Browse files Browse the repository at this point in the history
proper argument for cursor.execute (for sa engine)
  • Loading branch information
jettify committed Jan 18, 2018
2 parents d48d42c + 29239cb commit 7323703
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aiomysql/sa/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _execute(self, query, *multiparams, **params):
dp = dp[0]

if isinstance(query, str):
yield from cursor.execute(query, dp)
yield from cursor.execute(query, dp or None)
elif isinstance(query, ClauseElement):
compiled = query.compile(dialect=self._dialect)
# parameters = compiled.params
Expand Down
8 changes: 8 additions & 0 deletions tests/sa/test_sa_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@ def go():
[(2, 'third'), (3, 'forth')])
self.loop.run_until_complete(go())

def test_raw_select_with_wildcard(self):
@asyncio.coroutine
def go():
conn = yield from self.connect()
yield from conn.execute(
'SELECT * FROM sa_tbl WHERE name LIKE "%test%"')
self.loop.run_until_complete(go())

def test_delete(self):
@asyncio.coroutine
def go():
Expand Down

0 comments on commit 7323703

Please sign in to comment.