Skip to content

error reporting: unify "column not found" error message for DuckDB / spark-like #2472

Open
@MarcoGorelli

Description

@MarcoGorelli
import narwhals as nw
import polars as pl

import duckdb

df = pl.DataFrame({'a': [1,2,3]})
nw.from_native(df).select(nw.col('b'))
nw.from_native(df.to_pandas()).select(nw.col('b'))
nw.from_native(df.to_arrow()).select(nw.col('b'))
nw.from_native(duckdb.table('df')).select(nw.col('b'))

All of the above, except the last one, raise nw.exceptions.ColumnNotFoundError

we should catch duckdb.BinderError and, if 'column cannot be referenced before it is defined' is in the error message, raise nw.exceptions.ColumnNotFoundError, similarly to how we do for other backends

Then we should be able to avoid xfails in select_test.py test_missing

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