[Python-modules-commits] [python-vertica] 04/10: Add patch for issue 116 on github
Jean Baptiste Favre
jbfavre-guest at moszumanska.debian.org
Mon May 23 19:39:10 UTC 2016
This is an automated email from the git hooks/post-receive script.
jbfavre-guest pushed a commit to branch master
in repository python-vertica.
commit cbdbbc6cd83beeac9f9b821d116e75bb34ad7dc7
Author: Jean Baptiste Favre <debian at jbfavre.org>
Date: Sun May 22 14:14:08 2016 +0200
Add patch for issue 116 on github
---
debian/patches/github_pr_118_fix_116.patch | 57 ++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 58 insertions(+)
diff --git a/debian/patches/github_pr_118_fix_116.patch b/debian/patches/github_pr_118_fix_116.patch
new file mode 100644
index 0000000..0e105d7
--- /dev/null
+++ b/debian/patches/github_pr_118_fix_116.patch
@@ -0,0 +1,57 @@
+Description: fixed issue #116 where column names were bytes objects instead of strings
+ This addresses an issue in vertica-python when run in Python3 where column names are
+ bytes objects instead of utf-8 encoded strings. Also added a test case that fails in
+ Python3 before this PR and succeeds after. (Note: Tests fail under python3.5 for
+ test_unicode_named_parameter_binding even from master. This doesn't do anything to
+ address that.)
+Author: Dennis O'Brien
+Origin: https://github.com/uber/vertica-python/pull/118
+Bug: https://github.com/uber/vertica-python/issues/116
+Reviewed-by: Jean Baptiste Favre <debian at jbfavre.org>
+Last-Update: 2016-05-22
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- /dev/null
++++ b/vertica_python/tests/column_tests.py
+@@ -0,0 +1,21 @@
++from .test_commons import conn_info, VerticaTestCase
++from .. import connect
++
++
++class ColumnTestCase(VerticaTestCase):
++ def test_column_names_query(self):
++ column_0 = 'isocode'
++ column_1 = 'name'
++ query = """
++ select 'US' as {column_0}, 'United States' as {column_1}
++ union all
++ select 'CA', 'Canada'
++ union all
++ select 'MX', 'Mexico'
++ """.format(column_0=column_0, column_1=column_1)
++ with connect(**conn_info) as conn:
++ cur = conn.cursor()
++ cur.execute(query)
++ description = cur.description
++ assert description[0].name == column_0
++ assert description[1].name == column_1
+--- a/vertica_python/vertica/column.py
++++ b/vertica_python/vertica/column.py
+@@ -124,7 +124,7 @@ class Column(object):
+ return map(lambda x: x[0], Column.data_type_conversions())
+
+ def __init__(self, col, unicode_error=None):
+- self.name = col['name']
++ self.name = col['name'].decode()
+ self.type_code = col['data_type_oid']
+ self.display_size = None
+ self.internal_size = col['data_type_size']
+@@ -143,7 +143,7 @@ class Column(object):
+ self.type_code = 0
+
+ #self.props = ColumnTuple(col['name'], col['data_type_oid'], None, col['data_type_size'], None, None, None)
+- self.props = ColumnTuple(col['name'], self.type_code, None, col['data_type_size'], None, None, None)
++ self.props = ColumnTuple(self.name, self.type_code, None, col['data_type_size'], None, None, None)
+
+ #self.converter = self.data_type_conversions[col['data_type_oid']][1]
+ self.converter = self.data_type_conversions[self.type_code][1]
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..671bd98
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+github_pr_118_fix_116.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-vertica.git
More information about the Python-modules-commits
mailing list