Repository navigation
Conversation
Nine tool stubs exposed through `altimate tool run` (dbt_run_results, dbt_defer_state, dbt_map_relations, docs_share_comments, dbt_cost_estimate, dbt_health, dbt_sql_graph, dbt_docs_coverage, dbt_cte_profile), an exported `AltimateApi.apiRequest` that calls the backend with the stored credentials, and `dbtAdapterFor`, the one gate every adapter-backed tool goes through: it refuses read-only calls, other projects, and an adapter that did not start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e() calls Each table the SQL reads is matched against the relation_name of the manifest's models, snapshots, seeds and sources, with the match reported as exact, case_insensitive, partial or none and every candidate listed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # packages/opencode/src/altimate/tools/dbt-map-relations.ts
…nd versioned models The table scan now walks tokens instead of matching keywords in text: quoted names, strings and dollar quotes are skipped by dialect, dots may have whitespace or comments around them, tables after a subquery or table function in a FROM list are read, a CTE's name is not a table, and a physical table a CTE shares its name with keeps its qualifiers. Versioned models are referenced with v=. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
1 similar comment
|
👋 This PR was automatically closed by our quality checks. Common reasons:
If you believe this was a mistake, please open an issue explaining your intended contribution and a maintainer will help you. |
Review round: findings and what was doneTwo independent reviewers (Claude and Codex, separate CLI processes) read this PR and the plugin PR together; a fresh reviewer then attacked the fixes. Fixes are in 0f33f9a. Fixed
The fix round's own reviewer found and I fixed: ClickHouse double quotes treated as strings, hyphenated BigQuery project ids after a comma, bracket names for fabric/synapse, Not changed, with reasons
Needs an owner, not in this PR's files: Tests: 🤖 Generated with Claude Code |
What
dbt_map_relations { sql, dialect?, manifest_path? }is a read-only tool. It reads the tables of a raw SQL query and matches each one to therelation_nameof a model, snapshot, seed or source in the dbt manifest. For each table it returns{ raw, replaceWith, match, candidates }, wherematchisexact,case_insensitive,partialornoneandreplaceWithis a{{ ref('x') }}or{{ source('s', 't') }}call (the table as written when nothing matched). A model is preferred over a source when both match. It backs the plugin's/to-modelcommand.Tables come from altimate-core
extractMetadata, which keeps only the last name part. The schema and database the person wrote are read back from the SQL text, so a fully written name picks the right relation. Quoted, upper-case, two- and three-part names are covered for Snowflake, BigQuery and Databricks.Tests
bun test test/altimate/dbt-map-relations.test.ts: 27 pass. The first block prints whatextractMetadatareturns for each dialect and the matching rules are based on that. Everymatchvalue is covered, plus a missing manifest, unparseable SQL and SQL with no tables.bunx tsgo --noEmitis clean for the new file.Cost side effects
None. No LLM calls, no warehouse calls, no adapter start. It reads
manifest.jsononly.Changelog lines
dbt_map_relationstool: map the tables of raw SQL toref()andsource()calls from the dbt manifest.The plugin PR (
/to-model) depends on this one. Merge this first.🤖 Generated with Claude Code
Summary by cubic
Ships the first dbt Power User tool:
dbt_map_relationsmaps each table a raw SQL query reads to theref()orsource()call that builds it, using the dbt manifest. The other eight tools are registered stubs that answer "not implemented".Details
FROMlist are handled; a CTE's name is not a table, and a physical table a CTE shares its name with keeps its qualifiers.v=.dbtAdapterForgates every adapter-backed tool: it refuses read-only and plan-mode calls, sessions in another dbt project, and adapters that fail to start or load.AltimateApi.apiRequestcalls the backend with the stored credentials and names the credentials file in errors.manifest.jsononly, and fails clearly when run outside a dbt project withoutmanifest_path.Written for commit 0f33f9a. Summary will update on new commits.