Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b7cfc04
feat: foundation for the dbt Power User tools
hkaltai Nov 13, 2026
1eb722e
Merge remote-tracking branch 'origin/main' into feat/pu-mods-foundation
hkaltai Nov 13, 2026
21d0494
fix: harden the dbt Power User tool foundation
hkaltai Nov 13, 2026
165ef43
feat: dbt_sql_graph tool — a model's CTEs, joins and filters as a graph
hkaltai Nov 13, 2026
03d5097
test: dbt_sql_graph is no longer a placeholder; format
hkaltai Nov 13, 2026
f6aed61
fix: dbt_sql_graph — adapter-aware column case, session id, cancel be…
hkaltai Nov 13, 2026
3c22e38
Merge branch 'feat/pu-mods-foundation' into feat/dbt-sql-graph-tool
hkaltai Nov 13, 2026
9ee581a
Merge remote-tracking branch 'origin/main' into feat/dbt-sql-graph-tool
hkaltai Nov 13, 2026
4a6dc20
fix: dbt_sql_graph — node ids apart from names, relation mapping by s…
hkaltai Nov 13, 2026
5bab957
fix: dbt_sql_graph — Redshift folds to lower case, a cancelled read-o…
hkaltai Nov 15, 2026
d8c3469
fix: send falsy API bodies, follow cancellation in apiRequest, check …
hkaltai Nov 15, 2026
dace1c2
Merge remote-tracking branch 'origin/main' into feat/pu-mods-foundation
hkaltai Nov 17, 2026
a11aea7
Merge remote-tracking branch 'origin/main' into feat/dbt-sql-graph-tool
hkaltai Nov 17, 2026
18a3fc4
fix: keep the stored API key out of API errors, bound the dbt config …
hkaltai Nov 17, 2026
6024ac9
fix: redact the API key when a refused header races the caller's abor…
hkaltai Nov 17, 2026
f5159c5
docs: say which tools use the dbt adapter helper
hkaltai Nov 17, 2026
f57de3d
docs: rewrap and correct the adapter helper comments
hkaltai Nov 17, 2026
c826186
merge foundation
hkaltai Nov 17, 2026
aaff414
fix: never echo a send failure's text, so a trimmed key can't leak
hkaltai Nov 17, 2026
3a98dff
fix: a rejection with no reason is a send failure, not an abort
hkaltai Nov 17, 2026
fc5b916
Merge remote-tracking branch 'origin/feat/pu-mods-foundation' into fe…
hkaltai Nov 17, 2026
226c9fc
Merge remote-tracking branch 'origin/main' into feat/dbt-sql-graph-tool
hkaltai Nov 17, 2026
67f4dae
fix: a coded or pre-send TypeError is not a header refusal; bind the …
hkaltai Nov 17, 2026
6016c67
Merge remote-tracking branch 'origin/feat/pu-mods-foundation' into fe…
hkaltai Nov 17, 2026
caa4c7c
fix: send API requests only to an http(s) URL
hkaltai Nov 17, 2026
cebec12
Merge remote-tracking branch 'origin/main' into feat/pu-mods-foundation
hkaltai Nov 17, 2026
350e176
Merge remote-tracking branch 'origin/feat/pu-mods-foundation' into fe…
hkaltai Nov 17, 2026
e5cfabe
fix: forward the tool's abort to the lineage request, reject malforme…
hkaltai Nov 17, 2026
1666ada
fix: cancellation interrupts the compile and manifest waits; dbt_sql_…
hkaltai Nov 17, 2026
a58a555
fix: reject graph replies with untyped or dangling nodes, URLs with c…
hkaltai Nov 17, 2026
6e3f06d
fix: a relation spelled in two cases keeps every occurrence tied to i…
hkaltai Nov 17, 2026
95572bd
Merge origin/main into feat/dbt-sql-graph-tool
hkaltai Nov 17, 2026
ab57c06
perf: the exact-match relation sets are built once for all parents in…
hkaltai Nov 17, 2026
0081750
Keep this PR to its own files: the MCP structured-field entry and the…
hkaltai Nov 17, 2026
58ace8f
fix: a replacement final-select key never overwrites another node; th…
hkaltai Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions packages/opencode/src/altimate/api/sql-lineage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { AltimateApi } from "./client"

/** One parent relation handed to the backend: its warehouse location and its columns. */
export type SqlLineageModelNode = {
database: string
schema: string
name: string
alias: string
uniqueId: string
columns: Record<string, { name: string; description: string; data_type: string; meta: unknown }>
path: string | undefined
}

export type SqlLineageRequest = {
compiled_sql: string
model_info: { model_node: SqlLineageModelNode }[]
model_dialect: string
session_id: string
}

/**
* One node of the backend's graph, keyed in `details` by an id that edges use. A CTE or the final select carries `sql`; a relation, join, filter, group, sort or
* subquery carries `expression`. A relation, subquery, CTE and the final select have a `name`; a join, filter, group or sort has none.
*/
export type SqlLineageNodeDetails = {
name?: string
type: string
nodeType?: string
nodeId?: string
sql?: string
expression?: string
/** A relation's warehouse database (catalog) and schema. */
db?: string
schema?: string
columns?: { name: string; datatype?: string; expression?: string }[]
}

export type SqlLineageResponse = {
tableEdges: [string, string][]
details: Record<string, SqlLineageNodeDetails>
nodePositions?: Record<string, [number, number]>
}

export const SQL_LINEAGE_ENDPOINT = "/dbt/v3/sql_lineage"

/** The backend's graph of a compiled model's CTEs, joins and filters. */
export async function sqlLineage(req: SqlLineageRequest, signal?: AbortSignal): Promise<SqlLineageResponse> {
return (await AltimateApi.apiRequest("POST", SQL_LINEAGE_ENDPOINT, req, signal)) as SqlLineageResponse
}
Loading
Loading