Skip to content

Comments

[psycopg2] fix for quote_ident typing bug#477

Merged
palazzem merged 6 commits intomasterfrom
kyle-verhoog/474
Jun 12, 2018
Merged

[psycopg2] fix for quote_ident typing bug#477
palazzem merged 6 commits intomasterfrom
kyle-verhoog/474

Conversation

@Kyle-Verhoog
Copy link
Member

@Kyle-Verhoog Kyle-Verhoog commented May 31, 2018

Problem

Closes #474 and closes #383
Related to #96.

Solution

Use the method introduced in #96 to manually patch the psycopg2.extensions.quote_ident method if it exists on the version of psycopg2 used.

This PR also introduces a test that replicates the bug.

def test_manual_wrap_extension_quote_ident_standalone():
from ddtrace import patch_all
patch_all()
from psycopg2.extensions import quote_ident
Copy link

Choose a reason for hiding this comment

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

Don't we have the issue if the order is reversed? or it's the other way around?

Copy link
Member Author

Choose a reason for hiding this comment

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

reordering seems to not patch quote_ident I'll have to dig into how python treats these object references, I would have assumed that it'd be safe to patch after importing because it's the same reference...

Copy link

@palazzem palazzem left a comment

Choose a reason for hiding this comment

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

Once we've verified that the problem is fixed, you can proceed with the merge. Thank you!

@palazzem palazzem merged commit 4d8a8cc into master Jun 12, 2018
@palazzem palazzem deleted the kyle-verhoog/474 branch June 12, 2018 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[psycopg2] The quote_ident function requires psycopg2.extensions.connection. [psycopg2] The prepare functions require psycopg2.extensions.connection.

2 participants