René's URL Explorer Experiment


Title: Clarify or fix composite filter boolean semantics · Issue #23 · lightdash/python-sdk · GitHub

Open Graph Title: Clarify or fix composite filter boolean semantics · Issue #23 · lightdash/python-sdk

X Title: Clarify or fix composite filter boolean semantics · Issue #23 · lightdash/python-sdk

Description: Problem The SDK currently exposes filter composition with &, |, and repeated .filter() calls, but the behavior for mixed boolean logic does not preserve the semantics users would reasonably expect from the Python expression. This came up...

Open Graph Description: Problem The SDK currently exposes filter composition with &, |, and repeated .filter() calls, but the behavior for mixed boolean logic does not preserve the semantics users would reasonably expect ...

X Description: Problem The SDK currently exposes filter composition with &, |, and repeated .filter() calls, but the behavior for mixed boolean logic does not preserve the semantics users would reasonably exp...

Opengraph URL: https://github.com/lightdash/python-sdk/issues/23

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Clarify or fix composite filter boolean semantics","articleBody":"## Problem\n\nThe SDK currently exposes filter composition with `\u0026`, `|`, and repeated `.filter()` calls, but the behavior for mixed boolean logic does not preserve the semantics users would reasonably expect from the Python expression.\n\nThis came up while reviewing #22. That PR correctly enables multiple rules on the same field for flat same-field filters, but it also made the broader filter API easier to trust for range and cohort workflows. The remaining issue is that mixed AND/OR expressions can silently serialize differently from the expression a data scientist wrote.\n\n## Repro cases\n\n### Repeated `.filter()` calls after an OR composite\n\nThe query docs say multiple `.filter()` calls are combined with AND logic:\n\n```python\nquery = (\n    model.query()\n    .filter((model.dimensions.status == \"active\") | (model.dimensions.status == \"pending\"))\n    .filter(model.dimensions.status != \"deleted\")\n)\n```\n\nExpected logical shape:\n\n```text\n(status = active OR status = pending) AND status != deleted\n```\n\nCurrent behavior preserves the existing `or` aggregation when appending a single filter, producing the equivalent of:\n\n```text\nstatus = active OR status = pending OR status != deleted\n```\n\nThe relevant path is `Query.filter()` when `self._filters` already exists and the new filter is a `DimensionFilter`.\n\n### Nested boolean expressions flatten precedence\n\nThe docs currently show a complex filter example like:\n\n```python\nf = (\n    (model.dimensions.country == \"USA\") \u0026\n    ((model.dimensions.amount \u003e 1000) | (model.dimensions.priority == \"high\"))\n)\n```\n\nExpected logical shape:\n\n```text\ncountry = USA AND (amount \u003e 1000 OR priority = high)\n```\n\nCurrent behavior flattens the filters into a single aggregation, so the nested precedence is not represented in the serialized payload.\n\n## Why this matters\n\nFor exploratory analysis and notebook workflows, users often write cohort filters, date windows, and exclusion rules in Python expressions. If the SDK silently changes OR/AND semantics, a query can return a materially different population without an obvious failure. That is especially risky for data scientists using this SDK to build analysis datasets.\n\n## Possible resolutions\n\n1. Implement nested composite serialization if the Lightdash API supports nested boolean filter groups.\n2. If the API only supports flat `and`/`or` groups, reject mixed nested expressions early with a clear error.\n3. Update docs to avoid advertising unsupported complex combinations until the behavior is implemented.\n4. Fix repeated `.filter()` calls so they are actually AND-ed, or document the exact current behavior if preserving aggregation is intentional.\n\n## Acceptance criteria\n\n- Mixed `AND`/`OR` filter expressions either serialize with correct precedence or raise an explicit unsupported-operation error.\n- Multiple `.filter()` calls always behave as documented, especially when the first filter is an OR composite.\n- Tests cover:\n  - `(a | b).filter(c)` style chaining through `Query.filter()`.\n  - `a \u0026 (b | c)` nested expression behavior.\n  - The documented complex combination example.\n- `docs/SDK_GUIDE.md` matches the actual supported filter semantics.","author":{"url":"https://github.com/jpetey75","@type":"Person","name":"jpetey75"},"datePublished":"2026-06-16T19:51:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/23/python-sdk/issues/23"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:d6e475e0-2919-6fc5-5d9a-4c439cbb22c9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEB54:2279D0:483E74:6393FB:6A4DC83E
html-safe-nonce4711b6cc531b640b682d3df810e56ef45e2313472f0833947fe7002d5a2045c5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjU0OjIyNzlEMDo0ODNFNzQ6NjM5M0ZCOjZBNERDODNFIiwidmlzaXRvcl9pZCI6IjU5MTM4NzgyOTI4NTE0NDM3NzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac96a16346d1fe571d98ce2ad2b43a06116ca5ecdb84f34808e906a9b9bcc6a856
hovercard-subject-tagissue:4677419508
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lightdash/python-sdk/23/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6ad00277c6321d9869d42dc57a208b429bb13990d1315f010a6d9ec4cbd528bb/lightdash/python-sdk/issues/23
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6ad00277c6321d9869d42dc57a208b429bb13990d1315f010a6d9ec4cbd528bb/lightdash/python-sdk/issues/23
og:image:altProblem The SDK currently exposes filter composition with &, |, and repeated .filter() calls, but the behavior for mixed boolean logic does not preserve the semantics users would reasonably expect ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejpetey75
hostnamegithub.com
expected-hostnamegithub.com
None06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33
turbo-cache-controlno-preview
go-importgithub.com/lightdash/python-sdk git https://github.com/lightdash/python-sdk.git
octolytics-dimension-user_id65912827
octolytics-dimension-user_loginlightdash
octolytics-dimension-repository_id932695849
octolytics-dimension-repository_nwolightdash/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id932695849
octolytics-dimension-repository_network_root_nwolightdash/python-sdk
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/lightdash/python-sdk/issues/23#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Flightdash%2Fpython-sdk%2Fissues%2F23
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Flightdash%2Fpython-sdk%2Fissues%2F23
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=lightdash%2Fpython-sdk
Reloadhttps://github.com/lightdash/python-sdk/issues/23
Reloadhttps://github.com/lightdash/python-sdk/issues/23
Reloadhttps://github.com/lightdash/python-sdk/issues/23
Please reload this pagehttps://github.com/lightdash/python-sdk/issues/23
lightdash https://github.com/lightdash
python-sdkhttps://github.com/lightdash/python-sdk
Notifications https://github.com/login?return_to=%2Flightdash%2Fpython-sdk
Fork 4 https://github.com/login?return_to=%2Flightdash%2Fpython-sdk
Star 15 https://github.com/login?return_to=%2Flightdash%2Fpython-sdk
Code https://github.com/lightdash/python-sdk
Issues 4 https://github.com/lightdash/python-sdk/issues
Pull requests 1 https://github.com/lightdash/python-sdk/pulls
Actions https://github.com/lightdash/python-sdk/actions
Projects https://github.com/lightdash/python-sdk/projects
Security and quality 0 https://github.com/lightdash/python-sdk/security
Insights https://github.com/lightdash/python-sdk/pulse
Code https://github.com/lightdash/python-sdk
Issues https://github.com/lightdash/python-sdk/issues
Pull requests https://github.com/lightdash/python-sdk/pulls
Actions https://github.com/lightdash/python-sdk/actions
Projects https://github.com/lightdash/python-sdk/projects
Security and quality https://github.com/lightdash/python-sdk/security
Insights https://github.com/lightdash/python-sdk/pulse
#29https://github.com/lightdash/python-sdk/pull/29
Clarify or fix composite filter boolean semanticshttps://github.com/lightdash/python-sdk/issues/23#top
#29https://github.com/lightdash/python-sdk/pull/29
https://github.com/jpetey75
jpetey75https://github.com/jpetey75
on Jun 16, 2026https://github.com/lightdash/python-sdk/issues/23#issue-4677419508
#22https://github.com/lightdash/python-sdk/pull/22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.