Skip to content

Commit a01336e

Browse files
committed
add description support
1 parent e6fd463 commit a01336e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pycovenantsql/connections.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def read(self):
295295
try:
296296
data = self.connection._resp_json["data"]
297297
except:
298-
raise err.InterfaceError("Unsupported response format")
298+
raise err.InterfaceError("Unsupported response format: no data field")
299299
if data is None:
300300
# exec result
301301
return
@@ -317,3 +317,16 @@ def read(self):
317317
row.append(column)
318318
rows.append(tuple(row))
319319
self.rows = tuple(rows)
320+
321+
try:
322+
self.field_count = len(data['columns'])
323+
324+
description = []
325+
for i in range(self.field_count):
326+
fields = []
327+
fields.append(data['columns'][i])
328+
fields.append(data['types'][i])
329+
description.append(tuple(fields))
330+
self.description = tuple(description)
331+
except:
332+
raise err.InterfaceError("Proxy return column count and types count are not equal")

0 commit comments

Comments
 (0)