Skip to content

Tighten rules around metric-in-filter#2143

Draft
shangyian wants to merge 2 commits into
DataJunction:mainfrom
shangyian:sql-v3-having
Draft

Tighten rules around metric-in-filter#2143
shangyian wants to merge 2 commits into
DataJunction:mainfrom
shangyian:sql-v3-having

Conversation

@shangyian
Copy link
Copy Markdown
Collaborator

@shangyian shangyian commented May 17, 2026

Summary

Defines and enforces the contract for what kinds of filters /sql/measures/v3 and /sql/measures/v3 accept. This change makes it so that filters are validated upfront and gives precise 422s for the two specific misuses (metric not in list, metric filter on the measures endpoint) instead of obscure downstream errors.

In /sql/measures/v3, we only accept dimension filters, so any metric filters will result in a 422.
In /sql/metrics/v3: dimension filters will end up in WHERE, metric filters in HAVING, and filters on metrics that aren't part of the requested list of metrics results in a 422.

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit ec7dc9f
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6a09e7c029f5a80008737571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant