Skip to content

Commit 55be8ae

Browse files
committed
opening extension in right place
registered logging format works making progress making progress sharing node modules creating the docs progress getting react server to show making progress with the server temp get calling api now need to add lineage tab making progress on vscode lineage temp progress: showing the lineage graph [ci skip] cleaning up lineage [ci skip] added ability to open files temp [ci skip] trying to implement lsp [ci skip] temp [ci skip] test [ci skip] temp [ci skip] temp [ci skip]
1 parent 99b34d2 commit 55be8ae

136 files changed

Lines changed: 26976 additions & 80 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846
3+
// for the documentation about the extensions.json format
4+
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher", "ms-vscode.extension-test-runner"]
5+
}

.vscode/launch.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"${workspaceFolder}/examples/sushi",
14+
"--extensionDevelopmentPath=${workspaceFolder}/vscode/extension",
15+
],
16+
"outFiles": [
17+
"${workspaceFolder}/vscode/extension/dist/**/*.js"
18+
],
19+
"preLaunchTask": "${defaultBuildTask}"
20+
}
21+
]
22+
}

.vscode/settings.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"vscode/extension/out": false, // set this to true to hide the "out" folder with the compiled JS files
5+
"vscode/extension/dist": false, // set this to true to hide the "dist" folder with the compiled JS files
6+
"vscode/react/node_modules": false,
7+
"vscode/react/dist": false
8+
},
9+
"search.exclude": {
10+
"vscode/extension/out": true, // set this to false to include "out" folder in search results
11+
"vscode/extension/dist": true, // set this to false to include "dist" folder in search results
12+
"vscode/react/node_modules": true,
13+
"vscode/react/dist": true
14+
},
15+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
16+
"typescript.tsc.autoDetect": "off"
17+
}

.vscode/tasks.json

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "extension-watch",
8+
"type": "npm",
9+
"script": "watch",
10+
"problemMatcher": "$ts-webpack-watch",
11+
"isBackground": true,
12+
"presentation": {
13+
"reveal": "never",
14+
"group": "watchers"
15+
},
16+
"group": {
17+
"kind": "build",
18+
},
19+
"options": {
20+
"cwd": "${workspaceFolder}/vscode/extension"
21+
},
22+
"dependsOn": [
23+
"react-dev"
24+
],
25+
"dependsOrder": "parallel"
26+
},
27+
{
28+
"label": "react-dev",
29+
"script": "dev",
30+
"type": "npm",
31+
"options": {
32+
"cwd": "${workspaceFolder}/vscode/react"
33+
},
34+
"group": {
35+
"kind": "build",
36+
},
37+
"isBackground": true,
38+
"problemMatcher": {
39+
"owner": "npm",
40+
"pattern": {
41+
"regexp": "."
42+
},
43+
"background": {
44+
"activeOnStart": true,
45+
"beginsPattern": ".",
46+
"endsPattern": "."
47+
}
48+
},
49+
"presentation": {
50+
"reveal": "never",
51+
"group": "watchers"
52+
}
53+
},
54+
{
55+
"label": "extension-watch-develop",
56+
"group": {
57+
"kind": "build",
58+
"isDefault": true
59+
},
60+
"dependsOn": ["react-dev", "extension-watch"],
61+
"dependsOrder": "parallel",
62+
},
63+
{
64+
"type": "npm",
65+
"script": "watch-tests",
66+
"problemMatcher": "$tsc-watch",
67+
"isBackground": true,
68+
"presentation": {
69+
"reveal": "never",
70+
"group": "watchers"
71+
},
72+
"group": "build",
73+
"options": {
74+
"cwd": "${workspaceFolder}/vscode"
75+
}
76+
},
77+
{
78+
"label": "tasks: watch-tests",
79+
"dependsOn": [
80+
"npm: watch",
81+
"npm: watch-tests"
82+
],
83+
"problemMatcher": []
84+
}
85+
]
86+
}

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ clickhouse-cloud-test: guard-CLICKHOUSE_CLOUD_HOST guard-CLICKHOUSE_CLOUD_USERNA
175175
athena-test: guard-AWS_ACCESS_KEY_ID guard-AWS_SECRET_ACCESS_KEY guard-ATHENA_S3_WAREHOUSE_LOCATION engine-athena-install
176176
pytest -n auto -x -m "athena" --retries 3 --retry-delay 10 --junitxml=test-results/junit-athena.xml
177177

178+
<<<<<<< HEAD
178179
vscode_settings:
179180
mkdir -p .vscode
180181
cp -r ./tooling/vscode/*.json .vscode/
182+
=======
183+
184+
vscode-generate-openapi:
185+
python3 vscode/server/openapi.py
186+
cd vscode/react && npm run generate:api
187+
>>>>>>> f006bdac (get calling api now need to add lineage tab)

docs/development.md

Lines changed: 118 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
# Contribute to development
2-
SQLMesh is licensed under [Apache 2.0](https://github.com/TobikoData/sqlmesh/blob/main/LICENSE). We encourage community contribution and would love for you to get involved.
2+
3+
SQLMesh is licensed under [Apache 2.0](https://github.com/TobikoData/sqlmesh/blob/main/LICENSE). We encourage community contribution and would love for you to get involved. The following document outlines the process to contribute to SQLMesh.
34

45
## Prerequisites
6+
7+
Before you begin, ensure you have the following installed on your machine. Exacltly how to install these is dependent on your operating system.
8+
59
* Docker
610
* Docker Compose V2
711
* OpenJDK >= 11
812
* Python >= 3.9 < 3.13
913

10-
## Commands reference
14+
## Virtual environment setup
15+
16+
We do recommend using a virtual environment to develop SQLMesh.
17+
18+
```bash
19+
python -m venv .venv
20+
source .venv/bin/activate
21+
```
22+
23+
Once you have activated your virtual environment, you can install the dependencies by running the following command.
1124

12-
Install dev dependencies:
1325
```bash
1426
make install-dev
1527
```
28+
<<<<<<< HEAD
1629
Run linters and formatters:
1730
```bash
1831
make style
@@ -42,6 +55,108 @@ Run ide:
4255
make ui-up
4356
```
4457
(Optional) Use pre-commit to automatically run linters/formatters:
58+
=======
59+
60+
Optionally, you can use pre-commit to automatically run linters/formatters:
61+
62+
>>>>>>> 61520e5a (creating the docs)
4563
```bash
4664
make install-pre-commit
4765
```
66+
67+
## Python development
68+
69+
Run linters and formatters:
70+
71+
```bash
72+
make style
73+
```
74+
75+
Run faster tests for quicker local feedback:
76+
77+
```bash
78+
make fast-test
79+
```
80+
81+
Run more comprehensive tests that run on each commit:
82+
83+
```bash
84+
make slow-test
85+
```
86+
87+
Run Airflow tests that will run when PR is merged to main:
88+
89+
```bash
90+
make airflow-docker-test-with-env
91+
```
92+
93+
## Documentation
94+
95+
In order to run the documentation server, you will need to install the dependencies by running the following command.
96+
97+
```bash
98+
make install-doc
99+
```
100+
101+
Once you have installed the dependencies, you can run the documentation server by running the following command.
102+
103+
```bash
104+
make docs-serve
105+
```
106+
107+
Run docs tests:
108+
109+
```bash
110+
make doc-test
111+
```
112+
113+
## UI development
114+
115+
In addition to the Python development, you can also develop the UI.
116+
117+
The UI is built using React and Typescript. To run the UI, you will need to install the dependencies by running the following command.
118+
119+
```bash
120+
npm install
121+
```
122+
123+
Run ide:
124+
125+
```bash
126+
make ui-up
127+
```
128+
129+
## Developing the VSCode extension
130+
131+
Developing the VSCode extension is most easily done by launching the debug process from a visual studio code workspace.
132+
133+
By default, the VSCode extension will run the SQLMesh server locally and open a new visual studio code window that allows you to try out the SQLMesh IDE. It by default opens the `examples/sushi` project.
134+
135+
Please see the below diagram for a high level overview of the UI.
136+
137+
```mermaid
138+
graph TD
139+
A[VSCode Extension] --> |start server| B[SQLMesh Server]
140+
A --> |creates webviews| C[Webviews]
141+
C --> |reads react webpages from| B
142+
A --> |calls lsp| B
143+
React[React App] --> |embedded in| B
144+
```
145+
146+
For development purposes, the React app is not embedded into the python server. Instead a separate instance of the React app is run. This allows you to make changes to the UI and see them immediately.
147+
148+
This makes the architecture diagram at development time look like the following.
149+
150+
```mermaid
151+
graph TD
152+
A[VSCode Extension] --> |start server| B[SQLMesh Server]
153+
A --> |creates webviews| C[Webviews]
154+
React [React Server] --> |passes on api requests| B
155+
C --> |reads react webpages from| React
156+
```
157+
158+
In development mode, the React app is not embedded into the python server. Instead a separate instance of the React app is run. This allows you to make changes to the UI and see them immediately.
159+
160+
The React App runs on the port 5173. The VSCode extension will automatically open the React app in a new tab.
161+
The python server will run on the port 5174.
162+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": true
3+
}

examples/sushi/audits/assert_item_price_above_zero.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ AUDIT (
66

77
SELECT *
88
FROM sushi.items
9-
WHERE price <= 0
9+
WHERE price <= 0

examples/sushi/audits/items.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
AUDIT (
22
name assert_items_price_exceeds_threshold
33
);
4-
SELECT *
5-
FROM @this_model
6-
WHERE price <= @price;
74

5+
SELECT
6+
*
7+
FROM @this_model
8+
WHERE
9+
price <= @price

examples/sushi/audits/order_items.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ AUDIT (
22
name assert_order_items_quantity_exceeds_threshold
33
);
44

5-
SELECT *
5+
SELECT
6+
*
67
FROM @this_model
7-
WHERE quantity <= @quantity
8+
WHERE
9+
quantity <= @quantity

0 commit comments

Comments
 (0)