Teradata / PyTd

A Python Module to make it easy to script powerful interactions with Teradata Database in a DevOps friendly way.
MIT License
108 stars 43 forks source link

Add support for DATASET data type #64

Closed escheie closed 7 years ago

escheie commented 7 years ago

When using the Teradata 16.00.00.01 ODBC driver it was observed that selecting a "DATASET STORAGE FORMAT AVRO" column resulted in the following error:

AttributeError: 'c_byte_Array_1048576' object has no attribute 'raw'

Extending the DefaultDataTypeConverter with the following provided a workaround for the issue:

class ExtendedDataTypeConverter (datatypes.DefaultDataTypeConverter):

    def convertType(self, dbType, dataType):
        """Converts the data type to a python type code."""
        if dataType.startswith("DATASET"):
            return datatypes.BINARY
        return datatypes.DefaultDataTypeConverter.convertType(self, dbType, dataType)