diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f9aa4ea..3a16013 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.2.3 +current_version = 1.2.4 commit = True tag = True diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b420de5..4ff91c4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.8] + python-version: [2.7, 3.5, 3.6, 3.8, 3.9, 3.10] plattform: ["Python"] include: - python-version: 3.8 diff --git a/README.rst b/README.rst index f4a1d61..dacc327 100644 --- a/README.rst +++ b/README.rst @@ -170,6 +170,10 @@ Changelog ========= - Next version - unreleased +- 1.2.4 - 2022-05-26 + - Fix returning the column label instead of the name, which accounts for + column aliasing in sql queries + - 1.2.3 - 2020-06-12 - Make pip install for Python 2 work by changing JPype1 requirement to older diff --git a/jaydebeapi/__init__.py b/jaydebeapi/__init__.py index a890c3d..24c9111 100644 --- a/jaydebeapi/__init__.py +++ b/jaydebeapi/__init__.py @@ -17,7 +17,7 @@ # License along with JayDeBeApi. If not, see # . -__version_info__ = (1, 2, 3) +__version_info__ = (1, 2, 4) __version__ = ".".join(str(i) for i in __version_info__) import datetime @@ -488,7 +488,7 @@ def description(self): dbapi_type = None else: dbapi_type = DBAPITypeObject._map_jdbc_type_to_dbapi(jdbc_type) - col_desc = ( m.getColumnName(col), + col_desc = ( m.getColumnLabel(col), dbapi_type, size, size, diff --git a/setup.py b/setup.py index 67a2d1d..1395b11 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ setup( #basic package data name = 'JayDeBeApi', - version = '1.2.3', + version = '1.2.4', author = 'Bastian Bowe', author_email = 'bastian.dev@gmail.com', license = 'GNU LGPL', diff --git a/test/test_integration.py b/test/test_integration.py index e795339..5375455 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -79,6 +79,13 @@ def test_execute_and_fetch_no_data(self): result = cursor.fetchall() self.assertEqual(result, []) + def test_execute_and_fetch_alias(self): + with self.conn.cursor() as cursor: + stmt = "select ACCOUNT_ID as `a_id` from ACCOUNT" + cursor.execute(stmt) + field_names = cursor.description + self.assertEqual(field_names[0][0], 'a_id') + def test_execute_and_fetch(self): with self.conn.cursor() as cursor: cursor.execute("select ACCOUNT_ID, ACCOUNT_NO, BALANCE, BLOCKING " \