Skip to content

A change to the field returned from the TE to use for column_name. #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pynuodb/datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ def __cmp__(self, other):
NUMBER = TypeObject(int, decimal.Decimal)
DATETIME = TypeObject(Timestamp, Date, Time)
ROWID = TypeObject()
NULL = TypeObject(None)

TYPEMAP = {"<null>": None,
TYPEMAP = {"<null>": NULL,
"string": STRING,
"char": STRING,
"varchar": STRING,
Expand Down
6 changes: 3 additions & 3 deletions pynuodb/encodedsession.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ def _parse_result_set_description(self):
self.getString() # catalog_name
self.getString() # schema_name
self.getString() # table_name
column_name = self.getString()
self.getString() # column_label
self.getString() # column_name
column_label = self.getString() # column_label
self.getValue() # collation_sequence
column_type_name = self.getString()
self.getInt() # column_type
Expand All @@ -481,7 +481,7 @@ def _parse_result_set_description(self):

# TODO: type information should be derived from the type
# (column_type) not the typename.
description[i] = [column_name,
description[i] = [column_label,
datatype.TypeObjectFromNuodb(column_type_name),
column_display_size, None, precision, scale, None]

Expand Down
27 changes: 27 additions & 0 deletions tests/nuodb_description_name_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
(C) Copyright 2025 Dassault Systemes SE. All Rights Reserved.

This software is licensed under a BSD 3-Clause License.
See the LICENSE file provided with this software.
"""

import decimal
import datetime

from . import nuodb_base


class TestNuoDBDescription(nuodb_base.NuoBase):

def test_description(self):
con = self._connect()
cursor = con.cursor()

cursor.execute("CREATE TEMPORARY TABLE tmp (v1 INTEGER, v2 STRING)" )
cursor.execute("INSERT INTO tmp VALUES (1,'a'), (2,'b')")
cursor.execute("SELECT v1 AS c1, concat(v2,'') as c2 FROM tmp")
row = cursor.fetchone()
d = cursor.description

assert d[0][0].lower() == 'c1'
assert d[1][0].lower() == 'c2'