DynoTable for Zed
The DynoTable extension lets you write SQL and PartiQL queries in Zed and run them against the tables and indices of a DynoTable profile.
The DynoTable desktop app on the same computer serves the language features from your real schemas and runs the queries. The language is the same as in DynoTable for VS Code.
What you need
- macOS (Apple silicon or Intel), Linux x64 or Windows x64.
- DynoTable 1.20.0 or later, installed on the same computer.
- Editor integration switched on in the app. It is off by default.
The extension uses dynotable-lsp from your PATH. When dynotable-lsp is not on your PATH,
the extension installs the latest dynotable-cli from npm. Intel Macs need dynotable-cli 0.1.2
or later. See Install dynotable-cli.
Turn on Editor integration
- Open DynoTable.
- Go to Settings → Editor integration.
- Switch on Editor integration.
You do this one time. When DynoTable is not running, a start of the language server starts DynoTable with no window.
Install the extension
In Zed, open the Extensions panel, search for DynoTable and install it.
Query files
| File | Language |
|---|---|
*.dtsql | DynoTable SQL, over tables and indices |
*.dynotable.sql | DynoTable SQL, over tables and indices |
*.partiql | DynamoDB PartiQL |
The extension does not attach to plain .sql files. To query DynoTable from a .sql file, rename
it to *.dynotable.sql.
Pick a profile
A connection uses one DynoTable profile. To pick it, put a .dynotable.json
file in the root of your project:
{"profile": "dev"}The value is a profile id or slug. With no .dynotable.json, DynoTable uses your profile when you
have exactly one.
What the extension does
- Completion from your real table schemas.
- Diagnostics.
- Hover.
- Formatting.
- Rename of table aliases.
- Inlay hints, when you switch them on. Set
"inlay_hints": {"enabled": true}in your Zed settings. - A ▶ in the gutter next to each statement, which runs the statement.
Run a statement
Click the ▶ in the gutter next to a statement. Zed saves the file and runs the task "DynoTable: Run statement". The terminal panel shows the statement that ran and its rows as a table, with a summary line under the table.
Run needs dynotable-cli 0.1.2 or later. With an older version, the task tells you to update it.
Run uses dynotable-lsp from your PATH. When it is not on your PATH, Run uses the copy that
the extension installed. That copy needs Node.js: Run uses Node.js from your PATH, else the
Node.js that Zed downloaded. When Run cannot start dynotable-lsp, it tells you to install
Node.js or dynotable-cli.
Open your project folder in Zed, not a single file. Run starts in the project root.
Run uses the profile of .dynotable.json in the root of your project, else your only profile. It
does not read initialization_options from your Zed settings. See Pick a profile.
Run a statement that has no ▶
Some statements get no ▶, for example statements after a PartiQL INSERT that Zed's SQL grammar
does not parse. Put the cursor in the statement and run "task: spawn", then pick
"DynoTable: Run statement".
To give the task a key, run "zed: open keymap file" and add:
{
"context": "Editor && mode == full",
"bindings": {
"ctrl-alt-q": ["task::Spawn", {"task_name": "DynoTable: Run statement"}]
}
}Use a key that is free in your keymap.
Run on Windows
On Windows, the ▶ does not work, because the task needs sh. Install the CLI with
npm install -g dynotable-cli, run "zed: open tasks" and add a task of your own:
[
{
"label": "DynoTable: Run statement (Windows)",
"command": "dynotable-lsp run --zed",
"cwd": "$ZED_WORKTREE_ROOT"
}
]Then run it with "task: spawn".
Writes go through the app
DynoTable SQL is read-only, as in the SQL Workbench.
A PartiQL write does not run from the editor. Make writes in DynoTable, where staging holds the change for review.
What runs on your plan
The extension is free. What runs depends on your DynoTable license, as in the app:
- Free (signed in): completion, diagnostics and PartiQL
SELECTstatements. - Trial or paid: running SQL statements, as in the SQL Workbench.
- Signed out: nothing. Sign in to DynoTable.
See Activation for the license states.
What does not work
- OpenSearch files (
.opensearch). They are not supported yet. - Plain
.sqlfiles. The extension attaches only to the query files. - PartiQL writes. Make them in DynoTable.
- A file with a syntax error has no statements to run.
- On a row where one statement is inside another, Zed can show two ▶.
- The ▶ on Windows. Use a task of your own.
- Platforms other than macOS, Linux x64 and Windows x64.
dynotable-lsphas no binary for them yet.
After you quit DynoTable
Zed shows the language server as stopped, and Zed does not start it again. To get the features back:
- Start DynoTable.
- Run "editor: restart language server".
The extension's source is on GitHub under the MIT license.