Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

preview: Improved SQL completions, linting, and hover (#5938)

Shahmir Varqha151dbe042549
diff --git a/frontend/package.json b/frontend/package.json
index a6f3fe2719..798d647b94 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -53,6 +53,7 @@
"@marimo-team/codemirror-languageserver": "^1.15.24",
"@marimo-team/codemirror-mcp": "^0.1.5",
"@marimo-team/llm-info": "workspace:*",
+ "@marimo-team/codemirror-sql": "^0.1.3",
"@marimo-team/marimo-api": "workspace:*",
"@marimo-team/react-slotz": "^0.2.0",
"@mui/material": "^6.4.12",
@@ -170,7 +171,7 @@
"start": "vite",
"dev": "vite",
"build:watch": "vite build --watch --outDir ../marimo/_static",
- "build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 vite build",
+ "build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build",
"test": "vitest",
"typecheck": "tsc",
"lint": "run-s lint:biome lint:eslint lint:stylelint",
diff --git a/frontend/src/components/app-config/user-config-form.tsx b/frontend/src/components/app-config/user-config-form.tsx
index cc185141a4..eb98283a9e 100644
--- a/frontend/src/components/app-config/user-config-form.tsx
+++ b/frontend/src/components/app-config/user-config-form.tsx
@@ -1254,6 +1254,31 @@ export const UserConfigForm: React.FC = () => {
</div>
)}
/>
+ <FormField
+ control={form.control}
+ name="experimental.sql_linter"
+ render={({ field }) => (
+ <div className="flex flex-col gap-y-1">
+ <FormItem className={formItemClasses}>
+ <FormLabel className="font-normal">SQL Linter</FormLabel>
+ <FormControl>
+ <Checkbox
+ data-testid="sql-linter-checkbox"
+ checked={field.value === true}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </FormItem>
+ <IsOverridden
+ userConfig={config}
+ name="experimental.sql_linter"
+ />
+ <FormDescription>
+ Enable experimental SQL linting and autocompletion.
+ </FormDescription>
+ </div>
+ )}
+ />
</SettingGroup>
);
}
diff --git a/frontend/src/components/chat/markdown-renderer.tsx b/frontend/src/components/chat/markdown-renderer.tsx
index 173535d42a..433a9c4e88 100644
--- a/frontend/src/components/chat/markdown-renderer.tsx
+++ b/frontend/src/components/chat/markdown-renderer.tsx
@@ -12,7 +12,7 @@ import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
import { useCellActions } from "@/core/cells/cells";
import { useLastFocusedCellId } from "@/core/cells/focus";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql/sql";
import { autoInstantiateAtom } from "@/core/config/config";
import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
import { useTheme } from "@/theme/useTheme";
diff --git a/frontend/src/components/editor/ai/add-cell-with-ai.tsx b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
index 1b333d1834..03eacc1d78 100644
--- a/frontend/src/components/editor/ai/add-cell-with-ai.tsx
+++ b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
@@ -37,7 +37,7 @@ import {
import { toast } from "@/components/ui/use-toast";
import { resourceExtension } from "@/core/codemirror/ai/resources";
import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
-import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql/sql";
import { useRuntimeManager } from "@/core/runtime/config";
import { type ResolvedTheme, useTheme } from "@/theme/useTheme";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/editor/cell/CreateCellButton.tsx b/frontend/src/components/editor/cell/CreateCellButton.tsx
index 455dfd5786..e3100e0644 100644
--- a/frontend/src/components/editor/cell/CreateCellButton.tsx
+++ b/frontend/src/components/editor/cell/CreateCellButton.tsx
@@ -10,7 +10,7 @@ import {
import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
import { useCellActions } from "@/core/cells/cells";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql/sql";
import {
getConnectionTooltip,
isAppInteractionDisabled,
diff --git a/frontend/src/components/editor/cell/code/language-toggle.tsx b/frontend/src/components/editor/cell/code/language-toggle.tsx
index 88482eadec..5c3c2b33ed 100644
--- a/frontend/src/components/editor/cell/code/language-toggle.tsx
+++ b/frontend/src/components/editor/cell/code/language-toggle.tsx
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
import { switchLanguage } from "@/core/codemirror/language/extension";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql/sql";
import type { LanguageAdapter } from "@/core/codemirror/language/types";
import { Functions } from "@/utils/functions";
import { MarkdownIcon, PythonIcon } from "./icons";
diff --git a/frontend/src/components/editor/renderers/CellArray.tsx b/frontend/src/components/editor/renderers/CellArray.tsx
index f2906cca94..fe48da96ce 100644
--- a/frontend/src/components/editor/renderers/CellArray.tsx
+++ b/frontend/src/components/editor/renderers/CellArray.tsx
@@ -20,7 +20,7 @@ import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql/sql";
import { aiEnabledAtom } from "@/core/config/config";
import { isConnectedAtom } from "@/core/network/connection";
import { useBoolean } from "@/hooks/useBoolean";
diff --git a/frontend/src/core/codemirror/language/LanguageAdapters.ts b/frontend/src/core/codemirror/language/LanguageAdapters.ts
index 6e887e49a3..1f1f19d2c4 100644
--- a/frontend/src/core/codemirror/language/LanguageAdapters.ts
+++ b/frontend/src/core/codemirror/language/LanguageAdapters.ts
@@ -2,7 +2,7 @@
import { MarkdownLanguageAdapter } from "./languages/markdown";
import { PythonLanguageAdapter } from "./languages/python";
-import { SQLLanguageAdapter } from "./languages/sql";
+import { SQLLanguageAdapter } from "./languages/sql/sql";
import type { LanguageAdapter, LanguageAdapterType } from "./types";
export const LanguageAdapters: Record<LanguageAdapterType, LanguageAdapter> = {
diff --git a/frontend/src/core/codemirror/language/__tests__/sql.test.ts b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
index 737ac303f1..e850b711e5 100644
--- a/frontend/src/core/codemirror/language/__tests__/sql.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
@@ -6,6 +6,7 @@ import type {
} from "@codemirror/autocomplete";
import { PostgreSQL } from "@codemirror/lang-sql";
import { EditorState, type Extension } from "@codemirror/state";
+import { DuckDBDialect } from "@marimo-team/codemirror-sql/dialects";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import type { DataSourceConnection } from "@/core/datasets/data-source-connections";
import {
@@ -16,12 +17,11 @@ import { type ConnectionName, DUCKDB_ENGINE } from "@/core/datasets/engines";
import { datasetsAtom } from "@/core/datasets/state";
import type { DatasetsState } from "@/core/datasets/types";
import { store } from "@/core/state/jotai";
+import { TestSQLCompletionStore } from "../languages/sql/completion-store";
import {
- SQLCompletionStore,
SQLLanguageAdapter,
type SQLLanguageAdapterMetadata,
-} from "../languages/sql";
-import { DuckDBDialect } from "../languages/sql-dialects/duckdb";
+} from "../languages/sql/sql";
import { languageMetadataField } from "../metadata";
const adapter = new SQLLanguageAdapter();
@@ -618,7 +618,7 @@ _df = mo.sql(
describe("tablesCompletionSource", () => {
const mockStore = store;
- const completionStore = new SQLCompletionStore();
+ const completionStore = new TestSQLCompletionStore();
beforeEach(() => {
// Reset the adapter engine
@@ -1184,7 +1184,7 @@ describe("tablesCompletionSource", () => {
];
describe("SQL Completions", () => {
- const completionStore = new SQLCompletionStore();
+ const completionStore = new TestSQLCompletionStore();
beforeEach(() => {
// Reset state
diff --git a/frontend/src/core/codemirror/language/extension.ts b/frontend/src/core/codemirror/language/extension.ts
index ee972aa4fc..ff51fc2187 100644
--- a/frontend/src/core/codemirror/language/extension.ts
+++ b/frontend/src/core/codemirror/language/extension.ts
@@ -28,7 +28,7 @@ import { historyCompartment } from "../editing/extensions";
import { formattingChangeEffect } from "../format";
import { createPanel } from "../react-dom/createPanel";
import { getLanguageAdapters, LanguageAdapters } from "./LanguageAdapters";
-import { initializeSQLDialect } from "./languages/sql";
+import { initializeSQLDialect } from "./languages/sql/sql";
import type { LanguageMetadata } from "./metadata";
import { languageMetadataField, setLanguageMetadata } from "./metadata";
import { LanguagePanelComponent } from "./panel/panel";
diff --git a/frontend/src/core/codemirror/language/languages/sql-dialects/README.md b/frontend/src/core/codemirror/language/languages/sql-dialects/README.md
deleted file mode 100644
index 2d702029cf..0000000000
--- a/frontend/src/core/codemirror/language/languages/sql-dialects/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Generating SQL Dialects
-
-SQL Dialects are used for CodeMirror to support SQL syntax highlighting.
-
-For DuckDB, you can run the python script `spec_duckdb.py` to generate the terms used for `duckdb.ts` file.
diff --git a/frontend/src/core/codemirror/language/languages/sql-dialects/duckdb.ts b/frontend/src/core/codemirror/language/languages/sql-dialects/duckdb.ts
deleted file mode 100644
index 7f3d019e83..0000000000
--- a/frontend/src/core/codemirror/language/languages/sql-dialects/duckdb.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2024 Marimo. All rights reserved. */
-// Credit to https://github.com/sekuel/codemirror-sql-duckdb/blob/main/DuckDBDialect.js for the dialect spec
-
-import { SQLDialect, type SQLDialectSpec } from "@codemirror/lang-sql";
-
-const otherFunctions =
- "percentile_cont row_number rank dense_rank rank_dense percent_rank cume_dist ntile lag lead first_value last_value nth_value";
-
-const DuckDBDialectSpec: SQLDialectSpec = {
- charSetCasts: true,
- doubleQuotedStrings: false,
- unquotedBitLiterals: true,
- hashComments: false,
- spaceAfterDashes: false,
- specialVar: "@?",
- identifierQuotes: "`",
- keywords: `${otherFunctions} !__postfix !~~ !~~* % & && * ** + - ->> / // <-> << <=> <@ >> @ @> Calendar JSON TimeZone ^ ^@ abort abs absolute access access_mode acos acosh action add add_parquet_key admin after age aggregate alias all all_profiling_output allow_community_extensions allow_extensions_metadata_mismatch allow_persistent_secrets allow_unredacted_secrets allow_unsigned_extensions allowed_directories allowed_paths also alter always analyse analyze and anti any any_value apply approx_count_distinct approx_quantile approx_top_k arbitrary arg_max arg_max_null arg_min arg_min_null argmax argmin array array_agg array_aggr array_aggregate array_append array_apply array_cat array_concat array_contains array_cosine_distance array_cosine_similarity array_cross_product array_distance array_distinct array_dot_product array_extract array_filter array_grade_up array_has array_has_all array_has_any array_indexof array_inner_product array_intersect array_length array_negative_dot_product array_negative_inner_product array_pop_back array_pop_front array_position array_prepend array_push_back array_push_front array_reduce array_resize array_reverse array_reverse_sort array_select array_slice array_sort array_to_json array_to_string array_to_string_comma_default array_transform array_unique array_value array_where array_zip arrow_large_buffer_size arrow_lossless_conversion arrow_output_list_view arrow_output_version arrow_scan arrow_scan_dumb as asc ascii asin asinh asof asof_loop_join_threshold assertion assignment asymmetric at atan atan2 atanh attach attribute authorization autoinstall_extension_repository autoinstall_known_extensions autoload_known_extensions avg backward bar base64 before begin between bigint bin binary binary_as_string bit bit_and bit_count bit_length bit_or bit_position bit_xor bitstring bitstring_agg blob bool bool_and bool_or boolean both bpchar by bytea cache call called can_cast_implicitly cardinality cascade cascaded case cast cast_to_type catalog catalog_error_max_schemas cbrt ceil ceiling centuries century chain char char_length character character_length characteristics check checkpoint checkpoint_threshold chr class close cluster coalesce col_description collate collation collations column columns combine comment comments commit committed compression concat concat_ws concurrently configuration conflict connection constant_or_null constraint constraints contains content continue conversion copy copy_database corr cos cosh cost cot count count_if count_star countif covar_pop covar_samp create create_sort_key cross csv cube current current_catalog current_connection_id current_database current_date current_localtime current_localtimestamp current_query current_query_id current_role current_schema current_schemas current_setting current_transaction_id current_user currval cursor custom_extension_repository custom_profiling_settings custom_user_agent cycle damerau_levenshtein data database database_list database_size date date_add date_diff date_part date_sub date_trunc datediff datepart datesub datetime datetrunc day dayname dayofmonth dayofweek dayofyear days deallocate debug_asof_iejoin debug_checkpoint_abort debug_force_external debug_force_no_cross_product debug_skip_checkpoint_on_commit debug_verify_vector debug_window_mode dec decade decades decimal declare decode default default_block_size default_collation default_null_order default_order default_secret_storage defaults deferrable deferred definer degrees delete delimiter delimiters depends desc describe detach dictionary disable disable_checkpoint_on_shutdown disable_logging disable_object_cache disable_optimizer disable_parquet_prefetching disable_print_progress_bar disable_profile disable_profiling disable_progress_bar disable_timestamptz_casts disable_verification disable_verify_external disable_verify_fetch_row disable_verify_parallelism disable_verify_serializer disabled_compression_methods disabled_filesystems disabled_log_types disabled_optimizers discard distinct divide do document domain double drop duckdb_api duckdb_columns duckdb_constraints duckdb_databases duckdb_dependencies duckdb_extensions duckdb_external_file_cache duckdb_functions duckdb_indexes duckdb_keywords duckdb_log_contexts duckdb_logs duckdb_logs_parsed duckdb_memory duckdb_optimizers duckdb_prepared_statements duckdb_schemas duckdb_secret_types duckdb_secrets duckdb_sequences duckdb_settings duckdb_table_sample duckdb_tables duckdb_temporary_files duckdb_types duckdb_variables duckdb_views dynamic_or_filter_threshold each editdist3 element_at else enable enable_checkpoint_on_shutdown enable_external_access enable_external_file_cache enable_fsst_vectors enable_geoparquet_conversion enable_http_logging enable_http_metadata_cache enable_logging enable_macro_dependencies enable_object_cache enable_optimizer enable_print_progress_bar enable_profile enable_profiling enable_progress_bar enable_progress_bar_print enable_verification enable_view_dependencies enabled_log_types encode encoding encrypted end ends_with entropy enum enum_code enum_first enum_last enum_range enum_range_boundary epoch epoch_ms epoch_ns epoch_us equi_width_bins era error errors_as_json escape even event except exclude excluding exclusive execute exists exp explain explain_output export export_state extension extension_directory extension_versions extensions external external_threads extract factorial false family favg fdiv fetch file_search_path filter finalize first flatten float float4 float8 floor fmod following for force force_bitpacking_mode force_checkpoint force_compression foreign format formatReadableDecimalSize formatReadableSize format_bytes format_pg_type format_type forward freeze from from_base64 from_binary from_hex from_json from_json_strict fsum full function functions gamma gcd gen_random_uuid generate_series generate_subscripts generated geomean geometric_mean get_bit get_block_size get_current_time get_current_timestamp getvariable glob global grade_up grant granted greatest greatest_common_divisor group group_concat grouping grouping_id groups guid hamming handler having header hex histogram histogram_exact histogram_values hold home_directory hour hours http_logging_output http_proxy http_proxy_password http_proxy_username hugeint identity ieee_floating_point_ops if ignore ilike ilike_escape immediate immediate_transaction_mode immutable implicit import import_database in in_search_path include including increment index index_scan_max_count index_scan_percentage indexes inet_client_addr inet_client_port inet_server_addr inet_server_port inherit inherits initially inline inner inout input insensitive insert install instead instr int int1 int128 int16 int2 int32 int4 int64 int8 integer integer_division integral intersect interval into invoker is is_histogram_other_bin isfinite isinf isnan isnull isodow isolation isoyear jaccard jaro_similarity jaro_winkler_similarity join json json_array json_array_length json_contains json_deserialize_sql json_each json_execute_serialized_sql json_exists json_extract json_extract_path json_extract_path_text json_extract_string json_group_array json_group_object json_group_structure json_keys json_merge_patch json_object json_pretty json_quote json_serialize_plan json_serialize_sql json_structure json_transform json_transform_strict json_tree json_type json_valid json_value julian kahan_sum key kurtosis kurtosis_pop label lambda lambda_syntax language large last last_day late_materialization_max_rows lateral lcase lcm leading leakproof least least_common_multiple left left_grapheme len length length_grapheme level levenshtein lgamma like like_escape limit list list_aggr list_aggregate list_any_value list_append list_apply list_approx_count_distinct list_avg list_bit_and list_bit_or list_bit_xor list_bool_and list_bool_or list_cat list_concat list_contains list_cosine_distance list_cosine_similarity list_count list_distance list_distinct list_dot_product list_element list_entropy list_extract list_filter list_first list_grade_up list_has list_has_all list_has_any list_histogram list_indexof list_inner_product list_intersect list_kurtosis list_kurtosis_pop list_last list_mad list_max list_median list_min list_mode list_negative_dot_product list_negative_inner_product list_pack list_position list_prepend list_product list_reduce list_resize list_reverse list_reverse_sort list_select list_sem list_skewness list_slice list_sort list_stddev_pop list_stddev_samp list_string_agg list_sum list_transform list_unique list_value list_var_pop list_var_samp list_where list_zip listagg listen ln load local location lock lock_configuration locked log log10 log2 log_query_path logged logging_level logging_mode logging_storage logical long lower lpad ltrim macro mad make_date make_time make_timestamp make_timestamp_ns make_timestamptz map map_concat map_contains map_contains_entry map_contains_value map_entries map_extract map_extract_value map_from_entries map_keys map_to_pg_oid map_values mapping match materialized max max_by max_expression_depth max_memory max_temp_directory_size max_vacuum_tasks maxvalue md5 md5_number md5_number_lower md5_number_upper mean median memory_limit merge_join_threshold metadata_info method microsecond microseconds millennia millennium millisecond milliseconds min min_by minute minutes minvalue mismatches mod mode month monthname months move multiply name names nanosecond national natural nchar nested_loop_join_threshold new next nextafter nextval nfc_normalize no none normalized_interval not not_ilike_escape not_like_escape nothing notify notnull now nowait null null_order nullif nulls numeric nvarchar obj_description object octet_length of off offset oid oids old old_implicit_casting on only operator option options or ord order order_by_non_integer_literal ordered_aggregate_threshold ordinality others out outer over overlaps overlay overriding owned owner pandas_analyze_sample pandas_scan parallel parquet_bloom_probe parquet_file_metadata parquet_kv_metadata parquet_metadata parquet_metadata_cache parquet_scan parquet_schema parse_dirname parse_dirpath parse_duckdb_log_message parse_filename parse_path parser partial partition partitioned partitioned_write_flush_threshold partitioned_write_max_open_files passing password percent perfect_ht_threshold persistent pi pivot pivot_filter_threshold pivot_limit pivot_longer pivot_wider placing plans platform policy position positional pow power pragma pragma_collations pragma_database_size pragma_metadata_info pragma_platform pragma_show pragma_storage_info pragma_table_info pragma_user_agent pragma_version preceding precision prefer_range_joins prefetch_all_parquet_files prefix prepare prepared preserve preserve_identifier_case preserve_insertion_order primary printf prior privileges procedural procedure produce_arrow_string_view product profile_output profiling_mode profiling_output program progress_bar_time publication python_enable_replacements python_map_function python_scan_all_frames qualify quantile quantile_cont quantile_disc quarter quarters query query_table quote radians random range read read_blob read_csv read_csv_auto read_json read_json_auto read_json_objects read_json_objects_auto read_ndjson read_ndjson_auto read_ndjson_objects read_parquet read_text real reassign recheck recursive reduce ref references referencing refresh regexp_escape regexp_extract regexp_extract_all regexp_full_match regexp_matches regexp_replace regexp_split_to_array regexp_split_to_table regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release remap_struct rename repeat repeat_row repeatable replace replica reservoir_quantile reset respect restart restrict returning returns reverse revoke right right_grapheme role rollback rollup round round_even roundbankers row row_to_json rows rpad rtrim rule sample savepoint scalar_subquery_error_on_multiple_rows scheduler_process_partial schema schemas scope scroll search search_path second seconds secret secret_directory security select sem semi seq_scan sequence sequences serializable server session session_user set set_bit setof sets setseed sha1 sha256 share shobj_description short show show_databases show_tables show_tables_expanded sign signbit signed similar simple sin sinh skewness skip smallint snapshot sniff_csv some sorted split split_part sql sqrt stable standalone start starts_with statement statistics stats stddev stddev_pop stddev_samp stdin stdout storage storage_compatibility_version storage_info stored str_split str_split_regex streaming_buffer_size strftime strict string string_agg string_split string_split_regex string_to_array strip strip_accents strlen strpos strptime struct struct_concat struct_extract struct_extract_at struct_insert struct_pack subscription substr substring substring_grapheme subtract suffix sum sum_no_overflow sumkahan summarize summary symmetric sysid system table table_info tables tablesample tablespace tan tanh temp temp_directory template temporary test_all_types test_vector_types text then threads ties time time_bucket timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz timetz_byte_comparable timezone timezone_hour timezone_minute tinyint to to_base to_base64 to_binary to_centuries to_days to_decades to_hex to_hours to_json to_microseconds to_millennia to_milliseconds to_minutes to_months to_quarters to_seconds to_timestamp to_weeks to_years today trailing transaction transaction_timestamp transform translate treat trigger trim true trunc truncate truncate_duckdb_logs trusted try_cast try_strptime txid_current type typeof types ubigint ucase uhugeint uint128 uint16 uint32 uint64 uint8 uinteger unbin unbounded uncommitted unencrypted unhex unicode union union_extract union_tag union_value unique unknown unlisten unlogged unnest unpack unpivot unpivot_list until update upper url_decode url_encode use user user_agent username using usmallint utinyint uuid uuid_extract_timestamp uuid_extract_version uuidv4 uuidv7 vacuum valid validate validator value values var_pop var_samp varbinary varchar variable variadic variance varint varying vector_type verbose verify_external verify_fetch_row verify_parallelism verify_serializer version view views virtual volatile wal_autocheckpoint wavg week weekday weekofyear weeks weighted_avg when where which_secret whitespace window with within without work worker_threads wrapper write write_log xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlnamespaces xmlparse xmlpi xmlroot xmlserialize xmltable xor year years yearweek yes zone zstd_min_string_length | || ~ ~~ ~~* ~~~`,
- types:
- "JSON bigint binary bit bitstring blob bool boolean bpchar bytea char date datetime dec decimal double enum float float4 float8 guid hugeint int int1 int128 int16 int2 int32 int4 int64 int8 integer integral interval list logical long map null numeric nvarchar oid real row short signed smallint string struct text time timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz tinyint ubigint uhugeint uint128 uint16 uint32 uint64 uint8 uinteger union usmallint utinyint uuid varbinary varchar varint",
-};
-
-export const DuckDBDialect = SQLDialect.define(DuckDBDialectSpec);
diff --git a/frontend/src/core/codemirror/language/languages/sql-dialects/spec_duckdb.py b/frontend/src/core/codemirror/language/languages/sql-dialects/spec_duckdb.py
deleted file mode 100644
index cb6d281f6f..0000000000
--- a/frontend/src/core/codemirror/language/languages/sql-dialects/spec_duckdb.py
+++ /dev/null
@@ -1,257 +0,0 @@
-# Copyright 2025 Marimo. All rights reserved.
-# /// script
-# requires-python = ">=3.12"
-# dependencies = [
-# "duckdb==1.3.2",
-# "marimo",
-# "polars==1.31.0",
-# "pyarrow==21.0.0",
-# "sqlglot==27.4.1",
-# ]
-# ///
-
-# Ignores lack of return type for functions
-# ruff: noqa: ANN202
-# mypy: disable-error-code="no-untyped-def"
-
-# Ignore SQL Types
-# ruff: noqa: F541
-
-import marimo
-
-__generated_with = "0.14.13"
-app = marimo.App(width="medium")
-
-with app.setup:
- import argparse
- from datetime import datetime
-
- import duckdb
- import polars as pl
-
- import marimo as mo
- from marimo import _loggers
-
- LOGGER = _loggers.marimo_logger()
-
-
-def _():
- excluded_keywords = ["__internal", "icu", "has_", "pg_", "allocator"]
- return (excluded_keywords,)
-
-
[email protected](hide_code=True)
-def _(excluded_keywords, form, num_keywords, num_types):
- mo.md(
- rf"""
- ## DuckDB Schema
-
- #### Number of keywords: **{num_keywords}**
-
- #### Number of types: **{num_types}**
-
- To update the duckdb codemirror spec, you can either
-
- - Run this python script to generate the outputs or
- - Submit the form below
-
- {form}
-
- ❗ And then update the duckdb spec under `frontend/src/core/codemirror/language/languages/sql-dialects/duckdb.ts`
-
- *Excluded keywords: {excluded_keywords}
-
- _{mo.md(f"Ran on DuckDB {duckdb.__version__}").right()}_
- _{mo.md(f"Last updated: {datetime.today().date().strftime('%B %d %Y')}").right()}_
- """
- )
- return
-
-
-def _(df, form):
- parser = argparse.ArgumentParser(
- prog="DuckDB Spec",
- description="Runs SQL to save types and keywords for DuckDB dialect in Codemirror",
- )
-
- parser.add_argument("-s", "--savepath", default="temp.json")
- args = parser.parse_args()
-
- if mo.app_meta().mode == "script":
- savepath = args.savepath
- LOGGER.info(f"Saving JSON file to {savepath}")
- write_to_file(df, savepath)
- LOGGER.info(f"Saved file to {savepath}")
- else:
- savepath = form.value
- if savepath is not None and savepath.strip() != "":
- write_to_file(df, savepath)
- mo.output.replace(mo.md(f"## Saved JSON file to {savepath}"))
- return
-
-
[email protected](hide_code=True)
-def _():
- _df = mo.sql(
- f"""
- WITH
- duckdb_types_cte AS (
- SELECT
- ROW_NUMBER() OVER () AS rn,
- type_name AS duckdb_types
- FROM
- (
- SELECT DISTINCT
- type_name
- FROM
- duckdb_types()
- )
- ),
- duckdb_settings_cte AS (
- SELECT
- ROW_NUMBER() OVER () AS rn,
- name AS duckdb_settings
- FROM
- (
- SELECT DISTINCT
- name
- FROM
- duckdb_settings()
- )
- ),
- duckdb_functions_cte AS (
- SELECT
- ROW_NUMBER() OVER () AS rn,
- function_name AS duckdb_functions
- FROM
- (
- SELECT DISTINCT
- function_name
- FROM
- duckdb_functions()
- )
- ),
- duckdb_keywords_cte AS (
- SELECT
- ROW_NUMBER() OVER () AS rn,
- keyword_name AS duckdb_keywords
- FROM
- (
- SELECT DISTINCT
- keyword_name
- FROM
- duckdb_keywords()
- )
- )
- SELECT
- t.duckdb_types,
- s.duckdb_settings,
- f.duckdb_functions,
- k.duckdb_keywords
- FROM
- duckdb_types_cte AS t
- FULL OUTER JOIN duckdb_settings_cte AS s ON t.rn = s.rn
- FULL OUTER JOIN duckdb_functions_cte AS f ON COALESCE(t.rn, s.rn) = f.rn
- FULL OUTER JOIN duckdb_keywords_cte AS k ON COALESCE(t.rn, s.rn, f.rn) = k.rn
- ORDER BY
- COALESCE(t.rn, s.rn, f.rn, k.rn);
- """
- )
- return
-
-
[email protected](hide_code=True)
-def _(excluded_keywords):
- df = mo.sql(
- f"""
- WITH
- stg_keywords AS (
- SELECT
- 'duckdb_keywords' AS keyword_group,
- keyword_name AS keyword
- FROM
- duckdb_keywords()
- UNION ALL
- SELECT
- 'duckdb_settings' AS keyword_group,
- name AS keyword
- FROM
- duckdb_settings()
- UNION ALL
- SELECT
- 'duckdb_functions' AS keyword_group,
- function_name AS keyword
- FROM
- duckdb_functions()
- UNION ALL
- SELECT
- 'duckdb_types' AS keyword_group,
- type_name AS keyword
- FROM
- duckdb_types()
- ),
- all_keywords AS (
- SELECT
- STRING_AGG(DISTINCT keyword, ' ' ORDER BY keyword) AS keywords_str
- FROM
- stg_keywords
- WHERE {filter_keywords_query('keyword', excluded_keywords)}
- ),
- builtin_keywords AS (
- SELECT
- STRING_AGG(DISTINCT keyword, ' ' ORDER BY keyword) AS builtin_str
- FROM
- stg_keywords
- WHERE
- keyword_group IN ('duckdb_keywords', 'duckdb_settings')
- ),
- duckdb_types_str AS (
- SELECT
- STRING_AGG(DISTINCT type_name, ' ' ORDER BY type_name) AS types_str
- FROM
- duckdb_types()
- )
- SELECT
- version() as duckdb_version,
- today() as last_updated,
- ak.keywords_str AS keywords,
- bk.builtin_str AS builtin,
- dts.types_str AS types
- FROM
- all_keywords AS ak,
- builtin_keywords AS bk,
- duckdb_types_str AS dts;
- """
- )
- return (df,)
-
-
-def _(df):
- num_keywords = len(df["keywords"][0].split(" "))
- num_types = len(df["types"][0].split(" "))
-
- form = mo.ui.text(placeholder="temp.json", label="Savepath").form(
- submit_button_label="Save"
- )
- return form, num_keywords, num_types
-
-
-def filter_keywords_query(column: str, excluded_keywords: list[str]) -> str:
- like_conditions = [
- f"{column} NOT LIKE '{kw}%'" for kw in excluded_keywords
- ]
- where_clause = " AND ".join(like_conditions)
- return where_clause
-
-
-def write_to_file(df: pl.DataFrame, filepath: str) -> None:
- df.select(pl.exclude("builtin")).write_json(filepath)
-
-
-if __name__ == "__main__":
- app.run()
diff --git a/frontend/src/core/codemirror/language/languages/sql/completion-sources.tsx b/frontend/src/core/codemirror/language/languages/sql/completion-sources.tsx
new file mode 100644
index 0000000000..5a279b250d
--- /dev/null
+++ b/frontend/src/core/codemirror/language/languages/sql/completion-sources.tsx
@@ -0,0 +1,99 @@
+/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { Completion, CompletionSource } from "@codemirror/autocomplete";
+import {
+ keywordCompletionSource,
+ schemaCompletionSource,
+} from "@codemirror/lang-sql";
+import type { EditorState } from "@codemirror/state";
+import { DefaultSqlTooltipRenders } from "@marimo-team/codemirror-sql";
+import { languageMetadataField } from "../../metadata";
+import { SCHEMA_CACHE } from "./completion-store";
+import type { SQLLanguageAdapterMetadata } from "./sql";
+
+function getSQLMetadata(state: EditorState): SQLLanguageAdapterMetadata {
+ return state.field(languageMetadataField) as SQLLanguageAdapterMetadata;
+}
+
+/**
+ * Custom schema completion source that dynamically gets the Dialect and SQL tables.
+ */
+export function tablesCompletionSource(): CompletionSource {
+ return (ctx) => {
+ const metadata = getSQLMetadata(ctx.state);
+ const connectionName = metadata.engine;
+ const config = SCHEMA_CACHE.getCompletionSource(connectionName);
+
+ if (!config) {
+ return null;
+ }
+
+ return schemaCompletionSource(config)(ctx);
+ };
+}
+
+/**
+ * Custom keyword completion source that dynamically gets the Dialect.
+ * This also ignores keyword completions on table columns.
+ */
+export function customKeywordCompletionSource(): CompletionSource {
+ return (ctx) => {
+ const metadata = getSQLMetadata(ctx.state);
+ const connectionName = metadata.engine;
+ const dialect = SCHEMA_CACHE.getDialect(connectionName);
+
+ // We want to ignore keyword completions on something like
+ // `WHERE my_table.col`
+ // ^cursor
+ const textBefore = ctx.matchBefore(/\.\w*/);
+ if (textBefore) {
+ // If there is a match, we are typing after a dot,
+ // so we don't want to trigger SQL keyword completion
+ return null;
+ }
+
+ const keywordRenderer = (label: string, type: string): Completion => {
+ return {
+ label,
+ type,
+ info: async () => {
+ const keywordDocs = await getKeywordDocs();
+ const keywordInfo = keywordDocs[label.toLocaleLowerCase()];
+ if (!keywordInfo) {
+ return null;
+ }
+
+ const dom = document.createElement("div");
+ dom.innerHTML = DefaultSqlTooltipRenders.keyword({
+ keyword: label,
+ info: keywordInfo,
+ });
+ return dom;
+ },
+ };
+ };
+
+ const uppercaseKeywords = true;
+ const result = keywordCompletionSource(
+ dialect,
+ uppercaseKeywords,
+ keywordRenderer,
+ )(ctx);
+ return result;
+ };
+}
+
+// e.g. lazily load keyword docs
+const getKeywordDocs = async (): Promise<Record<string, unknown>> => {
+ const keywords = await import(
+ "@marimo-team/codemirror-sql/data/common-keywords.json"
+ );
+ // Include DuckDB for now, but we can remove this once we have a better way to handle dialect-specific keywords
+ const duckdbKeywords = await import(
+ "@marimo-team/codemirror-sql/data/duckdb-keywords.json"
+ );
+ return {
+ ...keywords.default.keywords,
+ ...duckdbKeywords.default.keywords,
+ };
+};
diff --git a/frontend/src/core/codemirror/language/languages/sql/completion-store.ts b/frontend/src/core/codemirror/language/languages/sql/completion-store.ts
new file mode 100644
index 0000000000..719bf733b9
--- /dev/null
+++ b/frontend/src/core/codemirror/language/languages/sql/completion-store.ts
@@ -0,0 +1,191 @@
+/* Copyright 2024 Marimo. All rights reserved. */
+
+import {
+ type SQLConfig,
+ type SQLDialect,
+ StandardSQL,
+} from "@codemirror/lang-sql";
+import { isSchemaless } from "@/components/datasources/utils";
+import { dataConnectionsMapAtom } from "@/core/datasets/data-source-connections";
+import type { ConnectionName } from "@/core/datasets/engines";
+import { datasetTablesAtom } from "@/core/datasets/state";
+import type { DataSourceConnection } from "@/core/kernel/messages";
+import { store } from "@/core/state/jotai";
+import { LRUCache } from "@/utils/lru";
+import { guessDialect } from "./utils";
+
+type TableToCols = Record<string, string[]>;
+type Schemas = Record<string, TableToCols>;
+type CachedSchema = Pick<SQLConfig, "schema" | "defaultSchema"> & {
+ shouldAddLocalTables: boolean;
+};
+
+class SQLCompletionStore {
+ private cache: LRUCache<DataSourceConnection, CachedSchema>;
+
+ constructor() {
+ this.cache = new LRUCache(10, {
+ create: (connection) => this.getConnectionSchema(connection),
+ });
+ }
+
+ private getConnection(
+ connectionName: ConnectionName,
+ ): DataSourceConnection | undefined {
+ const dataConnectionsMap = store.get(dataConnectionsMapAtom);
+ return dataConnectionsMap.get(connectionName);
+ }
+
+ private getConnectionSchema(connection: DataSourceConnection): CachedSchema {
+ const schemaMap: Record<string, TableToCols> = {};
+ const databaseMap: Record<string, Schemas> = {};
+
+ // When there is only one database, it is the default
+ const defaultDb = connection.databases.find(
+ (db) =>
+ db.name === connection.default_database ||
+ connection.databases.length === 1,
+ );
+
+ const dbToVerify = defaultDb ?? connection.databases[0];
+ const isSchemalessDb =
+ dbToVerify?.schemas.some((schema) => isSchemaless(schema.name)) ?? false;
+
+ // For schemaless databases, treat databases as schemas
+ if (isSchemalessDb) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const dbToTablesMap: Record<string, any> = {};
+
+ for (const db of connection.databases) {
+ const isDefaultDb = db.name === defaultDb?.name;
+
+ for (const schema of db.schemas) {
+ for (const table of schema.tables) {
+ const columns = table.columns.map((col) => col.name);
+
+ if (isDefaultDb) {
+ // For default database, add tables directly to top level
+ dbToTablesMap[table.name] = columns;
+ } else {
+ // Otherwise nest under database name
+ dbToTablesMap[db.name] = dbToTablesMap[db.name] || {};
+ dbToTablesMap[db.name][table.name] = columns;
+ }
+ }
+ }
+ }
+
+ return {
+ shouldAddLocalTables: false,
+ schema: dbToTablesMap,
+ defaultSchema: defaultDb?.name,
+ };
+ }
+
+ // For default db, we can use the schema name directly
+ for (const schema of defaultDb?.schemas ?? []) {
+ schemaMap[schema.name] = {};
+ for (const table of schema.tables) {
+ const columns = table.columns.map((col) => col.name);
+ schemaMap[schema.name][table.name] = columns;
+ }
+ }
+
+ // Otherwise, we need to use the fully qualified name
+ for (const database of connection.databases) {
+ if (database.name === defaultDb?.name) {
+ continue;
+ }
+ databaseMap[database.name] = {};
+
+ for (const schema of database.schemas) {
+ databaseMap[database.name][schema.name] = {};
+
+ for (const table of schema.tables) {
+ const columns = table.columns.map((col) => col.name);
+ databaseMap[database.name][schema.name][table.name] = columns;
+ }
+ }
+ }
+
+ return {
+ shouldAddLocalTables: true,
+ schema: { ...databaseMap, ...schemaMap },
+ defaultSchema: connection.default_schema ?? undefined,
+ };
+ }
+
+ /**
+ * Returns the raw dialect of the connection passed from the backend,
+ * or null if the connection is not found
+ */
+ getInternalDialect(connectionName: ConnectionName): string | null {
+ const connection = this.getConnection(connectionName);
+ if (!connection) {
+ return null;
+ }
+ return connection.dialect;
+ }
+
+ /**
+ * Get the inferred SQL dialect for a connection
+ * If the connection is not found, return the standard SQL dialect.
+ */
+ getDialect(connectionName: ConnectionName): SQLDialect {
+ const connection = this.getConnection(connectionName);
+ if (!connection) {
+ return StandardSQL;
+ }
+ return guessDialect(connection) ?? StandardSQL;
+ }
+
+ getCompletionSource(connectionName: ConnectionName): SQLConfig | null {
+ const connection = this.getConnection(connectionName);
+ if (!connection) {
+ return null;
+ }
+
+ const getTablesMap = () => {
+ const localTables = store.get(datasetTablesAtom);
+ // If there is a conflict with connection tables,
+ // the engine will prioritize the connection tables without special handling
+ const tablesMap: TableToCols = {};
+ for (const table of localTables) {
+ const tableColumns = table.columns.map((col) => col.name);
+ tablesMap[table.name] = tableColumns;
+ }
+ return tablesMap;
+ };
+
+ const schema = this.cache.getOrCreate(connection);
+
+ return {
+ dialect: guessDialect(connection),
+ schema: schema.shouldAddLocalTables
+ ? { ...schema.schema, ...getTablesMap() }
+ : schema.schema,
+ defaultSchema: schema.defaultSchema,
+ defaultTable: getSingleTable(connection),
+ };
+ }
+}
+
+function getSingleTable(connection: DataSourceConnection): string | undefined {
+ if (connection.databases.length !== 1) {
+ return undefined;
+ }
+ const database = connection.databases[0];
+ if (database.schemas.length !== 1) {
+ return undefined;
+ }
+ const schema = database.schemas[0];
+ if (schema.tables.length !== 1) {
+ return undefined;
+ }
+ return schema.tables[0].name;
+}
+
+export const SCHEMA_CACHE = new SQLCompletionStore();
+
+// For testing
+export { SQLCompletionStore as TestSQLCompletionStore };
diff --git a/frontend/src/core/codemirror/language/languages/sql.ts b/frontend/src/core/codemirror/language/languages/sql/sql.ts
similarity index 60%
rename from frontend/src/core/codemirror/language/languages/sql.ts
rename to frontend/src/core/codemirror/language/languages/sql/sql.ts
index 09e843d1c3..bc6c6e0fb8 100644
--- a/frontend/src/core/codemirror/language/languages/sql.ts
+++ b/frontend/src/core/codemirror/language/languages/sql/sql.ts
@@ -1,52 +1,45 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- autocompletion,
- type CompletionSource,
-} from "@codemirror/autocomplete";
-import {
- Cassandra,
- keywordCompletionSource,
- MariaSQL,
- MSSQL,
- MySQL,
- PLSQL,
- PostgreSQL,
- type SQLConfig,
- type SQLDialect,
- SQLite,
- StandardSQL,
- schemaCompletionSource,
- sql,
-} from "@codemirror/lang-sql";
+import { acceptCompletion, autocompletion } from "@codemirror/autocomplete";
+import { insertTab } from "@codemirror/commands";
+import { type SQLDialect, type SQLNamespace, sql } from "@codemirror/lang-sql";
import type { EditorState, Extension } from "@codemirror/state";
import { Compartment } from "@codemirror/state";
-import type { EditorView } from "@codemirror/view";
+import { type EditorView, keymap } from "@codemirror/view";
import type { SyntaxNode, TreeCursor } from "@lezer/common";
import { parser } from "@lezer/python";
+import {
+ defaultSqlHoverTheme,
+ NodeSqlParser,
+ type SupportedDialects as ParserDialects,
+ sqlExtension,
+} from "@marimo-team/codemirror-sql";
+import { DuckDBDialect } from "@marimo-team/codemirror-sql/dialects";
import dedent from "string-dedent";
-import { isSchemaless } from "@/components/datasources/utils";
+import { getFeatureFlag } from "@/core/config/feature-flag";
import {
- dataConnectionsMapAtom,
dataSourceConnectionsAtom,
setLatestEngineSelected,
} from "@/core/datasets/data-source-connections";
import { type ConnectionName, DUCKDB_ENGINE } from "@/core/datasets/engines";
-import { datasetTablesAtom } from "@/core/datasets/state";
-import type { DataSourceConnection } from "@/core/kernel/messages";
import { store } from "@/core/state/jotai";
+import { resolvedThemeAtom } from "@/theme/useTheme";
import { Logger } from "@/utils/Logger";
-import { LRUCache } from "@/utils/lru";
-import { variableCompletionSource } from "../embedded/embedded-python";
-import { languageMetadataField } from "../metadata";
-import type { LanguageAdapter } from "../types";
-import { parseArgsKwargs } from "../utils/ast";
-import { indentOneTab } from "../utils/indentOneTab";
-import type { QuotePrefixKind } from "../utils/quotes";
-import { MarkdownLanguageAdapter } from "./markdown";
-import { DuckDBDialect } from "./sql-dialects/duckdb";
+import { variableCompletionSource } from "../../embedded/embedded-python";
+import { languageMetadataField } from "../../metadata";
+import type { LanguageAdapter } from "../../types";
+import { parseArgsKwargs } from "../../utils/ast";
+import { indentOneTab } from "../../utils/indentOneTab";
+import type { QuotePrefixKind } from "../../utils/quotes";
+import { MarkdownLanguageAdapter } from "../markdown";
+import {
+ customKeywordCompletionSource,
+ tablesCompletionSource,
+} from "./completion-sources";
+import { SCHEMA_CACHE } from "./completion-store";
const DEFAULT_DIALECT = DuckDBDialect;
+const DEFAULT_PARSER_DIALECT = "DuckDB";
// A compartment for the SQL config, so we can update the config of codemirror
const sqlConfigCompartment = new Compartment();
@@ -70,6 +63,16 @@ export class SQLLanguageAdapter
implements LanguageAdapter<SQLLanguageAdapterMetadata>
{
readonly type = "sql";
+ sqlLinterEnabled: boolean;
+
+ constructor() {
+ try {
+ this.sqlLinterEnabled = getFeatureFlag("sql_linter");
+ } catch {
+ this.sqlLinterEnabled = false;
+ }
+ }
+
get defaultMetadata(): SQLLanguageAdapterMetadata {
return {
dataframeName: "_df",
@@ -196,9 +199,19 @@ export class SQLLanguageAdapter
}
getExtension(): Extension[] {
- return [
+ const extensions = [
// This can be updated with a dispatch effect
sqlConfigCompartment.of(sql({ dialect: DEFAULT_DIALECT })),
+ keymap.of([
+ {
+ key: "Tab",
+ // When tab is pressed, we want to accept the completion or insert a tab
+ run: (cm) => {
+ return acceptCompletion(cm) || insertTab(cm);
+ },
+ preventDefault: true,
+ },
+ ]),
autocompletion({
// We remove the default keymap because we use our own which
// handles the Escape key correctly in Vim
@@ -214,6 +227,45 @@ export class SQLLanguageAdapter
],
}),
];
+
+ if (this.sqlLinterEnabled) {
+ const theme = store.get(resolvedThemeAtom);
+ const parser = new NodeSqlParser({
+ getParserOptions: (state: EditorState) => {
+ return {
+ database: guessParserDialect(state) ?? DEFAULT_PARSER_DIALECT,
+ };
+ },
+ });
+
+ extensions.push(
+ sqlExtension({
+ enableLinting: true,
+ linterConfig: {
+ delay: 250, // Delay before running validation
+ parser: parser,
+ },
+ enableGutterMarkers: true,
+ gutterConfig: {
+ backgroundColor: "#3b82f6", // Blue for current statement
+ errorBackgroundColor: "#ef4444", // Red for invalid statements
+ hideWhenNotFocused: true, // Hide gutter when editor loses focus
+ parser: parser,
+ },
+ hoverConfig: {
+ schema: getSchema, // Use the same schema as autocomplete
+ hoverTime: 300, // 300ms hover delay
+ enableKeywords: true, // Show keyword information
+ enableTables: true, // Show table information
+ enableColumns: true, // Show column information
+ parser: parser,
+ theme: defaultSqlHoverTheme(theme),
+ },
+ }),
+ );
+ }
+
+ return extensions;
}
}
@@ -245,238 +297,62 @@ export function initializeSQLDialect(view: EditorView) {
updateSQLDialect(view, dialect);
}
-type TableToCols = Record<string, string[]>;
-type Schemas = Record<string, TableToCols>;
-type CachedSchema = Pick<SQLConfig, "schema" | "defaultSchema"> & {
- shouldAddLocalTables: boolean;
-};
-
-export class SQLCompletionStore {
- private cache: LRUCache<DataSourceConnection, CachedSchema>;
-
- constructor() {
- this.cache = new LRUCache(10, {
- create: (connection) => this.getConnectionSchema(connection),
- });
- }
-
- private getConnection(
- connectionName: ConnectionName,
- ): DataSourceConnection | undefined {
- const dataConnectionsMap = store.get(dataConnectionsMapAtom);
- return dataConnectionsMap.get(connectionName);
- }
-
- private getConnectionSchema(connection: DataSourceConnection): CachedSchema {
- const schemaMap: Record<string, TableToCols> = {};
- const databaseMap: Record<string, Schemas> = {};
-
- // When there is only one database, it is the default
- const defaultDb = connection.databases.find(
- (db) =>
- db.name === connection.default_database ||
- connection.databases.length === 1,
- );
-
- const dbToVerify = defaultDb ?? connection.databases[0];
- const isSchemalessDb =
- dbToVerify?.schemas.some((schema) => isSchemaless(schema.name)) ?? false;
-
- // For schemaless databases, treat databases as schemas
- if (isSchemalessDb) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const dbToTablesMap: Record<string, any> = {};
-
- for (const db of connection.databases) {
- const isDefaultDb = db.name === defaultDb?.name;
-
- for (const schema of db.schemas) {
- for (const table of schema.tables) {
- const columns = table.columns.map((col) => col.name);
-
- if (isDefaultDb) {
- // For default database, add tables directly to top level
- dbToTablesMap[table.name] = columns;
- } else {
- // Otherwise nest under database name
- dbToTablesMap[db.name] = dbToTablesMap[db.name] || {};
- dbToTablesMap[db.name][table.name] = columns;
- }
- }
- }
- }
-
- return {
- shouldAddLocalTables: false,
- schema: dbToTablesMap,
- defaultSchema: defaultDb?.name,
- };
- }
-
- // For default db, we can use the schema name directly
- for (const schema of defaultDb?.schemas ?? []) {
- schemaMap[schema.name] = {};
- for (const table of schema.tables) {
- const columns = table.columns.map((col) => col.name);
- schemaMap[schema.name][table.name] = columns;
- }
- }
-
- // Otherwise, we need to use the fully qualified name
- for (const database of connection.databases) {
- if (database.name === defaultDb?.name) {
- continue;
- }
- databaseMap[database.name] = {};
-
- for (const schema of database.schemas) {
- databaseMap[database.name][schema.name] = {};
-
- for (const table of schema.tables) {
- const columns = table.columns.map((col) => col.name);
- databaseMap[database.name][schema.name][table.name] = columns;
- }
- }
- }
-
- return {
- shouldAddLocalTables: true,
- schema: { ...databaseMap, ...schemaMap },
- defaultSchema: connection.default_schema ?? undefined,
- };
- }
-
- /**
- * Get the dialect for a connection.
- * If the connection is not found, return the standard SQL dialect.
- */
- getDialect(connectionName: ConnectionName): SQLDialect {
- const connection = this.getConnection(connectionName);
- if (!connection) {
- return StandardSQL;
- }
- return guessDialect(connection) ?? StandardSQL;
- }
-
- getCompletionSource(connectionName: ConnectionName): SQLConfig | null {
- const connection = this.getConnection(connectionName);
- if (!connection) {
- return null;
- }
-
- const getTablesMap = () => {
- const localTables = store.get(datasetTablesAtom);
- // If there is a conflict with connection tables,
- // the engine will prioritize the connection tables without special handling
- const tablesMap: TableToCols = {};
- for (const table of localTables) {
- const tableColumns = table.columns.map((col) => col.name);
- tablesMap[table.name] = tableColumns;
- }
- return tablesMap;
- };
-
- const schema = this.cache.getOrCreate(connection);
-
- return {
- dialect: guessDialect(connection),
- schema: schema.shouldAddLocalTables
- ? { ...schema.schema, ...getTablesMap() }
- : schema.schema,
- defaultSchema: schema.defaultSchema,
- defaultTable: getSingleTable(connection),
- };
- }
-}
-
-const SCHEMA_CACHE = new SQLCompletionStore();
-
function getSQLMetadata(state: EditorState): SQLLanguageAdapterMetadata {
return state.field(languageMetadataField) as SQLLanguageAdapterMetadata;
}
-/**
- * Custom keyword completion source that dynamically gets the Dialect.
- * This also ignores keyword completions on table columns.
- */
-function customKeywordCompletionSource(): CompletionSource {
- return (ctx) => {
- const metadata = getSQLMetadata(ctx.state);
- const connectionName = metadata.engine;
- const dialect = SCHEMA_CACHE.getDialect(connectionName);
-
- // We want to ignore keyword completions on something like
- // `WHERE my_table.col`
- // ^cursor
- const textBefore = ctx.matchBefore(/\.\w*/);
- if (textBefore) {
- // If there is a match, we are typing after a dot,
- // so we don't want to trigger SQL keyword completion
- return null;
- }
-
- const result = keywordCompletionSource(dialect)(ctx);
- return result;
- };
-}
-
-/**
- * Custom schema completion source that dynamically gets the Dialect and SQL tables.
- */
-function tablesCompletionSource(): CompletionSource {
- return (ctx) => {
- const metadata = getSQLMetadata(ctx.state);
- const connectionName = metadata.engine;
- const config = SCHEMA_CACHE.getCompletionSource(connectionName);
-
- if (!config) {
- return null;
- }
+function getSchema(view: EditorView): SQLNamespace {
+ const metadata = getSQLMetadata(view.state);
+ const connectionName = metadata.engine;
+ const config = SCHEMA_CACHE.getCompletionSource(connectionName);
+ if (!config?.schema) {
+ return {};
+ }
- return schemaCompletionSource(config)(ctx);
- };
+ return config.schema;
}
-function getSingleTable(connection: DataSourceConnection): string | undefined {
- if (connection.databases.length !== 1) {
- return undefined;
- }
- const database = connection.databases[0];
- if (database.schemas.length !== 1) {
- return undefined;
- }
- const schema = database.schemas[0];
- if (schema.tables.length !== 1) {
- return undefined;
- }
- return schema.tables[0].name;
-}
+function guessParserDialect(state: EditorState): ParserDialects | null {
+ const metadata = getSQLMetadata(state);
+ const connectionName = metadata.engine;
+ const dialect =
+ SCHEMA_CACHE.getInternalDialect(connectionName)?.toLowerCase();
-export function guessDialect(
- connection: DataSourceConnection,
-): SQLDialect | undefined {
- switch (connection.dialect) {
+ switch (dialect) {
case "postgresql":
case "postgres":
- return PostgreSQL;
+ return "PostgreSQL";
+ case "db2":
+ return "DB2";
case "mysql":
- return MySQL;
+ return "MySQL";
case "sqlite":
- return SQLite;
+ return "Sqlite";
case "mssql":
case "sqlserver":
- return MSSQL;
+ return "TransactSQL";
case "duckdb":
- return DuckDBDialect;
+ return "DuckDB";
case "mariadb":
- return MariaSQL;
+ return "MariaDB";
case "cassandra":
- return Cassandra;
- case "oracledb":
- case "oracle":
- return PLSQL;
+ return "Noql";
+ case "athena":
+ return "Athena";
+ case "bigquery":
+ return "BigQuery";
+ case "hive":
+ return "Hive";
+ case "redshift":
+ return "Redshift";
+ case "snowflake":
+ return "Snowflake";
+ case "flink":
+ return "FlinkSQL";
+ case "mongodb":
+ return "Noql";
default:
- return undefined;
+ return null;
}
}
diff --git a/frontend/src/core/codemirror/language/languages/sql/utils.ts b/frontend/src/core/codemirror/language/languages/sql/utils.ts
new file mode 100644
index 0000000000..35f16ed512
--- /dev/null
+++ b/frontend/src/core/codemirror/language/languages/sql/utils.ts
@@ -0,0 +1,42 @@
+/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { SQLDialect } from "@codemirror/lang-sql";
+import {
+ Cassandra,
+ MariaSQL,
+ MSSQL,
+ MySQL,
+ PLSQL,
+ PostgreSQL,
+ SQLite,
+} from "@codemirror/lang-sql";
+import { DuckDBDialect } from "@marimo-team/codemirror-sql/dialects";
+import type { DataSourceConnection } from "@/core/kernel/messages";
+
+export function guessDialect(
+ connection: DataSourceConnection,
+): SQLDialect | undefined {
+ switch (connection.dialect) {
+ case "postgresql":
+ case "postgres":
+ return PostgreSQL;
+ case "mysql":
+ return MySQL;
+ case "sqlite":
+ return SQLite;
+ case "mssql":
+ case "sqlserver":
+ return MSSQL;
+ case "duckdb":
+ return DuckDBDialect;
+ case "mariadb":
+ return MariaSQL;
+ case "cassandra":
+ return Cassandra;
+ case "oracledb":
+ case "oracle":
+ return PLSQL;
+ default:
+ return undefined;
+ }
+}
diff --git a/frontend/src/core/codemirror/language/panel/panel.tsx b/frontend/src/core/codemirror/language/panel/panel.tsx
index f6c4feeb3b..a5404143a7 100644
--- a/frontend/src/core/codemirror/language/panel/panel.tsx
+++ b/frontend/src/core/codemirror/language/panel/panel.tsx
@@ -13,7 +13,7 @@ import { MarkdownLanguageAdapter } from "../languages/markdown";
import {
SQLLanguageAdapter,
updateSQLDialectFromConnection,
-} from "../languages/sql";
+} from "../languages/sql/sql";
import {
type LanguageMetadata,
languageMetadataField,
diff --git a/frontend/src/core/config/feature-flag.tsx b/frontend/src/core/config/feature-flag.tsx
index 754180fa26..0897eab55a 100644
--- a/frontend/src/core/config/feature-flag.tsx
+++ b/frontend/src/core/config/feature-flag.tsx
@@ -13,6 +13,7 @@ export interface ExperimentalFeatures {
rtc_v2: boolean;
performant_table_charts: boolean;
mcp_docs: boolean;
+ sql_linter: boolean;
// Add new feature flags here
}
@@ -23,6 +24,7 @@ const defaultValues: ExperimentalFeatures = {
rtc_v2: false,
performant_table_charts: false,
mcp_docs: false,
+ sql_linter: false,
};
export function getFeatureFlag<T extends keyof ExperimentalFeatures>(
diff --git a/frontend/src/theme/useTheme.ts b/frontend/src/theme/useTheme.ts
index 2a3925e022..ae85fafd81 100644
--- a/frontend/src/theme/useTheme.ts
+++ b/frontend/src/theme/useTheme.ts
@@ -73,7 +73,7 @@ function setupThemeListener(): void {
}
setupThemeListener();
-const resolvedThemeAtom = atom((get) => {
+export const resolvedThemeAtom = atom((get) => {
const theme = get(themeAtom);
const prefersDarkMode = get(prefersDarkModeAtom);
return theme === "system" ? (prefersDarkMode ? "dark" : "light") : theme;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 816b0240cb..a0790e9ab5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -27,7 +27,7 @@ importers:
version: 5.8.3
vitest:
specifier: ^3.2.4
frontend:
dependencies:
@@ -136,6 +136,9 @@ importers:
'@marimo-team/codemirror-mcp':
specifier: ^0.1.5
version: 0.1.5(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@modelcontextprotocol/[email protected])
+ '@marimo-team/codemirror-sql':
+ specifier: ^0.1.3
+ version: 0.1.3(@codemirror/[email protected])(@codemirror/[email protected])
'@marimo-team/llm-info':
specifier: workspace:*
version: link:../packages/llm-info
@@ -375,7 +378,7 @@ importers:
version: 0.27.7
react-arborist:
specifier: ^3.4.3
react-aria:
specifier: ^3.42.0
@@ -484,7 +487,7 @@ importers:
version: 2.0.6
'@codecov/vite-plugin':
specifier: ^1.9.1
'@csstools/postcss-light-dark-function':
specifier: ^2.0.9
version: 2.0.9([email protected])
@@ -499,7 +502,7 @@ importers:
version: 9.0.18([email protected])([email protected](@testing-library/[email protected]))
'@storybook/react-vite':
specifier: ^9.0.18
'@swc-jotai/react-refresh':
specifier: ^0.3.0
version: 0.3.0
@@ -517,7 +520,7 @@ importers:
version: 4.17.12
'@types/node':
specifier: ^24.0.10
- version: 24.0.14
+ version: 24.1.0
'@types/react':
specifier: ^19.1.8
version: 19.1.8
@@ -538,10 +541,10 @@ importers:
'@vitejs/plugin-react':
specifier: ^4.7.0
'@vitejs/plugin-react-swc':
specifier: ^3.11.0
babel-plugin-react-compiler:
specifier: 19.1.0-rc.2
version: 19.1.0-rc.2
@@ -574,13 +577,13 @@ importers:
version: 54.0.0([email protected])
eslint-plugin-vitest:
specifier: ^0.4.1
jsdom:
specifier: ^24.1.3
version: 24.1.3
msw:
specifier: ^2.10.2
- version: 2.10.4(@types/[email protected])([email protected])
+ version: 2.10.4(@types/[email protected])([email protected])
npm-run-all2:
specifier: ^6.2.6
version: 6.2.6
@@ -613,19 +616,19 @@ importers:
version: 4.1.11
vite:
specifier: ^6.3.5
vite-plugin-top-level-await:
specifier: ^1.6.0
vite-plugin-wasm:
specifier: ^3.5.0
vite-tsconfig-paths:
specifier: ^5.1.4
vitest:
specifier: ^3.2.4
packages/llm-info:
devDependencies:
@@ -634,7 +637,7 @@ importers:
version: link:../ts-config
vitest:
specifier: ^3.2.4
yaml:
specifier: ^2.8.1
version: 2.8.1
@@ -656,7 +659,7 @@ importers:
version: 1.2.5
'@types/node':
specifier: ^24.0.10
- version: 24.0.14
+ version: 24.1.0
'@types/ws':
specifier: ^8.18.1
version: 8.18.1
@@ -677,7 +680,7 @@ importers:
version: 5.8.3
vitest:
specifier: ^3.2.4
vscode-ws-jsonrpc:
specifier: ^3.4.0
version: 3.4.0
@@ -1811,6 +1814,12 @@ packages:
'@codemirror/view': ^6
'@modelcontextprotocol/sdk': ^1
+ '@marimo-team/[email protected]':
+ resolution: {integrity: sha512-3qx3lzLfxl8x4F4aDxor4lmMFds9xBdkxvWRcU1ILmjXtsnnoStG0BHuMlTpmx7up+sOjGosr0JGGaHycHmZYQ==}
+ peerDependencies:
+ '@codemirror/state': ^6
+ '@codemirror/view': ^6
+
'@marimo-team/[email protected]':
resolution: {integrity: sha512-e2rU3kZGuBfl6EnzU0tekKcoLBDiz6JNRD/Nbgaf8a56SqC8GdUokdZoAlTbZDOxhhRKTT8ykjXzQZBnvWY/5g==}
peerDependencies:
@@ -3907,8 +3916,8 @@ packages:
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
- '@types/[email protected]':
- resolution: {integrity: sha512-4zXMWD91vBLGRtHK3YbIoFMia+1nqEz72coM42C5ETjnNCa/heoj7NT1G67iAfOqMmcfhuCZ4uNpyz8EjlAejw==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==}
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
@@ -3919,6 +3928,9 @@ packages:
resolution: {integrity: sha512-j3pOPiEcWZ34R6a6mN07mUkM4o4Lwf6hPNt8eilOeZhTFbxFXmKhvXl9Y28jotFPaI1bpPDJsbCprUoNke6OrA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-eLYXDbZWXh2uxf+w8sXS8d6KSoXTswfps6fvCUuVAGN8eRpfe7h9eSRydxiSJvo9Bf+GzifsDOr9TMQlmJdmkw==}
+
resolution: {integrity: sha512-84eSnXD5gTM36iaOv3/4cduF2X0eptMnK9CcghH56A4uhSiFjAIgqhFGmdq+0yDh2jLQzL1s34CsBU5KD3MvPA==}
@@ -4495,6 +4507,10 @@ packages:
resolution: {integrity: sha512-aVNobHnJqLiUelTaHat9DZ1qM2w0C0Eym4LPI/3JxOnSokGVdsl1T1kN7TFvsEAD8G47A6VKQ0TVHqbBnYMJlQ==}
engines: {node: '>=12.0.0'}
+ resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
+ engines: {node: '>=0.6'}
+
resolution: {integrity: sha512-H0ea4Fd3lS1+sTEB2TgcLoK21lLhwEJzlQv3IN47pJS976Gx4zoWe0ak3q+uYh60ppQxg9F16Ri4tS1sfD4+jA==}
@@ -7253,6 +7269,10 @@ packages:
resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==}
+ resolution: {integrity: sha512-1ZcXu2qEFZlMkkaYPpMoTkypTunYTvtnInzVjWDhjc1+FS5h/WqT1rbgP2pP42/nXBWfPVN66mEfidWSpYVs1Q==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==}
@@ -10272,11 +10292,11 @@ snapshots:
unplugin: 1.16.1
zod: 3.25.76
dependencies:
'@codecov/bundler-plugin-core': 1.9.1
unplugin: 1.16.1
'@codemirror/[email protected]':
dependencies:
@@ -10931,17 +10951,17 @@ snapshots:
dependencies:
img-comparison-slider: 8.0.6
- '@inquirer/[email protected](@types/[email protected])':
+ '@inquirer/[email protected](@types/[email protected])':
dependencies:
- '@inquirer/core': 10.1.14(@types/[email protected])
- '@inquirer/type': 3.0.7(@types/[email protected])
+ '@inquirer/core': 10.1.14(@types/[email protected])
+ '@inquirer/type': 3.0.7(@types/[email protected])
optionalDependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
- '@inquirer/[email protected](@types/[email protected])':
+ '@inquirer/[email protected](@types/[email protected])':
dependencies:
'@inquirer/figures': 1.0.12
- '@inquirer/type': 3.0.7(@types/[email protected])
+ '@inquirer/type': 3.0.7(@types/[email protected])
ansi-escapes: 4.3.2
cli-width: 4.1.0
mute-stream: 2.0.0
@@ -10949,13 +10969,13 @@ snapshots:
wrap-ansi: 6.2.0
yoctocolors-cjs: 2.1.2
optionalDependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
'@inquirer/[email protected]': {}
- '@inquirer/[email protected](@types/[email protected])':
+ '@inquirer/[email protected](@types/[email protected])':
optionalDependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
'@internationalized/[email protected]':
dependencies:
@@ -10991,12 +11011,12 @@ snapshots:
dependencies:
'@sinclair/typebox': 0.27.8
dependencies:
glob: 10.4.5
magic-string: 0.30.17
react-docgen-typescript: 2.4.0([email protected])
optionalDependencies:
typescript: 5.8.3
@@ -11211,6 +11231,14 @@ snapshots:
'@codemirror/view': 6.38.1
'@modelcontextprotocol/sdk': 1.17.2
+ '@marimo-team/[email protected](@codemirror/[email protected])(@codemirror/[email protected])':
+ dependencies:
+ '@codemirror/autocomplete': 6.18.6
+ '@codemirror/lint': 6.8.5
+ '@codemirror/state': 6.5.2
+ '@codemirror/view': 6.38.1
+ node-sql-parser: 5.3.11
+
dependencies:
mitt: 3.0.1
@@ -13389,12 +13417,12 @@ snapshots:
optionalDependencies:
react: 19.1.0
dependencies:
'@storybook/csf-plugin': 9.0.18([email protected](@testing-library/[email protected]))
storybook: 9.0.18(@testing-library/[email protected])
ts-dedent: 2.2.0
'@storybook/[email protected]([email protected](@testing-library/[email protected]))':
dependencies:
@@ -13414,11 +13442,11 @@ snapshots:
react-dom: 19.1.0([email protected])
storybook: 9.0.18(@testing-library/[email protected])
dependencies:
'@rollup/pluginutils': 5.2.0([email protected])
find-up: 7.0.0
magic-string: 0.30.17
@@ -13428,7 +13456,7 @@ snapshots:
resolve: 1.22.10
storybook: 9.0.18(@testing-library/[email protected])
tsconfig-paths: 4.2.0
transitivePeerDependencies:
- rollup
- supports-color
@@ -13877,7 +13905,7 @@ snapshots:
dependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
'@types/tough-cookie': 4.0.5
parse5: 7.3.0
@@ -13909,7 +13937,7 @@ snapshots:
'@types/[email protected]': {}
- '@types/[email protected]':
+ '@types/[email protected]':
dependencies:
undici-types: 7.8.0
@@ -13919,6 +13947,8 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
'@types/[email protected]': {}
@@ -13967,7 +13997,7 @@ snapshots:
dependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
dependencies:
@@ -14186,15 +14216,15 @@ snapshots:
'@connectrpc/connect': 1.6.1(@bufbuild/[email protected])
'@connectrpc/connect-web': 1.6.1(@bufbuild/[email protected])(@connectrpc/[email protected](@bufbuild/[email protected]))
dependencies:
'@rolldown/pluginutils': 1.0.0-beta.27
'@swc/core': 1.12.14(@swc/[email protected])
transitivePeerDependencies:
- '@swc/helpers'
dependencies:
'@babel/core': 7.28.0
'@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/[email protected])
@@ -14202,7 +14232,7 @@ snapshots:
'@rolldown/pluginutils': 1.0.0-beta.27
'@types/babel__core': 7.20.5
react-refresh: 0.17.0
transitivePeerDependencies:
- supports-color
@@ -14220,14 +14250,14 @@ snapshots:
chai: 5.2.1
tinyrainbow: 2.0.0
dependencies:
'@vitest/spy': 3.2.4
estree-walker: 3.0.3
magic-string: 0.30.17
optionalDependencies:
- msw: 2.10.4(@types/[email protected])([email protected])
+ msw: 2.10.4(@types/[email protected])([email protected])
'@vitest/[email protected]':
dependencies:
@@ -14610,6 +14640,8 @@ snapshots:
dependencies:
open: 8.4.2
+
@@ -15926,13 +15958,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@typescript-eslint/utils': 7.18.0([email protected])([email protected])
eslint: 8.57.1
optionalDependencies:
'@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
transitivePeerDependencies:
- supports-color
- typescript
@@ -16979,7 +17011,7 @@ snapshots:
dependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
merge-stream: 2.0.0
supports-color: 8.1.1
@@ -17833,12 +17865,12 @@ snapshots:
dependencies:
'@bundled-es-modules/cookie': 2.0.1
'@bundled-es-modules/statuses': 1.0.1
'@bundled-es-modules/tough-cookie': 0.1.6
- '@inquirer/confirm': 5.1.13(@types/[email protected])
+ '@inquirer/confirm': 5.1.13(@types/[email protected])
'@mswjs/interceptors': 0.39.2
'@open-draft/deferred-promise': 2.2.0
'@open-draft/until': 2.1.0
@@ -17905,6 +17937,11 @@ snapshots:
+ dependencies:
+ '@types/pegjs': 0.10.6
+ big-integer: 1.6.52
+
dependencies:
hosted-git-info: 2.8.9
@@ -18626,10 +18663,10 @@ snapshots:
iconv-lite: 0.6.3
unpipe: 1.0.0
dependencies:
react: 19.1.0
- react-dnd: 14.0.5(@types/[email protected])(@types/[email protected])([email protected])
+ react-dnd: 14.0.5(@types/[email protected])(@types/[email protected])([email protected])
react-dnd-html5-backend: 14.1.0
react-dom: 19.1.0([email protected])
@@ -18745,7 +18782,7 @@ snapshots:
dependencies:
dnd-core: 14.0.1
dependencies:
'@react-dnd/invariant': 2.0.0
'@react-dnd/shallowequal': 2.0.0
@@ -18754,7 +18791,7 @@ snapshots:
hoist-non-react-statics: 3.3.2
react: 19.1.0
optionalDependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
'@types/react': 19.1.8
@@ -20690,13 +20727,13 @@ snapshots:
'@types/unist': 3.0.3
vfile-message: 4.0.2
dependencies:
cac: 6.7.14
debug: 4.4.1([email protected])
es-module-lexer: 1.7.0
pathe: 2.0.3
transitivePeerDependencies:
- '@types/node'
- jiti
@@ -20711,33 +20748,33 @@ snapshots:
- tsx
- yaml
dependencies:
'@rollup/plugin-virtual': 3.0.2([email protected])
'@swc/core': 1.12.14(@swc/[email protected])
'@swc/wasm': 1.13.2
uuid: 10.0.0
transitivePeerDependencies:
- '@swc/helpers'
- rollup
dependencies:
dependencies:
debug: 4.4.1([email protected])
globrex: 0.1.2
tsconfck: 3.1.6([email protected])
optionalDependencies:
transitivePeerDependencies:
- supports-color
- typescript
dependencies:
esbuild: 0.25.6
fdir: 6.4.6([email protected])
@@ -20746,18 +20783,18 @@ snapshots:
rollup: 4.45.1
tinyglobby: 0.2.14
optionalDependencies:
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
fsevents: 2.3.3
jiti: 2.5.1
lightningcss: 1.30.1
terser: 5.43.1
yaml: 2.8.1
dependencies:
'@types/chai': 5.2.2
'@vitest/expect': 3.2.4
'@vitest/pretty-format': 3.2.4
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -20775,12 +20812,12 @@ snapshots:
tinyglobby: 0.2.14
tinypool: 1.1.1
tinyrainbow: 2.0.0
why-is-node-running: 2.3.0
optionalDependencies:
'@types/debug': 4.1.12
- '@types/node': 24.0.14
+ '@types/node': 24.1.0
jsdom: 24.1.3
transitivePeerDependencies:
- jiti
diff --git a/pyproject.toml b/pyproject.toml
index 1d0113603c..5c2daebf23 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -523,6 +523,7 @@ format_on_save = true
multi_column = true
performant_table_charts = true
mcp_docs = true
+sql_linter = true
[tool.marimo.display]
dataframes = "rich"