Skip to content

Commit 40fe492

Browse files
authored
release sql mode and update docs (#6666)
## 📝 Summary <!-- Provide a concise summary of what this pull request is addressing. If this PR fixes any issues, list them here by number (e.g., Fixes #123). --> By default works for internal duckdb engine so is safe for release. Some docs update too: <img src="https://github.com/user-attachments/assets/dcbd9916-0db0-4074-a147-727a797f0576" width="600" /> ## 🔍 Description of Changes <!-- Detail the specific changes made in this pull request. Explain the problem addressed and how it was resolved. If applicable, provide before and after comparisons, screenshots, or any relevant details to help reviewers understand the changes easily. --> ## 📋 Checklist - [x] I have read the [contributor guidelines](https://github.com/marimo-team/marimo/blob/main/CONTRIBUTING.md). - [ ] For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on [Discord](https://marimo.io/discord?ref=pr), or the community [discussions](https://github.com/marimo-team/marimo/discussions) (Please provide a link if applicable). - [x] I have added tests for the changes made. - [x] I have run the code and verified that it works as expected.
1 parent f6a4cd3 commit 40fe492

File tree

12 files changed

+45
-20
lines changed

12 files changed

+45
-20
lines changed
23 KB
Loading

docs/_static/docs-sql-linter.webp

112 KB
Loading
583 KB
Binary file not shown.

docs/guides/debugging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ step through the code, and evaluate expressions.
1111

1212
Here's an example of how to use `breakpoint()` in a marimo notebook cell.
1313

14-
![PDB in marimo](/_static/docs-pdb-demo.png)
14+
![PDB in marimo](../_static/docs-pdb-demo.png)
1515

1616
Type `help` in the debugger for a list of commands:
1717

@@ -92,7 +92,7 @@ When interacting with the AI chat, you can reference the notebook "Errors" with
9292
the `@-symbol` to bring in comprehensive error information from your notebook,
9393
making it easier to get targeted debugging help.
9494

95-
![Notebook Errors context in marimo](/_static/docs-notebook-errors-context.png)
95+
![Notebook Errors context in marimo](../_static/docs-notebook-errors-context.png)
9696

9797
### Best practices for AI-assisted debugging
9898

docs/guides/editor_features/ai_completion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,11 @@ To set up Windsurf:
176176
2. Download the [Windsurf app](https://windsurf.com/download).
177177
3. After installing Windsurf and authenticating, open up the command palette, via <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>p</kbd>, and ask it to copy the api key to your clipboard.
178178

179-
![Copy Windsurf API key](/_static/windsurf-api.png)
179+
![Copy Windsurf API key](../../_static/windsurf-api.png)
180180

181181
4a. Configure the UI settings in the editor to use Windsurf.
182182

183-
![Paste Windsurf API key](/_static/windsurf-settings.png)
183+
![Paste Windsurf API key](../../_static/windsurf-settings.png)
184184

185185
4b. Alternatively you can also configure the api key from the marimo config file.
186186

docs/guides/working_with_data/sql.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,44 @@ df = catalog.load_table(("my-namespace", "my-table")).to_polars()
359359
SUMMARIZE df;
360360
```
361361

362+
## Utilities
363+
364+
marimo provides a few utilities when working with SQL
365+
366+
**SQL Linter**
367+
368+
Lint your SQL code and provide better autocompletions and error highlighting.
369+
370+
<div align="center">
371+
<figure>
372+
<img width="600" src="/_static/docs-sql-linter.webp"/>
373+
</figure>
374+
</div>
375+
376+
To disable the linter, you can set the `sql_linter` configuration to `false` in your `pyproject.toml` file or disable it in the marimo editor's settings menu.
377+
378+
**SQL Formatting**
379+
380+
Click on the paint roller icon at the bottom right of the SQL cell to format your SQL code.
381+
382+
<div align="center">
383+
<figure>
384+
<img width="300" src="/_static/docs-sql-format-icon.webp"/>
385+
</figure>
386+
</div>
387+
388+
**SQL Mode**
389+
390+
For In-Memory DuckDB, marimo offers a Validate mode that will validate your SQL as you write it.
391+
392+
<figure>
393+
<video autoplay muted loop playsinline width="600px" align="center">
394+
<source src="/_static/docs-sql-validate-mode.mp4" type="video/mp4">
395+
</video>
396+
</figure>
397+
398+
Under the hood, this runs a debounced query in EXPLAIN mode and returns the parsed errors.
399+
362400
## Interactive tutorial
363401

364402
For an interactive tutorial, run

frontend/src/core/codemirror/language/languages/sql/sql.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import type {
2626
DiagnosticsConfig,
2727
LSPConfig,
2828
} from "@/core/config/config-schema";
29-
import { getFeatureFlag } from "@/core/config/feature-flag";
3029
import {
3130
dataSourceConnectionsAtom,
3231
setLatestEngineSelected,
@@ -88,11 +87,7 @@ export class SQLLanguageAdapter
8887
sqlModeEnabled: boolean;
8988

9089
constructor() {
91-
try {
92-
this.sqlModeEnabled = getFeatureFlag("sql_mode");
93-
} catch {
94-
this.sqlModeEnabled = false;
95-
}
90+
this.sqlModeEnabled = true;
9691
}
9792

9893
get defaultMetadata(): SQLLanguageAdapterMetadata {

frontend/src/core/codemirror/language/panel/panel.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Button } from "@/components/ui/button";
55
import { Checkbox } from "@/components/ui/checkbox";
66
import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
77
import { normalizeName } from "@/core/cells/names";
8-
import { getFeatureFlag } from "@/core/config/feature-flag";
98
import { type ConnectionName, DUCKDB_ENGINE } from "@/core/datasets/engines";
109
import { useAutoGrowInputProps } from "@/hooks/useAutoGrowInputProps";
1110
import { formatSQL } from "../../format";
@@ -71,8 +70,6 @@ export const LanguagePanelComponent: React.FC<{
7170
updateSQLDialectFromConnection(view, engine);
7271
};
7372

74-
const sqlModeEnabled = getFeatureFlag("sql_mode");
75-
7673
actions = (
7774
<div className="flex flex-1 gap-2 items-center">
7875
<label className="flex gap-2 items-center">
@@ -98,9 +95,7 @@ export const LanguagePanelComponent: React.FC<{
9895
onChange={switchEngine}
9996
/>
10097
<div className="flex items-center gap-2 ml-auto">
101-
{sqlModeEnabled && metadata.engine === DUCKDB_ENGINE && (
102-
<SQLModeSelect />
103-
)}
98+
{metadata.engine === DUCKDB_ENGINE && <SQLModeSelect />}
10499
<Tooltip content="Format SQL">
105100
<Button
106101
variant="text"

frontend/src/core/config/feature-flag.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export interface ExperimentalFeatures {
1212
performant_table_charts: boolean;
1313
chat_modes: boolean;
1414
external_agents: boolean;
15-
sql_mode: boolean;
1615
// Add new feature flags here
1716
}
1817

@@ -23,7 +22,6 @@ const defaultValues: ExperimentalFeatures = {
2322
performant_table_charts: false,
2423
chat_modes: false,
2524
external_agents: import.meta.env.DEV,
26-
sql_mode: false,
2725
};
2826

2927
export function getFeatureFlag<T extends keyof ExperimentalFeatures>(

marimo/_config/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ class ExperimentalConfig(TypedDict, total=False):
513513
rtc_v2: bool
514514
performant_table_charts: bool
515515
chat_modes: bool
516-
sql_mode: bool
517516

518517
# Internal features
519518
cache: CacheConfig

0 commit comments

Comments
 (0)