Skip to content

Commit 06ea05a

Browse files
authored
chore(vscode): add full path to model and make call sync (#4336)
1 parent 0531201 commit 06ea05a

5 files changed

Lines changed: 61 additions & 57 deletions

File tree

web/client/openapi.json

Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@
1111
"content": {
1212
"application/json": {
1313
"schema": {
14-
"allOf": [
15-
{
16-
"$ref": "#/components/schemas/Body_initiate_apply_api_commands_apply_post"
17-
}
18-
],
19-
"title": "Body"
14+
"$ref": "#/components/schemas/Body_initiate_apply_api_commands_apply_post"
2015
}
2116
}
2217
}
@@ -154,14 +149,10 @@
154149
}
155150
},
156151
{
157-
"name": "verbose",
152+
"name": "verbosity",
158153
"in": "query",
159154
"required": false,
160-
"schema": {
161-
"type": "boolean",
162-
"default": false,
163-
"title": "Verbose"
164-
}
155+
"schema": { "$ref": "#/components/schemas/Verbosity", "default": 0 }
165156
}
166157
],
167158
"responses": {
@@ -249,12 +240,7 @@
249240
"content": {
250241
"application/json": {
251242
"schema": {
252-
"allOf": [
253-
{
254-
"$ref": "#/components/schemas/Body_write_file_api_files__path__post"
255-
}
256-
],
257-
"title": "Body"
243+
"$ref": "#/components/schemas/Body_write_file_api_files__path__post"
258244
}
259245
}
260246
}
@@ -336,12 +322,7 @@
336322
"content": {
337323
"application/json": {
338324
"schema": {
339-
"allOf": [
340-
{
341-
"$ref": "#/components/schemas/Body_write_directory_api_directories__path__post"
342-
}
343-
],
344-
"title": "Body"
325+
"$ref": "#/components/schemas/Body_write_directory_api_directories__path__post"
345326
}
346327
}
347328
}
@@ -402,12 +383,7 @@
402383
"content": {
403384
"application/json": {
404385
"schema": {
405-
"allOf": [
406-
{
407-
"$ref": "#/components/schemas/Body_initiate_plan_api_plan_post"
408-
}
409-
],
410-
"title": "Body"
386+
"$ref": "#/components/schemas/Body_initiate_plan_api_plan_post"
411387
}
412388
}
413389
}
@@ -782,7 +758,13 @@
782758
"description": "Successful Response",
783759
"content": {
784760
"application/json": {
785-
"schema": { "$ref": "#/components/schemas/TableDiff" }
761+
"schema": {
762+
"anyOf": [
763+
{ "$ref": "#/components/schemas/TableDiff" },
764+
{ "type": "null" }
765+
],
766+
"title": "Response Get Table Diff Api Table Diff Get"
767+
}
786768
}
787769
}
788770
},
@@ -890,7 +872,7 @@
890872
"name": { "type": "string", "title": "Name" },
891873
"view_name": { "type": "string", "title": "View Name" },
892874
"node_type": {
893-
"allOf": [{ "$ref": "#/components/schemas/NodeType" }],
875+
"$ref": "#/components/schemas/NodeType",
894876
"default": "model"
895877
},
896878
"parents": {
@@ -917,7 +899,7 @@
917899
"name": { "type": "string", "title": "Name" },
918900
"view_name": { "type": "string", "title": "View Name" },
919901
"node_type": {
920-
"allOf": [{ "$ref": "#/components/schemas/NodeType" }],
902+
"$ref": "#/components/schemas/NodeType",
921903
"default": "model"
922904
},
923905
"parents": {
@@ -1041,7 +1023,7 @@
10411023
"name": { "type": "string", "title": "Name" },
10421024
"view_name": { "type": "string", "title": "View Name" },
10431025
"node_type": {
1044-
"allOf": [{ "$ref": "#/components/schemas/NodeType" }],
1026+
"$ref": "#/components/schemas/NodeType",
10451027
"default": "model"
10461028
},
10471029
"parents": {
@@ -1081,7 +1063,7 @@
10811063
"name": { "type": "string", "title": "Name" },
10821064
"view_name": { "type": "string", "title": "View Name" },
10831065
"node_type": {
1084-
"allOf": [{ "$ref": "#/components/schemas/NodeType" }],
1066+
"$ref": "#/components/schemas/NodeType",
10851067
"default": "model"
10861068
},
10871069
"parents": {
@@ -1102,7 +1084,7 @@
11021084
"name": { "type": "string", "title": "Name" },
11031085
"view_name": { "type": "string", "title": "View Name" },
11041086
"node_type": {
1105-
"allOf": [{ "$ref": "#/components/schemas/NodeType" }],
1087+
"$ref": "#/components/schemas/NodeType",
11061088
"default": "model"
11071089
},
11081090
"parents": {
@@ -1157,22 +1139,6 @@
11571139
"Environment": {
11581140
"properties": {
11591141
"name": { "type": "string", "title": "Name", "default": "prod" },
1160-
"suffix_target": {
1161-
"allOf": [
1162-
{ "$ref": "#/components/schemas/EnvironmentSuffixTarget" }
1163-
],
1164-
"default": "schema"
1165-
},
1166-
"catalog_name_override": {
1167-
"anyOf": [{ "type": "string" }, { "type": "null" }],
1168-
"title": "Catalog Name Override"
1169-
},
1170-
"normalize_name": {
1171-
"type": "boolean",
1172-
"title": "Normalize Name",
1173-
"default": true
1174-
},
1175-
"snapshots": { "items": {}, "type": "array", "title": "Snapshots" },
11761142
"start_at": {
11771143
"anyOf": [
11781144
{ "type": "string", "format": "date" },
@@ -1207,6 +1173,25 @@
12071173
"anyOf": [{ "type": "integer" }, { "type": "null" }],
12081174
"title": "Finalized Ts"
12091175
},
1176+
"suffix_target": {
1177+
"$ref": "#/components/schemas/EnvironmentSuffixTarget",
1178+
"default": "schema"
1179+
},
1180+
"catalog_name_override": {
1181+
"anyOf": [{ "type": "string" }, { "type": "null" }],
1182+
"title": "Catalog Name Override"
1183+
},
1184+
"normalize_name": {
1185+
"type": "boolean",
1186+
"title": "Normalize Name",
1187+
"default": true
1188+
},
1189+
"gateway_managed": {
1190+
"type": "boolean",
1191+
"title": "Gateway Managed",
1192+
"default": false
1193+
},
1194+
"snapshots": { "items": {}, "type": "array", "title": "Snapshots" },
12101195
"promoted_snapshot_ids": {
12111196
"anyOf": [{ "items": {}, "type": "array" }, { "type": "null" }],
12121197
"title": "Promoted Snapshot Ids"
@@ -1224,9 +1209,9 @@
12241209
},
12251210
"additionalProperties": false,
12261211
"type": "object",
1227-
"required": ["snapshots", "start_at", "plan_id"],
1212+
"required": ["start_at", "plan_id", "snapshots"],
12281213
"title": "Environment",
1229-
"description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n start_at: The start time of the environment.\n end_at: The end time of the environment.\n plan_id: The ID of the plan that last updated this environment.\n previous_plan_id: The ID of the previous plan that updated this environment.\n expiration_ts: The timestamp when this environment will expire.\n finalized_ts: The timestamp when this environment was finalized.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted.\n previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.\n requirements: A mapping of library versions for all the snapshots in this environment."
1214+
"description": "Represents an isolated environment.\n\nEnvironments are isolated workspaces that hold pointers to physical tables.\n\nArgs:\n snapshots: The snapshots that are part of this environment.\n promoted_snapshot_ids: The IDs of the snapshots that are promoted in this environment\n (i.e. for which the views are created). If not specified, all snapshots are promoted.\n previous_finalized_snapshots: Snapshots that were part of this environment last time it was finalized.\n requirements: A mapping of library versions for all the snapshots in this environment."
12301215
},
12311216
"EnvironmentSuffixTarget": {
12321217
"type": "string",
@@ -1398,6 +1383,7 @@
13981383
"name": { "type": "string", "title": "Name" },
13991384
"fqn": { "type": "string", "title": "Fqn" },
14001385
"path": { "type": "string", "title": "Path" },
1386+
"full_path": { "type": "string", "title": "Full Path" },
14011387
"dialect": { "type": "string", "title": "Dialect" },
14021388
"type": { "$ref": "#/components/schemas/ModelType" },
14031389
"columns": {
@@ -1435,6 +1421,7 @@
14351421
"name",
14361422
"fqn",
14371423
"path",
1424+
"full_path",
14381425
"dialect",
14391426
"type",
14401427
"columns",
@@ -2061,7 +2048,11 @@
20612048
"type": "object",
20622049
"title": "Stats"
20632050
},
2064-
"sample": { "type": "object", "title": "Sample" },
2051+
"sample": {
2052+
"additionalProperties": true,
2053+
"type": "object",
2054+
"title": "Sample"
2055+
},
20652056
"source_count": { "type": "integer", "title": "Source Count" },
20662057
"target_count": { "type": "integer", "title": "Target Count" },
20672058
"count_pct_change": { "type": "number", "title": "Count Pct Change" }
@@ -2213,7 +2204,7 @@
22132204
"TrackableMeta": {
22142205
"properties": {
22152206
"status": {
2216-
"allOf": [{ "$ref": "#/components/schemas/Status" }],
2207+
"$ref": "#/components/schemas/Status",
22172208
"default": "init"
22182209
},
22192210
"start": { "type": "integer", "title": "Start" },
@@ -2240,6 +2231,12 @@
22402231
"type": "object",
22412232
"required": ["loc", "msg", "type"],
22422233
"title": "ValidationError"
2234+
},
2235+
"Verbosity": {
2236+
"type": "integer",
2237+
"enum": [0, 1, 2],
2238+
"title": "Verbosity",
2239+
"description": "Verbosity levels for SQLMesh output."
22432240
}
22442241
}
22452242
}

web/client/src/models/sqlmesh-model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export class ModelSQLMeshModel<
2525
name: string
2626
fqn: string
2727
path: string
28+
full_path: string
2829
dialect: string
2930
type: ModelType
3031
columns: Column[]
@@ -50,6 +51,7 @@ export class ModelSQLMeshModel<
5051
this.fqn = encodeURI(this.initial.fqn)
5152
this.default_catalog = this.initial.default_catalog
5253
this.path = this.initial.path
54+
this.full_path = this.initial.full_path
5355
this.dialect = this.initial.dialect
5456
this.description = this.initial.description
5557
this.sql = this.initial.sql

web/server/api/endpoints/lineage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async def column_lineage(
146146

147147

148148
@router.get("/{model_name:str}")
149-
async def model_lineage(
149+
def model_lineage(
150150
model_name: str,
151151
context: Context = Depends(get_loaded_context),
152152
) -> t.Dict[str, t.Set[str]]:

web/server/api/endpoints/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def serialize_model(context: Context, model: Model, render_query: bool = False)
125125
name=model.name,
126126
fqn=model.fqn,
127127
path=str(model._path.absolute().relative_to(context.path)),
128+
full_path=str(model._path.absolute()),
128129
dialect=dialect,
129130
columns=columns,
130131
details=details,

web/server/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ class Model(PydanticModel):
172172
name: str
173173
fqn: str
174174
path: str
175+
full_path: str
176+
"""
177+
As opposed to path, which is relative to the project root, full_path is the absolute path to the model file.
178+
"""
175179
dialect: str
176180
type: ModelType
177181
columns: t.List[Column]

0 commit comments

Comments
 (0)