posit-dev / posit-dev/pointblank

YAML value column selector

Open
#333 1 comment 0 reactions 1 assignee View on GitHub

@rich-iannone is already working on this.

Since Dec 3, 2025.

Difficulty: [2] Intermediate Effort: [3] High Priority: [3] High Type: ☹︎ Bug
Dominant language
Python
Stars
490
Forks
32
Avg merge
14h 24m
Merged PRs (30d)
2

Description

Description

I can't get pb.col() to work within the YAML workflow. It appears, for col_vals_ge() & col_vals_gt() at least, pb.col() inputs fail in _string_date_dttm_conversion(value=value).

Reproducible example

Create some data for example:

import pointblank as pb
import polars as pl
from datetime import date

df = pl.DataFrame(
    {
        "id": list(range(123, 123 + 6)),  # 123, 124, 125, 126, 127, 128
        "start_date": [
            date(2024, 5, 1),
            date(2024, 6, 1),
            date(2024, 5, 15),
            date(2024, 7, 1),
            date(2024, 6, 10),
            date(2024, 5, 20),
        ],
        "end_date": [
            date(2024, 5, 10),
            date(2024, 6, 5),
            date(2024, 5, 25),
            date(2024, 7, 10),
            date(2024, 6, 5),
            date(2024, 5, 30),
        ],
    }
)

This validation works, 1 row fails because the end date is later than the start date:

validation = (
    pb.Validate(data=df)
    .col_vals_ge(columns="end_date", value=pb.col("start_date"))
    .interrogate()
)
validation

This validation fails, I get the error ValueError: If value= is provided as a string it must be a date or datetime string:

# Set to small_table because None fails due to validator that runs before set_tbl, allowing None would be helpful but totally separate issue :) 
pb_yaml = '''
tbl: small_table
steps:
- col_vals_ge:
    columns: [end_date]
    value: pb.col("start_date")
'''
result = pb.yaml_interrogate(pb_yaml, set_tbl = df)

Expected result

I want the YAML validation to provide the same output as the python code version above.

Development environment

macOS 14.5
pointblank 0.14.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.