Skip to content

DuckDBPyRelation.dtypes has incorrect typing #260

@winwinashwin

Description

@winwinashwin

What happens?

Type checkers (pyright, ty etc) report the return of DuckDBPyRelation.dtypes property as List[str] but runtime type is List[DuckDBPyType]

To Reproduce

import typing as t

import duckdb
import pandas as pd


rel = duckdb.from_df(pd.DataFrame({"name": ["Alice", "Bob"]}))
col_dtypes = rel.dtypes

t.reveal_type(col_dtypes)  # pyright reports type as List[str]
print(type(col_dtypes[0]))  # output in shell is <class '_duckdb._sqltypes.DuckDBPyType'>

OS:

x86_64 GNU/Linux

DuckDB Package Version:

1.4.3

Python Version:

3.11.9

Full Name:

Ashwin A Nayar

Affiliation:

Corridor Platforms

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions