Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proper argument for cursor.execute (for sa engine) #239

Merged
merged 3 commits into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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