Skip to content

Add missing types to PyLegend #220

@deepyaman

Description

@deepyaman

Feature Request

The PyLegend type system isn't granular enough. Furthermore, types like Decimal are not parametrizable.

Description of Problem:

We have to use a very fuzzy type mapping because of this. This also means that types can't be translated correctly between systems due to PyLegend.

Here is the mapping we're currently using:

COLUMN_TYPE_TO_TDS_COLUMN_TYPE_MAP = {
    OurColumnType.UTinyInt: PrimitiveType.Number,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.TinyInt: PrimitiveType.Number,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.USmallInt: PrimitiveType.Number,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.SmallInt: PrimitiveType.Number,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.UInt: PrimitiveType.Integer,
    OurColumnType.Int: PrimitiveType.Integer,
    OurColumnType.UBigInt: PrimitiveType.Number,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.BigInt: PrimitiveType.Number,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.Float4: PrimitiveType.Float,
    OurColumnType.Double: PrimitiveType.Decimal,  # FIXME: PyLegend doesn't have granular numeric types.
    OurColumnType.Decimal: PrimitiveType.Decimal,
    OurColumnType.Boolean: PrimitiveType.Boolean,
    OurColumnType.Varchar: PrimitiveType.String,
    # OurColumnType.Time: PrimitiveType.Time,  # FIXME: PyLegend doesn't have a `Time` type.
    OurColumnType.Date: PrimitiveType.Date,
    OurColumnType.Timestamp: PrimitiveType.DateTime,
    # OurColumnType.Variant: PrimitiveType.Variant,  # FIXME: PyLegend doesn't have a `Variant` type.
    # OurColumnType.Binary: PrimitiveType.Binary,  # FIXME: PyLegend doesn't have a `Binary` type.
}

Potential Solutions:

Implement the types and appropriate parametrizations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions