Skip to content

Docs consolidation#25

Merged
AivanF merged 1 commit intomainfrom
aivan/2026-04-10-Docs-Consolidation
Apr 10, 2026
Merged

Docs consolidation#25
AivanF merged 1 commit intomainfrom
aivan/2026-04-10-Docs-Consolidation

Conversation

@AivanF
Copy link
Copy Markdown
Collaborator

@AivanF AivanF commented Apr 10, 2026

Summary by CodeRabbit

  • Documentation
    • Updated query syntax documentation to reflect colon-based aggregation for measures (e.g., revenue:sum, *:count).
    • Simplified query format across CLI, REST API, Python, and MCP examples.
    • Updated getting-started guides with current query patterns for dimensions, fields, and time dimensions.
    • Refined model and measure definition documentation.

@AivanF AivanF requested a review from ZmeiGorynych April 10, 2026 12:02
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

Documentation updates reflecting a major API change: measures are now defined as row-level SQL expressions without aggregation types, with aggregation specified at query time using colon syntax (e.g., "revenue:sum", "*:count"). Query parameters simplified to string-based formats. The root getting-started page is removed.

Changes

Cohort / File(s) Summary
Model and Query Skill Documentation
.claude/skills/slayer-models.md, .claude/skills/slayer-query.md
Updated measure schema documentation to reflect row-level SQL expressions without aggregation types, with query-time aggregation via colon syntax. Revised join examples, auto-ingestion behavior, and added resolve_storage() documentation. Updated SlayerQuery construction, fields, dimensions, ordering, filtering, and response format examples.
Getting Started Examples
docs/getting-started/cli.md, docs/getting-started/mcp.md, docs/getting-started/python.md, docs/getting-started/rest-api.md
Consistently updated code examples to use new query API format: fields changed from formula objects to string expressions ("*:count", "revenue:sum"), dimensions changed from objects to strings, time_dimensions and order simplified to string/dict formats across CLI, MCP, Python, and REST API examples.
Removed Content
docs/getting-started.md
Entire getting-started page deleted, including installation instructions, database connection workflows, first query walkthrough, and navigation links.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ZmeiGorynych

Poem

🐰 Measures now dance freely, no types to declare,
Colon syntax whispers aggregations in air,
Strings replace objects, simpler by far,
APIs aligned like a bright guiding star!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Docs consolidation' is vague and generic, using non-descriptive language that doesn't convey meaningful information about the specific changes in the changeset. Provide a more specific title that describes the main change, such as 'Update documentation for new query syntax and aggregation approach' or 'Refactor docs to reflect measure definition and aggregation changes'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aivan/2026-04-10-Docs-Consolidation

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/getting-started/mcp.md`:
- Line 54: Change the example call to use a dict/JSON-style payload instead of
keyword args: replace the call shown as query(source_model="orders",
fields=["*:count"], dimensions=["status"]) with a single dict argument (e.g.,
query({"source_model":"orders","fields":["*:count"],"dimensions":["status"]}))
so the example follows the docs' guideline to use JSON/dict syntax for MCP query
objects.

In `@docs/getting-started/python.md`:
- Around line 57-61: The example uses the Python constructor SlayerQuery(...)
when calling engine.execute(query=SlayerQuery(...)); replace the
constructor-style query object with a plain dict/JSON literal (e.g., query =
{"source_model": "...", "fields": [...], "dimensions": [...]}) and pass that
dict to engine.execute(query=...); apply the same change to the other
occurrences mentioned (around the blocks formerly at lines 90-94 and 102-106) so
all docs use JSON/dict query objects instead of SlayerQuery constructors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3ae4dcc1-c233-47ec-8df9-2102d0bc74e9

📥 Commits

Reviewing files that changed from the base of the PR and between 6222856 and 6db9da5.

📒 Files selected for processing (7)
  • .claude/skills/slayer-models.md
  • .claude/skills/slayer-query.md
  • docs/getting-started.md
  • docs/getting-started/cli.md
  • docs/getting-started/mcp.md
  • docs/getting-started/python.md
  • docs/getting-started/rest-api.md
💤 Files with no reviewable changes (1)
  • docs/getting-started.md

> **You:** How many orders per status?
>
> **Agent:** *calls `query(source_model="orders", fields=[{"formula": "count"}], dimensions=["status"])`*
> **Agent:** *calls `query(source_model="orders", fields=["*:count"], dimensions=["status"])`*
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep MCP query object in dict form for docs consistency.

Prefer a dict payload shape in this example (e.g., query({"source_model": "...", "fields": [...], "dimensions": [...]})) instead of keyword-argument constructor style.

As per coding guidelines: “Use JSON/dict syntax for all query objects in docs and examples — not Python class constructors.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/mcp.md` at line 54, Change the example call to use a
dict/JSON-style payload instead of keyword args: replace the call shown as
query(source_model="orders", fields=["*:count"], dimensions=["status"]) with a
single dict argument (e.g.,
query({"source_model":"orders","fields":["*:count"],"dimensions":["status"]}))
so the example follows the docs' guideline to use JSON/dict syntax for MCP query
objects.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is AI agent sample output, not an actual code snippet...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AivanF, you're absolutely right — that line is descriptive prose illustrating what an AI agent does in a conversation, not a code snippet that users would actually run. My comment was incorrect to apply the JSON/dict syntax guideline here. Apologies for the noise!

I'll update the long-term memory to clarify this distinction so it doesn't get flagged again.


✏️ Learnings added
Learnt from: AivanF
Repo: MotleyAI/slayer PR: 25
File: docs/getting-started/mcp.md:54-54
Timestamp: 2026-04-10T12:15:07.864Z
Learning: In MotleyAI/slayer docs (e.g., docs/getting-started/mcp.md), illustrative/conversational agent output (e.g., lines like `> **Agent:** *calls \`query(...)\`*` inside blockquotes) is descriptive prose, not actual code. The JSON/dict syntax guideline only applies to real code examples/snippets, not to these narrative descriptions of what an agent does. Do not flag keyword-arg style in such prose as a violation of the JSON/dict syntax rule.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: AivanF
Repo: MotleyAI/slayer PR: 25
File: docs/getting-started/python.md:57-61
Timestamp: 2026-04-10T12:12:08.571Z
Learning: In the MotleyAI/slayer repo docs, use language-agnostic “JSON/dict syntax” when showing query objects on non-Python pages (e.g., REST API, CLI, MCP). When the page is specifically demonstrating the Python SDK directly—such as `docs/getting-started/python.md`—it is acceptable (and preferred) to show Python constructor syntax like `SlayerQuery(...)` instead of JSON/dict syntax. Avoid mixing constructors into language-agnostic examples.

Comment on lines 57 to 61
result = engine.execute(query=SlayerQuery(
source_model="orders",
fields=[{"formula": "count"}, {"formula": "revenue_sum"}],
dimensions=[{"name": "status"}],
fields=["*:count", "revenue:sum"],
dimensions=["status"],
))
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use JSON/dict query objects in examples (not SlayerQuery(...) constructors).

These sections still present query objects via Python constructor style, which conflicts with the docs portability standard.

Suggested docs fix
-result = engine.execute(query=SlayerQuery(
-    source_model="orders",
-    fields=["*:count", "revenue:sum"],
-    dimensions=["status"],
-))
+result = engine.execute(query={
+    "source_model": "orders",
+    "fields": ["*:count", "revenue:sum"],
+    "dimensions": ["status"],
+})
-result = client.query(SlayerQuery(
-    source_model="orders",
-    fields=["*:count"],
-    dimensions=["status"],
-))
+result = client.query({
+    "source_model": "orders",
+    "fields": ["*:count"],
+    "dimensions": ["status"],
+})
-df = client.query_df(SlayerQuery(
-    source_model="orders",
-    fields=["*:count", "revenue:sum"],
-    dimensions=["status"],
-))
+df = client.query_df({
+    "source_model": "orders",
+    "fields": ["*:count", "revenue:sum"],
+    "dimensions": ["status"],
+})

As per coding guidelines: “Use JSON/dict syntax for all query objects in docs and examples — not Python class constructors.”

Also applies to: 90-94, 102-106

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/python.md` around lines 57 - 61, The example uses the
Python constructor SlayerQuery(...) when calling
engine.execute(query=SlayerQuery(...)); replace the constructor-style query
object with a plain dict/JSON literal (e.g., query = {"source_model": "...",
"fields": [...], "dimensions": [...]}) and pass that dict to
engine.execute(query=...); apply the same change to the other occurrences
mentioned (around the blocks formerly at lines 90-94 and 102-106) so all docs
use JSON/dict query objects instead of SlayerQuery constructors.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you see these "As per coding guidelines"? Note that this is docs/getting-started/python.md file specifically for Python.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AivanF, you're right — that guideline came from a previously stored learning in my knowledge base:

"Applies to docs/**/*.{md,rst,markdown}: Use JSON/dict syntax for all query objects in docs and examples — not Python class constructors. This keeps examples portable across Python, REST API, and MCP interfaces."

However, your point is well-taken. This file is specifically the Python SDK guide, so showing SlayerQuery(...) constructors is actually the most natural and helpful form for Python users. The dict-portability rationale applies to language-agnostic docs (REST API, CLI, MCP pages), not to a page whose whole purpose is to demonstrate the Python API.

I'll refine the learning to reflect this distinction.

Note: I've also flagged the existing broad learning (ID af85caa4) for removal, as it is now superseded by the more precise one above. You can also delete it manually via the CodeRabbit UI learnings page if needed.


✏️ Learnings added
Learnt from: AivanF
Repo: MotleyAI/slayer PR: 25
File: docs/getting-started/python.md:57-61
Timestamp: 2026-04-10T12:12:08.571Z
Learning: In the MotleyAI/slayer repo, the rule "Use JSON/dict syntax for query objects in docs — not Python class constructors" applies to language-agnostic documentation (e.g., REST API, CLI, MCP pages). The Python-specific guide `docs/getting-started/python.md` may (and should) use `SlayerQuery(...)` constructor syntax, as it is demonstrating the Python SDK directly.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


⛔ Learnings removed
Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: docs/CLAUDE.md:0-0
Timestamp: 2026-04-08T11:48:40.209Z
Learning: Applies to docs/**/*.{md,rst,markdown} : Use JSON/dict syntax for all query objects in docs and examples — not Python class constructors. Write `{"name": "stores.name"}` not `ColumnRef(name="stores.name")`, `{"formula": "count"}` not `Field(formula="count")`. This keeps examples portable across Python, REST API, and MCP interfaces.

🧠 Learnings used
Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/*generator*.py : Result column keys use `model_name.column_name` format (e.g., `"orders.count"`); multi-hop joined dimensions include full path (e.g., `"orders.customers.regions.name"`)

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/*generator*.py : Result column naming: `revenue:sum` → `orders.revenue_sum` (colon becomes underscore), `*:count` → `orders.count`

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/formula*.py : Use `*:count` for COUNT(*) — `*` means "all rows", not a magic keyword

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/models*.py : SlayerModel has optional `default_time_dimension` field for time-dependent formula resolution

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/*.{py,yaml,yml,json} : Use bare column names for dimension/measure SQL (e.g., `"amount"`); use `model_name.column_name` for complex expressions (e.g., `"orders.amount * orders.quantity"`)

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/query*.py : `SlayerQuery.source_model` accepts a model name, inline `SlayerModel`, or `ModelExtension`; `create_model_from_query()` saves a query as a permanent model

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/formula*.py : Available formula transforms: cumsum, time_shift, change, change_pct, rank, last, lag, lead

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: docs/CLAUDE.md:0-0
Timestamp: 2026-04-08T11:48:40.209Z
Learning: Applies to docs/**/*.{md,rst,markdown} : Use JSON/dict syntax for all query objects in docs and examples — not Python class constructors. Write `{"name": "stores.name"}` not `ColumnRef(name="stores.name")`, `{"formula": "count"}` not `Field(formula="count")`. This keeps examples portable across Python, REST API, and MCP interfaces.

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/*generator*.py : Use `__`-delimited path aliases in SQL for joined tables to disambiguate diamond joins (e.g., `customers__regions`); in queries use dots (`customers.regions.name`)

Learnt from: CR
Repo: MotleyAI/slayer PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-10T11:46:34.327Z
Learning: Applies to **/slayer/**/*generator*.py : Use sqlglot AST building for SQL generation, not string concatenation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLAUDE.md. Probably should add an exception there for docs/examples that are purely Python -specific; Though these take raw dicts now as well btw

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@AivanF AivanF merged commit ad59951 into main Apr 10, 2026
3 checks passed
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.

2 participants