Hello,
In the ColumnDescription returned inside the cursor.description, it feels like there is some useful metadata missing.
Could we have the table from which the column is from ?
For instance, when doing :
cursor.execute("SELECT a.description AS foo, b.description AS bar FROM a LEFT JOIN b ON a.id=b.id")
cursor.description contains the column names, but not their alias. In this case, it would return ['description', 'description'], when one could expect ['foo', 'bar'] so it is impossible to differentiate ambiguous columns, to assign them to the right elements in the result.
I think this method in __init__.py is the one which needs enhancement :
def _set_description(self, column_metadata):
# see https://www.postgresql.org/docs/9.5/datatype.html
self.description = []
for column in column_metadata:
col_desc = ColumnDescription(name=column["name"], type_code=self._pg_type_map.get(column["typeName"].lower(), str))
self.description.append(col_desc)
The column_metadata should contain a tableName field, according to the boto3 docs, see the response syntax in here. Could it be added to the ColumnDescription object ?
Would it be possible to implement this feature ? Is there another way I am missing ?
Thanks in advance !
Hello,
In the
ColumnDescriptionreturned inside thecursor.description, it feels like there is some useful metadata missing.Could we have the table from which the column is from ?
For instance, when doing :
cursor.descriptioncontains the column names, but not their alias. In this case, it would return['description', 'description'], when one could expect['foo', 'bar']so it is impossible to differentiate ambiguous columns, to assign them to the right elements in the result.I think this method in
__init__.pyis the one which needs enhancement :The
column_metadatashould contain atableNamefield, according to the boto3 docs, see the response syntax in here. Could it be added to theColumnDescriptionobject ?Would it be possible to implement this feature ? Is there another way I am missing ?
Thanks in advance !