Skip to content

Commit 8e6ba71

Browse files
committed
fix(vscode): fix link [ci skip]
1 parent 3ab48e5 commit 8e6ba71

5 files changed

Lines changed: 37 additions & 7 deletions

File tree

sqlmesh/lsp/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ def api(ls: LanguageServer, request: ApiRequest) -> t.Dict[str, t.Any]:
119119
# /api/lineage/{model}/{column}
120120
model_name = urllib.parse.unquote(path_parts[2])
121121
column = urllib.parse.unquote(path_parts[3])
122-
logging.info(f"Column lineage request: {model_name} {column}")
122+
logging.info(
123+
f"Column lineage request: {model_name} {column} with params {request.params}"
124+
)
125+
models_only = bool(getattr(request.params, "models_only", False))
123126
column_lineage_response = column_lineage(
124-
model_name, column, False, self.lsp_context.context
127+
model_name, column, models_only, self.lsp_context.context
125128
)
126129
return ApiResponseGetColumnLineage(data=column_lineage_response).model_dump(
127130
mode="json"

vscode/bus/src/nominal.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Nominal type
3+
*
4+
* This is a nominal type that is used to create a new type that is a brand of the original type.
5+
* This is useful for creating interfaces that are not compatible with the original type and require
6+
* a type check to ensure that the type is correct.
7+
*/
8+
export type Nominal<K, T> = K & { __brand: T }

vscode/react/src/components/graph/ModelColumns.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ function ModelColumn({
402402
refetch: getColumnLineage,
403403
isFetching,
404404
isError,
405-
} = useApiColumnLineage(nodeId, column.name)
405+
} = useApiColumnLineage(nodeId, column.name, { models_only: true })
406406

407407
useEffect(() => {
408408
if (isNil(selectManually)) return

vscode/react/src/components/graph/ModelNode.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ export default function ModelNode({
5353
const modelsArray = Object.values(models)
5454
const decodedId = decodeURIComponent(id)
5555
const model = modelsArray.find((m: Model) => m.fqn === decodedId)
56-
if (!model) {
57-
throw new Error(`Model not found: ${id}`)
58-
}
5956
const modelColumns = model?.columns ?? []
6057

58+
console.log('lineage', lineage)
59+
6160
Object.keys(lineage[decodedId]?.columns ?? {}).forEach((column: string) => {
6261
const found = modelColumns.find(({ name }: any) => {
6362
try {
@@ -158,6 +157,20 @@ export default function ModelNode({
158157
// isFalse(isModelUnknown)
159158
const shouldDisableColumns = isFalse(isModelSQL)
160159

160+
const nodeLabel: string = nodeData.label.includes(':')
161+
? (nodeData.label.split(':').pop() ?? nodeData.label)
162+
: nodeData.label
163+
console.log(
164+
'id',
165+
id,
166+
isCTE,
167+
columns,
168+
nodeData.label,
169+
'does node label include :',
170+
nodeData.label.includes(':'),
171+
nodeLabel,
172+
)
173+
161174
return (
162175
<div
163176
onMouseEnter={() => setIsMouseOver(true)}
@@ -200,7 +213,7 @@ export default function ModelNode({
200213
<ModelNodeHeaderHandles
201214
id={id}
202215
type={nodeType}
203-
label={nodeData.label}
216+
label={nodeLabel}
204217
isSelected={isSelected}
205218
isDraggable={true}
206219
className={clsx(

web/server/api/endpoints/lineage.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import logging
34
import typing as t
45
from collections import defaultdict
56

@@ -19,6 +20,8 @@
1920

2021
router = APIRouter()
2122

23+
logger = logging.getLogger(__name__)
24+
2225

2326
def quote_column(column: str, dialect: str) -> str:
2427
return exp.to_identifier(column, quoted=True).sql(dialect=dialect)
@@ -134,6 +137,9 @@ def column_lineage(
134137
) -> t.Dict[str, t.Dict[str, LineageColumn]]:
135138
"""Get a column's lineage"""
136139
try:
140+
logger.info(
141+
f"Getting column lineage for {model_name}.{column_name}, models only: {models_only}"
142+
)
137143
model_name = context.get_model(model_name).fqn
138144
if models_only:
139145
return create_models_only_lineage_adjacency_list(model_name, column_name, context)

0 commit comments

Comments
 (0)