| Pointblank Validation | |||||||||||||
2025-10-29|23:17:37 Polars |
|||||||||||||
| STEP | COLUMNS | VALUES | TBL | EVAL | UNITS | PASS | FAIL | W | E | C | EXT | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| #4CA64C | 1 |
col_schema_match()
|
✓ | 1 | 1 1.00 |
0 0.00 |
— | — | — | — | |||
2025-10-29 23:17:37 UTC< 1 s2025-10-29 23:17:37 UTC |
|||||||||||||
Check the Schema of a Table
The schema of a table can be flexibly defined with Schema and verified with col_schema_match().
import pointblank as pb
import polars as pl
tbl = pl.DataFrame(
{
"a": ["apple", "banana", "cherry", "date"],
"b": [1, 6, 3, 5],
"c": [1.1, 2.2, 3.3, 4.4],
}
)
# Use the Schema class to define the column schema as loosely or rigorously as required
schema = pb.Schema(
columns=[
("a", "String"), # Column 'a' has dtype 'String'
("b", ["Int", "Int64"]), # Column 'b' has dtype 'Int' or 'Int64'
("c", ) # Column 'c' follows 'b' but we don't specify a dtype here
]
)
# Use the `col_schema_match()` validation method to perform the schema check
validation = (
pb.Validate(data=tbl)
.col_schema_match(schema=schema)
.interrogate()
)
validation