Skip to content

Library does not accept subtypes #97

@w0rp

Description

@w0rp

return PY_TYPES_MAPPING[type(value)](value)

The library looks up types in a map using type(value) and raises an exception if the type does not exist in the map. This means any type derived from those types cannot be passed to the library. This creates errors at runtime for derived types that cannot be caught by type checkers. A common example will be StrEnum values, which are a subtype of str.

It's better to use isinstance(value, tuple(PY_TYPES_MAPPING)) to check for compatible types, and ensure that the underlying connection to ClickHouse accepts the types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions