docs: note that the SQL API can't address custom granularities by name - #11443
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Claude finished @igorlukanin's task in 2m 51s —— View job Review: docs-only PR, 1 medium issue (repeated across all 3 files), 1 lowThe core claim — the SQL API can't address custom granularities by name — checks out against the code. One secondary claim about the GraphQL API does not. Full review — verification notes, findings, and checklistTodos
What I verified✅ SQL API limitation is real. ✅ All new links and anchors resolve.
❌ GraphQL API claim is wrong (medium). All three pages assert custom granularities can be queried by name via the GraphQL API. They can't: This matters because the pages are steering readers toward proxy dimensions specifically — GraphQL users need the same workaround and currently read that they don't. Inline comments with suggested wording on all three sites:
Low — unverifiable error string. Nit. What's good
Nothing security-, performance-, or test-related applies — this is a docs-only change with no code paths touched. |
|
Claude finished @igorlukanin's task in 2m 4s —— View job Re-review of
|
| File | New wording | ✅ |
|---|---|---|
reference/data-modeling/dimensions.mdx:1044-1053 |
"neither the SQL API nor the GraphQL API can address them by name" | ✅ |
reference/core-data-apis/sql-api/reference.mdx:374-380 |
parenthetical: GraphQL "can't address them by name either" | ✅ |
recipes/data-modeling/custom-granularity.mdx:22-29 |
"SQL API and the GraphQL API can only address the default granularities" | ✅ |
Re-confirmed against the code: TimeDimension (packages/cubejs-api-gateway/src/graphql.ts:96-127) is a static object type with value + exactly the eight defaults, never extended per-cube; the only granularit* hit in the file is the resolver at 422-431, which reads whatever field name already survived schema validation.
The new REST claim also checks out
packages/cubejs-api-gateway/src/query.js:174—granularity: Joi.string().max(128, 'utf8')with the comment// Custom granularities may have arbitrary names. No enum constraint.packages/cubejs-api-gateway/src/helpers/prepare-annotation.ts:125— resolvestd.granularityagainst the dimension'sgranularitiesarray by name.
So "REST yes, SQL/GraphQL no" is accurate.
New finding (low-medium) — the recipe's Playground claim
recipes/data-modeling/custom-granularity.mdx:27 says a proxy dimension "is the way to query a custom granularity from Playground or a BI tool" — but the same sentence just said the REST API can address custom granularities by name, and Playground queries via REST. Client-side support is there too (cubejs-client-core/src/types.ts:451, time.ts:225). The pre-fix wording ("conveniently query them via Playground or BI tools") didn't have this tension; the necessity framing introduces it. Inline suggestion at recipes/data-modeling/custom-granularity.mdx:22-29.
Caveat: the Playground query-builder UI isn't in this repo, so if its granularity picker genuinely lists only the eight defaults, the claim holds — but then it's a UI statement, not a queryability one, and reads better said that way.
Links re-verified
| Link | Target | Status |
|---|---|---|
#granularities |
### \granularities`, reference/data-modeling/dimensions.mdx:1019` |
✅ |
/docs/data-modeling/dimensions#time-dimension-granularity-references |
heading at docs/data-modeling/dimensions.mdx:248 |
✅ |
/reference/core-data-apis/rest-api/reference#metadata-api |
## Metadata API, line 703 |
✅ |
/reference/core-data-apis/rest-api, /graphql-api, /sql-api |
all three have index.mdx |
✅ |
[ref-graphql-api] on sql-api/reference.mdx is now used (the parenthetical), so the dead-link-def concern from my earlier thread no longer applies.
Still open from the prior round
- Low — unverifiable error string.
Execution error: Unsupported date_trunc granularity: fiscal_quarter(sql-api/reference.mdx:383) is a vendored-DataFusion string not present in this repo; it may drift on an upstream bump. - Nit.
recipes/data-modeling/custom-granularity.mdxstill ends without a trailing newline (pre-existing).
Nothing security-, performance-, or test-related applies — docs-only, no code paths touched.
|
Fair, and the tension was mine to fix: REST takes arbitrary granularity names ( Leaving the |
|
Claude finished @igorlukanin's task in 1m 39s —— View job Re-review of
|
| Check | Result |
|---|---|
[ref-playground] def removed |
✅ line gone |
Any remaining ref-playground / "Playground" usage in the file |
✅ zero — no dangling reference |
| Trailing newline | ✅ file now ends ...references\n |
The ## Result screenshot at line 162 |
✅ unlabeled, never named Playground in prose, so removing the mention leaves nothing orphaned |
| Duplicate link defs from the three new ones | ✅ none — ref-rest-api / ref-graphql-api / ref-sql-api / ref-proxy-granularity each defined once per file |
Re-verified the substantive claims
granularity_str_to_int_order (rust/cubesql/cubesql/src/compile/rewrite/rules/utils.rs:376-394) matches exactly second, minute, hour, day, week, month, quarter, year → _ => None. The eight units enumerated in the DATE_TRUNC warning (sql-api/reference.mdx:374-375) match that arm-for-arm, with no extras or omissions.
GraphQL narrowing and the REST claim were confirmed in the previous round and are unchanged by this commit.
Threads
Resolved my own now-addressed Playground thread (PRRT_kwDOCOH19M6WLMpB). No unresolved claude threads remain; nothing to re-affirm.
Still open (both accepted, no action needed)
- Low — error string coupling.
Execution error: Unsupported date_trunc granularity: fiscal_quarter(sql-api/reference.mdx:383) is a vendored-DataFusion string. Your call to keep it verbatim is the right one for the reader — noted only so it's on record if an upstream bump changes the wording.
Pre-existing nit, not introduced here
[ref-custom-granularities] (recipes/data-modeling/custom-granularity.mdx:167) is an unused link definition — it predates this PR (line 9 uses [ref-default-granularities], and nothing references the custom one). Harmless in Mintlify; a one-line delete if you're already in the file.
What's good about the final shape
The three pages now say the same thing in three registers without contradicting each other: the reference states the rule, the SQL API page gives the error text and the escape hatch, and the recipe explains why the proxy dimensions in the example are load-bearing rather than decorative. Two rounds of narrowing (GraphQL, then Playground) landed on a claim that's exactly as broad as the code supports.
Docs-only — nothing security-, performance-, or test-related applies.
d117aa4 to
87083b5
Compare
|
Claude finished @igorlukanin's task in 1m 15s —— View job Re-review after force-push (
|
| Item | State |
|---|---|
recipes/.../custom-granularity.mdx:22-28 |
"…from those APIs or from a BI tool" — Playground fix intact |
[ref-playground] def |
✅ removed, zero remaining usages |
| Trailing newline | ✅ file ends …-references\n |
| GraphQL narrowing in all 3 files | ✅ present |
Substantive claims re-verified against this checkout
- SQL API.
granularity_str_to_int_order(rust/cubesql/cubesql/src/compile/rewrite/rules/utils.rs:376-394) matches exactlysecond,minute,hour,day,week,month,quarter,year→_ => None. The eight units listed in the warning (sql-api/reference.mdx:374-375) match arm-for-arm. - GraphQL API. The only
granularit*hits inpackages/cubejs-api-gateway/src/graphql.tsare the resolver at 422-431, which reads whatever field name already survived schema validation. Nothing reads the meta'sgranularitiesarray, so the "can't address them by name either" claim holds. - REST API. Unchanged since last round: free-form
granularitystring inquery.js:174, name resolution inprepare-annotation.ts:125.
Links and anchors
| Link | Target | Status |
|---|---|---|
#granularities |
### \granularities`, reference/data-modeling/dimensions.mdx:1044` |
✅ |
/docs/data-modeling/dimensions#time-dimension-granularity-references |
heading at docs/data-modeling/dimensions.mdx:248 |
✅ |
/reference/core-data-apis/rest-api/reference#metadata-api |
## Metadata API, line 703 |
✅ |
/reference/core-data-apis/{rest,graphql,sql}-api |
all three have index.mdx |
✅ |
All five new defs in sql-api/reference.mdx (520-524) are used; all four new defs in the other two files are used. No duplicates.
Nit (new, low) — link label vs. target
sql-api/reference.mdx:366 labels the link "default granularities" but [ref-granularities] points at #granularities, which is the reference section for custom granularities. A reader clicking "default granularities" lands on the custom-granularity parameter docs. Either relabel to just "granularities", or point at /docs/data-modeling/dimensions#time-dimensions (the def the recipe uses as [ref-default-granularities]). Cosmetic — the prose immediately below the table enumerates the eight defaults verbatim, so nobody is left guessing.
Pre-existing, not introduced here
[ref-custom-granularities](recipes/data-modeling/custom-granularity.mdx:167) is still an unused link def, predating this PR. Harmless in Mintlify.- Low — error string coupling.
Execution error: Unsupported date_trunc granularity: fiscal_quarter(sql-api/reference.mdx:383) is a vendored-DataFusion string. Accepted last round; noted only for the record if an upstream bump changes the wording.
Docs-only — nothing security-, performance-, or test-related applies.
|
Took the nit in The two pre-existing items stay as they are: the unused |
|
Claude finished @igorlukanin's task in 1m 0s —— View job Re-review of
|
| Def | Target | Used at | ✅ |
|---|---|---|---|
ref-default-granularities |
/docs/data-modeling/dimensions#time-dimensions |
366 | ✅ |
ref-granularities |
/reference/data-modeling/dimensions#granularities |
376 | ✅ |
ref-meta-api |
…/rest-api/reference#metadata-api |
377 | ✅ |
ref-rest-api |
/reference/core-data-apis/rest-api |
378 | ✅ |
ref-graphql-api |
/reference/core-data-apis/graphql-api |
378 | ✅ |
ref-proxy-granularity |
…#time-dimension-granularity-references |
387 | ✅ |
No duplicates, no orphans among the six new defs in this file. #time-dimensions (line 82) and #time-dimension-granularity-references (line 248) both resolve in docs/data-modeling/dimensions.mdx.
Substantive claims re-verified against this checkout
- SQL API.
granularity_str_to_int_order(rust/cubesql/cubesql/src/compile/rewrite/rules/utils.rs:376-394) matches exactlysecond,minute,hour,day,week,month,quarter,year→_ => None. Arm-for-arm match with the eight units in the warning atsql-api/reference.mdx:374-375. - GraphQL API. Static
TimeDimensiontype, never extended per-cube; nothing reads the meta'sgranularitiesarray. "Can't address them by name either" holds. - REST API. Free-form
granularitystring (query.js:174) plus name resolution againstgranularities(prepare-annotation.ts:125). "REST yes, SQL/GraphQL no" is accurate.
The other two files are untouched by this commit and remain in their approved state — Playground fix intact, [ref-playground] gone with zero remaining usages, trailing newline present.
Pre-existing, not introduced here
[ref-custom-granularities](recipes/data-modeling/custom-granularity.mdx:167) is still an unused link def, predating this PR. Harmless in Mintlify.- Low — error string coupling.
Execution error: Unsupported date_trunc granularity: fiscal_quarter(sql-api/reference.mdx:383) is a vendored-DataFusion string. Agreed with your reasoning: it's what the user pastes into search, and attributing it to DataFusion would be reader noise. On record only in case an upstream bump changes it.
Docs-only — nothing security-, performance-, or test-related applies.
Custom granularities are advertised in
/v1/metabut can't be queried through the SQL API by name —DATE_TRUNC('fiscal_quarter', …)fails at execution withUnsupported date_trunc granularity. cubesql's granularity handling is hardcoded to the eight standard units (granularity_str_to_int_order,rust/cubesql/cubesql/src/compile/rewrite/rules/utils.rs:376) and never reads the meta'sgranularitiesarray.That limitation wasn't documented on any page a user would consult before hitting it:
granularitiesreference coveredinterval/offset/origin/titleand supported data sources, but said nothing about queryability.DATE_TRUNCas fully supported with no qualification.This adds the limitation to all three, and points at proxy dimensions as the way to query a custom granularity from the SQL API or a BI tool.
Written as current behavior — the engine-side gap is tracked separately, and if the SQL API later resolves custom grains these notes become version-scoped rather than permanent.
Verified with
mint broken-links(clean) and by rendering all three pages plus every link target locally.