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

Conversation

NotSoSuper
Copy link
Contributor

For the SQLAlchemy engine, the _distill_params function in sa/connection.py returns an empty list [] when no arguments are passed.

This results in [] passed to cursor.execute as the args argument causing if check
https://github.com/aio-libs/aiomysql/blob/master/aiomysql/cursors.py#L237
to string format an empty list, erroring with:

File "/usr/local/lib/python3.6/site-packages/aiomysql/utils.py", line 75, in __await__
    resp = yield from self._coro
  File "/usr/local/lib/python3.6/site-packages/aiomysql/sa/connection.py", line 77, in _execute
    yield from cursor.execute(query, dp)
  File "/usr/local/lib/python3.6/site-packages/aiomysql/cursors.py", line 238, in execute
    query = query % self._escape_args(args, conn)
TypeError: not enough arguments for format string

@codecov
Copy link

codecov bot commented Dec 31, 2017

Codecov Report

Merging #239 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #239   +/-   ##
=======================================
  Coverage   92.91%   92.91%           
=======================================
  Files           9        9           
  Lines        1157     1157           
  Branches      172      172           
=======================================
  Hits         1075     1075           
  Misses         53       53           
  Partials       29       29
Impacted Files Coverage Δ
aiomysql/sa/connection.py 92.3% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d304225...29239cb. Read the comment docs.

@asvetlov
Copy link
Member

Please add a unittest for the fix.

@jettify
Copy link
Member

jettify commented Jan 18, 2018

thanks a lot!

@jettify jettify merged commit 7323703 into aio-libs:master Jan 18, 2018
@jettify
Copy link
Member

jettify commented Jan 18, 2018

new version on pypi https://pypi.python.org/pypi/aiomysql/0.0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants