Fixed no attribute '_asdict' error when connecting the database server. Fixes #6663

This commit is contained in:
Akshay Joshi
2021-08-20 12:51:33 +05:30
parent 0c20466f2c
commit accc941818
2 changed files with 11 additions and 13 deletions

View File

@@ -94,19 +94,16 @@ class _WrapperColumn(object):
# exposed as items of the cursor.description sequence.
# Before psycopg2 2.8 the description attribute was a sequence
# of simple tuples or namedtuples.
if psycopg2.__version__.find('2.8') != -1:
ores = OrderedDict()
ores['name'] = self.orig_col.name
ores['type_code'] = self.orig_col.type_code
ores['display_size'] = self.orig_col.display_size
ores['internal_size'] = self.orig_col.internal_size
ores['precision'] = self.orig_col.precision
ores['scale'] = self.orig_col.scale
ores['null_ok'] = self.orig_col.null_ok
ores['table_oid'] = self.orig_col.table_oid
ores['table_column'] = self.orig_col.table_column
else:
ores = OrderedDict(self.orig_col._asdict())
ores = OrderedDict()
ores['name'] = self.orig_col.name
ores['type_code'] = self.orig_col.type_code
ores['display_size'] = self.orig_col.display_size
ores['internal_size'] = self.orig_col.internal_size
ores['precision'] = self.orig_col.precision
ores['scale'] = self.orig_col.scale
ores['null_ok'] = self.orig_col.null_ok
ores['table_oid'] = self.orig_col.table_oid
ores['table_column'] = self.orig_col.table_column
name = ores['name']
if self.dummy_name: