Skip to content

Python client type hint error with column-oriented upsert #784

@affanshahid

Description

@affanshahid

I'm trying to do an upsert without hard-coded data and I get some type hint errors. Everything works fine so I'm assuming its just a typing issue.

image

The error on ids is:

Pyright: Argument of type "list[int]" cannot be assigned to parameter "ids" of type "List[ExtendedPointId]" in function "__init__"
  "list[int]" is not assignable to "List[ExtendedPointId]"
    Type parameter "_T@list" is invariant, but "int" is not the same as "ExtendedPointId"
    Consider switching from "list" to "Sequence" which is covariant

I can fix this one by typing the ids declaration as ids: list[ExtendedPointId]. This may be just a pyright issue since ExtendedPointId is defined as int | str.

The error on vectors is:

Pyright: Argument of type "Iterable[ndarray[Unknown, Unknown]]" cannot be assigned to parameter "vectors" of type "BatchVectorStruct" in function "__init__"
  Type "Iterable[ndarray[Unknown, Unknown]]" is not assignable to type "BatchVectorStruct"
    "Iterable[ndarray[Unknown, Unknown]]" is not assignable to "List[List[StrictFloat]]"
    "Iterable[ndarray[Unknown, Unknown]]" is not assignable to "List[List[List[StrictFloat]]]"
    "Iterable[ndarray[Unknown, Unknown]]" is not assignable to "Dict[StrictStr, List[Vector]]"

Can't seem to get around this one without a cast. Like I said, everything works but the type errors hamper the DX.

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