uber-common / opentracing-python-instrumentation

A collection of Python instrumentation tools for the OpenTracing API
MIT License
164 stars 58 forks source link

Support Composable object as sql statement for psycopg2 #82

Closed condorcet closed 5 years ago

condorcet commented 5 years ago

Fix https://github.com/uber-common/opentracing-python-instrumentation/issues/81

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.9%) to 77.956% when pulling b67b31e4d86f77dbcd5e0a894c86f8886775b20a on condorcet:psycopg2-sql-as-composable-fix into 4d560d529275586cf8ffbb28278357083c999a95 on uber-common:master.

condorcet commented 5 years ago

I've added quote_ident wrapper, because I've found that sql.Identifier using psycopg2.extensions.quote_ident function to make string representation, but the function accept only cursor / connection objects. Also I've added test cases for each Composable classes.

condorcet commented 5 years ago

Everything okay, I deleted my branch by mistake :) In last commit I added casting to string a Composable sql object for executemany cursor method.