Skip to content

BUG: Executing SQL containing non-escaped percent sign fails without parameters #34212

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

Merged
merged 2 commits into from
May 28, 2020

Conversation

john-bodley
Copy link
Contributor

@john-bodley john-bodley commented May 16, 2020

@john-bodley john-bodley force-pushed the john-bodley--issue-34211 branch from 3898488 to 69729a8 Compare May 16, 2020 19:10
@simonjayhawkins simonjayhawkins added Bug IO SQL to_sql, read_sql, read_sql_query labels May 17, 2020
@simonjayhawkins
Copy link
Member

Thanks @john-bodley for the PR. can you add a note to doc\source\whatsnew\v1.1.0.rst. Does this also close #11896?

@john-bodley
Copy link
Contributor Author

@simonjayhawkins I added the node per your request. Also per #34211 (comment) I'm uncertain whether this closes #11896.

@WillAyd WillAyd added this to the 1.1 milestone May 18, 2020
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mroeschke
Copy link
Member

I'm uncertain whether this closes #11896

If you're open to it @john-bodley, maybe you could add a unit test for #11896 to see if it passes out CI. Then we could close that issue

@john-bodley john-bodley force-pushed the john-bodley--issue-34211 branch 2 times, most recently from 055b5e7 to 0e8afd5 Compare May 19, 2020 17:33
@john-bodley
Copy link
Contributor Author

@mroeschke it seems that this PR doesn't resolve #11896 for PostgreSQL per the following CI error (job) when I added a unit test:

self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f7a36467828>
cursor = <cursor object at 0x7f7a375b4e58; closed: -1>
statement = 'INSERT INTO test_frame1 (index, "%%A") VALUES (%(index)s, %(%A)s)'
parameters = {'%A': 1, 'index': 0}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f7a363fc5c0>
    def do_execute(self, cursor, statement, parameters, context=None):
>       cursor.execute(statement, parameters)
E       psycopg2.ProgrammingError: incomplete placeholder: '%(' without ')'

@john-bodley john-bodley force-pushed the john-bodley--issue-34211 branch from 0e8afd5 to a9c0c25 Compare May 19, 2020 20:17
@mroeschke
Copy link
Member

Thanks for checking @john-bodley. Your PR looks good otherwise

@WillAyd
Copy link
Member

WillAyd commented May 20, 2020

Looks like some test failures - @john-bodley can you take a look?

@john-bodley john-bodley force-pushed the john-bodley--issue-34211 branch from a9c0c25 to af3ae05 Compare May 20, 2020 22:15
@WillAyd
Copy link
Member

WillAyd commented May 27, 2020

@john-bodley can you fix merge conflict?

@john-bodley
Copy link
Contributor Author

@WillAyd done.

@WillAyd WillAyd merged commit fc41f92 into pandas-dev:master May 28, 2020
@WillAyd
Copy link
Member

WillAyd commented May 28, 2020

Awesome - thanks for the great PR @john-bodley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants