Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lightdash/python-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: lightdash/python-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix/composite-filter-semantics
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 4 files changed
  • 2 contributors

Commits on Jun 26, 2026

  1. fix: preserve AND/OR precedence in composite filters (#23)

    Composite filters were flat: nested boolean expressions collapsed into a single
    aggregation, and `.filter()` after an OR group appended into that OR instead of
    AND-ing. Both silently changed the query population a user wrote.
    
    - `CompositeFilter` is now a tree — `filters` may hold nested groups. A shared
      `_combine()` flattens a child only when it already uses the same aggregation,
      so `a & (b | c)` keeps `(b | c)` nested.
    - `to_dict()` serializes nested groups and projects dimension vs table-calc
      filters into their separate top-level groups. The one shape the API cannot
      represent — OR across the two field types — raises a clear error instead of
      serializing to the wrong thing.
    - `Query.filter()` always ANDs the new condition with everything so far, keeping
      any existing OR group nested: `.filter(a | b).filter(c)` => `(a OR b) AND c`.
    
    Verified live: `(month==Jan | month==Mar).filter(month != Jan)` now returns only
    March (previously every month). The API confirmed to apply nested groups.
    
    Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
    jpetey75 and claude committed Jun 26, 2026
    Configuration menu
    Copy the full SHA
    0877d01 View commit details
    Browse the repository at this point in the history
Loading