Skip to content

Commit 30aad27

Browse files
authored
Docs: Trey edits to vscode guide (#4428)
1 parent 860e9ea commit 30aad27

5 files changed

Lines changed: 98 additions & 51 deletions

File tree

docs/installation.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,24 @@ pip install sqlmesh
2424
```
2525

2626
## Install extras
27-
Some SQLMesh functionality requires additional Python libraries.
27+
Some SQLMesh functionality requires additional Python libraries, which are bundled with SQLMesh via "extras".
2828

29-
`pip` will automatically install them for you if you specify the relevant name in brackets. For example, you install the SQLMesh browser UI extras with `pip install "sqlmesh[web]"`.
29+
In your `pip` command, specify the extra's name in brackets to automatically install the additional libraries. For example, you install the SQLMesh Github CI/CD bot extras with `pip install "sqlmesh[github]"`.
3030

31-
Some extras add features, like the SQLMesh browser UI or Github CI/CD bot:
31+
There are two types of extras.
32+
33+
Some extras add features, like the SQLMesh VSCode extension or Github CI/CD bot:
3234

3335
??? info "Feature extras commands"
3436
| Feature | `pip` command |
3537
| ------------------- | ------------------------------- |
36-
| Browser UI | `pip install "sqlmesh[web]"` |
38+
| VSCode extension | `pip install "sqlmesh[lsp]"` |
39+
| Github CI/CD bot | `pip install "sqlmesh[github]"` |
3740
| dbt projects | `pip install "sqlmesh[dbt]"` |
3841
| dlt projects | `pip install "sqlmesh[dlt]"` |
39-
| Github CI/CD bot | `pip install "sqlmesh[github]"` |
4042
| Slack notifications | `pip install "sqlmesh[slack]"` |
4143
| Development setup | `pip install "sqlmesh[dev]"` |
44+
| Browser UI | `pip install "sqlmesh[web]"` |
4245
| LLM SQL prompt | `pip install "sqlmesh[llm]"` |
4346

4447
Other extras are required to use specific SQL engines, like Bigquery or Postgres:
@@ -47,6 +50,7 @@ Other extras are required to use specific SQL engines, like Bigquery or Postgres
4750
| SQL engine | `pip` command |
4851
| ------------- | ------------------------------------ |
4952
| Athena | `pip install "sqlmesh[athena]"` |
53+
| Azure SQL | `pip install "sqlmesh[azuresql]"` |
5054
| Bigquery | `pip install "sqlmesh[bigquery]"` |
5155
| ClickHouse | `pip install "sqlmesh[clickhouse]"` |
5256
| Databricks | `pip install "sqlmesh[databricks]"` |
@@ -55,10 +59,11 @@ Other extras are required to use specific SQL engines, like Bigquery or Postgres
5559
| MySQL | `pip install "sqlmesh[mysql]"` |
5660
| Postgres | `pip install "sqlmesh[postgres]"` |
5761
| Redshift | `pip install "sqlmesh[redshift]"` |
62+
| RisingWave | `pip install "sqlmesh[risingwave]"` |
5863
| Snowflake | `pip install "sqlmesh[snowflake]"` |
5964
| Trino | `pip install "sqlmesh[trino]"` |
6065

61-
Multiple extras can be installed at once, as in `pip install "sqlmesh[web,slack]"`.
66+
Multiple extras can be installed at once, as in `pip install "sqlmesh[github,slack]"`.
6267

6368
## Next steps
6469

docs/quickstart/vscode.md

Lines changed: 85 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,112 +2,153 @@
22

33
!!! danger "Preview"
44

5-
The extension is currently in preview and as such is subject to change. You may encounter bugs and API incompatibilities with the SQLMesh version you are running. We encourage you to try it and raise any issues [here](https://github.com/tobikodata/sqlmesh/issues).
5+
The SQLMesh Visual Studio Code extension is in preview and undergoing active development. You may encounter bugs or API incompatibilities with the SQLMesh version you are running.
66

7-
In this quickstart guide, you'll set up the SQLMesh extension in Visual Studio Code. We'll show you the capabilities of the extension and how to troubleshoot common issues.
7+
We encourage you to try the extension and [create Github issues](https://github.com/tobikodata/sqlmesh/issues) for any problems you encounter.
8+
9+
In this guide, you'll set up the SQLMesh extension in the Visual Studio Code IDE software (which we refer to as "VSCode").
10+
11+
We'll show you the capabilities of the extension and how to troubleshoot common issues.
812

913
## Installation
1014

11-
Installation is done through the official [marketplace](https://marketplace.visualstudio.com/items?itemName=tobikodata.sqlmesh) or by searching for `SQLMesh` in the "Extensions" tab of Visual Studio Code.
15+
### VSCode extension
16+
17+
Install the extension through the official Visual Studio [marketplace website](https://marketplace.visualstudio.com/items?itemName=tobikodata.sqlmesh) or by searching for `SQLMesh` in the VSCode "Extensions" tab.
1218

13-
For further guidance on how to install extensions, see the [relevant Visual Studio Code documentation](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_install-an-extension).
19+
Learn more about installing VSCode extensions in the [official documentation](https://code.visualstudio.com/docs/configure/extensions/extension-marketplace#_install-an-extension).
1420

15-
### Recommended setup
21+
### Python setup
1622

17-
While installing the extension is simple, setting up a Python environment correctly is a bit more involved. We do recommend using a dedicated *Python virtual environment* to install SQLMesh. For a complete guide, visit the [Python documentation](https://docs.python.org/3/library/venv.html), but the following steps will create the virtual environment, activate it, and install SQLMesh for both a SQLMesh core setup and a Tobiko Cloud setup.
23+
While installing the extension is simple, setting up and configuring a Python environment in VSCode is a bit more involved.
1824

19-
#### SQLMesh Core
25+
We recommend using a dedicated *Python virtual environment* to install SQLMesh. Visit the [Python documentation](https://docs.python.org/3/library/venv.html) for more information about virtual environments.
2026

21-
For SQLMesh core, you can create a virtual environment, activate it and install SQLMesh as follows:
27+
We describe the steps to create and activate a virtual environment below, but additional information is available on the [SQLMesh installation page](installation.md).
28+
29+
We first install the SQLMesh library, which is required by the extension.
30+
31+
Open a terminal instance in your SQLMesh project's directory and issue this command to create a virtual environment in the `.venv` directory:
2232

2333
```bash
2434
python -m venv .venv
25-
source .venv/bin/activate
26-
pip install 'sqlmesh[lsp]'
2735
```
2836

29-
Once you have the virtual environment, you can ensure that Visual Studio Code is using the correct Python interpreter by going to the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and running `Python: Select Interpreter`. Select the Python executable in the virtual environment.
37+
Next, activate the virtual environment:
3038

31-
![Select interpreter](./vscode/select_interpreter.png)
39+
```bash
40+
source .venv/bin/activate
41+
```
3242

33-
Once that's done, you can validate that the extension is correctly using the virtual environment by checking the `sqlmesh` output channel in the [output panel](https://code.visualstudio.com/docs/getstarted/userinterface#_output-panel), which details the Python path and the details of your SQLMesh installation and looks as follows:
43+
#### Open-source SQLMesh
3444

35-
![Output panel](./vscode/interpreter_details.png)
45+
If you are using open-source SQLMesh, install SQLMesh with the `lsp` extra that enables the VSCode extension (learn more about SQLMesh extras [here](installation.md#install-extras)):
46+
47+
```bash
48+
pip install 'sqlmesh[lsp]'
49+
```
3650

3751
#### Tobiko Cloud
3852

39-
For Tobiko Cloud, the `tcloud` utility is used to install SQLMesh, so you'll need to set up a Python environment, activate it, and install SQLMesh using the tcloud utility as follows.
53+
If you are using Tobiko Cloud, the `tcloud` library will install SQLMesh for you.
54+
55+
First, follow the [Python setup](#python-setup) steps above to create and activate a Python environment. Next, install `tcloud`:
4056

4157
```bash
42-
python -m venv .venv
43-
source .venv/bin/activate
4458
pip install tcloud
4559
```
4660

47-
Once you have the virtual environment, you can ensure that Visual Studio Code is using the correct Python interpreter by going to the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and running `Python: Select Interpreter`. Select the Python executable in the virtual environment.
61+
Finally, add the `lsp` extra to your `tcloud.yml` configuration file, as described [here](../cloud/tcloud_getting_started.md#connect-tobiko-cloud-to-data-warehouse).
62+
63+
### VSCode Python interpreter
64+
65+
A Python virtual environment contains its own copy of Python (the "Python interpreter"). We need to make sure VSCode is using your virtual environment's interpreter rather than a system-wide or other interpreter that does not have access to the SQLMesh library we just installed.
66+
67+
Confirm that VSCode is using the correct interpreter by going to the [command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) and clicking `Python: Select Interpreter`. Select the Python executable that's in the virtual environment's directory `.venv`.
4868

4969
![Select interpreter](./vscode/select_interpreter.png)
5070

51-
You can use the `tcloud` commands in your terminal to perform operations as usual, or the extension exposes the same commands through the command palette under the following commands:
52-
- `Sign in to Tobiko Cloud`
53-
- `Sign out of Tobiko Cloud`
71+
Once that's done, validate that the everything is working correctly by checking the `sqlmesh` channel in the [output panel](https://code.visualstudio.com/docs/getstarted/userinterface#_output-panel). It displays the Python interpreter path and details of your SQLMesh installation:
5472

55-
## Features
73+
![Output panel](./vscode/interpreter_details.png)
5674

57-
### Lineage
75+
## Features
5876

59-
The extension adds a lineage view to SQLMesh models. To view the lineage of a model, use the `Lineage` tab in the panel as shown below:
77+
SQLMesh's VSCode extension makes it easy to edit and understand your SQLMesh project with these features:
6078

61-
![Lineage view](./vscode/lineage.png)
79+
- Lineage
80+
- Interactive view of model lineage
81+
- Editor
82+
- Auto-completion for model names and SQLMesh keywords
83+
- Model summaries when hovering over model references
84+
- Links to open model files from model references
85+
- Inline SQLMesh linter diagnostics
86+
- VSCode commands
87+
- Format SQLMesh project files
88+
- Sign in/out of Tobiko Cloud (Tobiko Cloud users only)
6289

63-
### Commands
90+
### Lineage
6491

65-
The extension exposes the following commands through the command palette:
92+
The extension adds a lineage view to SQLMesh models. To view the lineage of a model, go to the `Lineage` tab in the panel:
6693

67-
- `Sign in to Tobiko Cloud`
68-
- `Sign out of Tobiko Cloud`
69-
- `Format SQLMesh project`
94+
![Lineage view](./vscode/lineage.png)
7095

71-
### LSP Features
96+
### Editor
7297

73-
The SQLMesh LSP adds several features to the editor:
98+
The SQLMesh VSCode extension includes several features that make editing SQLMesh models easier and quicker:
7499

75100
**Completion**
76101

77-
When writing SQL models, keywords, or model names, you should see completion suggestions.
102+
See auto-completion suggestions when writing SQL models, keywords, or model names.
78103

79104
![Completion](./vscode/autocomplete.png)
80105

81106
**Go to definition and hover information**
82107

83-
The SQLMesh LSP adds a definition provider for SQLMesh models. When you hover over a model name, you should see a tooltip with the model description, and when you click, you will be taken to the model definition.
108+
Hovering over a model name shows a tooltip with the model description. Clicking the model name opens the file containing the model definition.
84109

85110
**Diagnostics**
86111

87-
The SQLMesh LSP adds a diagnostic provider for your SQLMesh project. If you have the SQLMesh linter enabled, issues will be reported in your editor. This works for both SQLMesh built-in rules and custom rules.
112+
If you have the [SQLMesh linter](../guides/linter.md) enabled, issues are reported directly in your editor. This works for both SQLMesh's built-in linter rules and custom linter rules.
88113

89114
![Diagnostics](./vscode/diagnostics.png)
90115

91116
**Formatting**
92117

93-
The SQLMesh LSP also adds a formatting provider for SQLMesh models. When you write SQL models, you can use the formatter to format models consistently.
118+
SQLMesh's model formatting tool is integrated directly into the editor, so it's easy to format models consistently.
119+
120+
### Commands
121+
122+
The SQLMesh VSCode extension provides the following commands in the VSCode command palette:
123+
124+
- `Format SQLMesh project`
125+
- `Sign in to Tobiko Cloud` (Tobiko Cloud users only)
126+
- `Sign out of Tobiko Cloud` (Tobiko Cloud users only)
94127

95128
## Troubleshooting
96129

97-
### LSP extensions
130+
### Python environment woes
131+
132+
The most common problem is the extension not using the correct Python interpreter.
133+
134+
Follow the [setup process described above](#vscode-python-interpreter) to ensure that the extension is using the correct Python interpreter.
135+
136+
If you have checked the VSCode `sqlmesh` output channel and the extension is still not using the correct Python interpreter, please raise an issue [here](https://github.com/tobikodata/sqlmesh/issues).
137+
138+
### Missing Python dependencies
98139

99-
When installing SQLMesh, some dependencies that are required by the extension are not installed by default. You can install them by running the following command in your terminal. Specifying the `[lsp]` flag will install the dependencies required by the extension.
140+
When installing SQLMesh, some dependencies required by the VSCode extension are not installed unless you specify the `lsp` "extra".
141+
142+
If you are using open-source SQLMesh, install the `lsp` extra by running this command in your terminal:
100143

101144
```bash
102145
pip install 'sqlmesh[lsp]'
103146
```
104147

105-
If you are in a cloud environment, you can ensure the extension requirements are correctly installed by adding `lsp` to the list of extras required in the `tcloud.yaml` file.
106-
107-
### Python environment woes
108-
109-
The most common issue is that the extension is not using the correct Python interpreter. We recommend following the [recommended setup](#recommended-setup) to ensure that the extension is using the correct Python interpreter. If you have checked the `sqlmesh` output channel and the extension is still not using the correct Python interpreter, please raise an issue [here](https://github.com/tobikodata/sqlmesh/issues).
148+
If you are using Tobiko Cloud, make sure `lsp` is included in the list of extras specified in the [`tcloud.yaml` configuration file](../cloud/tcloud_getting_started.md#connect-tobiko-cloud-to-data-warehouse).
110149

111150
### SQLMesh compatibility
112151

113-
While the extension is in preview and the APIs to the underlying SQLMesh version are not stable, we do not guarantee compatibility between the extension and the SQLMesh version you are using. If you encounter an issue, please raise an issue [here](https://github.com/tobikodata/sqlmesh/issues).
152+
While the SQLMesh VSCode extension is in preview and the APIs to the underlying SQLMesh version are not stable, we do not guarantee compatibility between the extension and the SQLMesh version you are using.
153+
154+
If you encounter a problem, please raise an issue [here](https://github.com/tobikodata/sqlmesh/issues).
-395 Bytes
Loading

docs/quickstart/vscode/lineage.png

-19.8 KB
Loading

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ nav:
3030
- guides/testing.md
3131
- guides/model_selection.md
3232
- SQLMesh tools:
33-
- guides/ui.md
33+
- quickstart/vscode.md
3434
- guides/tablediff.md
3535
- guides/linter.md
36+
- guides/ui.md
3637
- guides/observer.md
3738
- Advanced usage:
3839
- guides/customizing_sqlmesh.md

0 commit comments

Comments
 (0)