We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 54466d8 commit 28e0c96Copy full SHA for 28e0c96
1 file changed
dataframely/schema.py
@@ -816,7 +816,13 @@ def cast(
816
817
def _cast_to_schema(
818
lf: pl.LazyFrame, schema: dict[str, pl.DataType]
819
- ) -> pl.LazyFrame:
+ # NOTE: This function does almost the same thing as `match_to_schema`, except:
820
+ #
821
+ # 1. It raises a polars `polars.exceptionsColumnNotFoundError` on missing columns,
822
+ # while `match_to_schema` raises a `dataframely.exc.SchemaError`
823
+ # 2. The error is raised only at collection time, while `match_to_schema` raises immediately
824
825
+ # This behavior is needed to not break backward compatibility.
826
return lf.select(cls.column_names()).cast(
827
{
828
name: col.dtype
0 commit comments