Skip to content

Commit

Permalink
Merge pull request #129 from massmutual/122-named-params-fix
Browse files Browse the repository at this point in the history
Prevents psycopg2 from appending ::bytea to stringy named params in python 3
  • Loading branch information
alexjikim authored Sep 23, 2016
2 parents 7b77d44 + a67c932 commit 7531a5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vertica_python/vertica/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ def execute(self, operation, parameters=None):

if parameters:
# # optional requirement
import six
from psycopg2.extensions import adapt

if isinstance(parameters, dict):
for key in parameters:
param = parameters[key]
# Make sure adapt() behaves properly
if isinstance(param, str):
v = adapt(param.encode('utf8')).getquoted()
else:
v = adapt(param).getquoted()
if six.PY2:
param = param.encode('utf8')
v = adapt(param).getquoted()

# Using a regex with word boundary to correctly handle params with similar names
# such as :s and :start
Expand Down

0 comments on commit 7531a5b

Please sign in to comment.