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.

update docs and UI for quick-add datasources (#10426)

Shahmir Varqha40dd45585414
diff --git a/docs/_static/docs-add-remote-storage-ui.png b/docs/_static/docs-add-remote-storage-ui.png
index 45734a9688..ade43d7d6d 100644
Binary files a/docs/_static/docs-add-remote-storage-ui.png and b/docs/_static/docs-add-remote-storage-ui.png differ
diff --git a/docs/_static/docs-sql-choose-db.png b/docs/_static/docs-sql-choose-db.png
index ca332f1387..991ebc9c2d 100644
Binary files a/docs/_static/docs-sql-choose-db.png and b/docs/_static/docs-sql-choose-db.png differ
diff --git a/docs/_static/docs-sql-datasource-quick-add.png b/docs/_static/docs-sql-datasource-quick-add.png
index e3c7b9e094..f508038ad8 100644
Binary files a/docs/_static/docs-sql-datasource-quick-add.png and b/docs/_static/docs-sql-datasource-quick-add.png differ
diff --git a/docs/guides/working_with_data/remote_storage.md b/docs/guides/working_with_data/remote_storage.md
index ba68132af2..2276a54e8a 100644
--- a/docs/guides/working_with_data/remote_storage.md
+++ b/docs/guides/working_with_data/remote_storage.md
@@ -22,7 +22,7 @@ marimo auto-discovers variables that are instances of:
You can either create a storage connection using the UI or code.
-### 1. Using the UI
+### Using the UI
From the Files panel in the sidebar, expand the **Remote Storage** section and click the **Add remote storage** button. The UI will guide you through entering your storage connection details.
@@ -32,10 +32,18 @@ From the Files panel in the sidebar, expand the **Remote Storage** section and c
</figure>
</div>
-If you'd like to connect to a storage that isn't supported by the UI, you can use the code method below, or submit a [feature request](https://github.com/marimo-team/marimo/issues/new?title=Add%20new%20storage%20connection%20UI:&labels=enhancement&template=feature_request.yaml).
+marimo also detects credentials in your kernel's environment and offers a **Quick add** suggestion.
+
+| Integration | Detected from |
+| --- | --- |
+| Amazon S3 | `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are set, or `AWS_PROFILE` is set |
+| S3-compatible storage | As above, with a custom endpoint (`AWS_ENDPOINT_URL` or `AWS_ENDPOINT_URL_S3`), e.g. MinIO or Cloudflare R2 |
+See [Detecting data sources from your environment](sql.md#detecting-data-sources-from-your-environment) for details on how detection works.
+
+If you'd like to connect to a storage that isn't supported by the UI, you can use the code method below, or submit a [feature request](https://github.com/marimo-team/marimo/issues/new?title=Add%20new%20storage%20connection%20UI:&labels=enhancement&template=feature_request.yaml).
-### 2. Using code
+### Using code
#### obstore
diff --git a/docs/guides/working_with_data/sql.md b/docs/guides/working_with_data/sql.md
index 2f6476f6be..cec7bbab06 100644
--- a/docs/guides/working_with_data/sql.md
+++ b/docs/guides/working_with_data/sql.md
@@ -172,33 +172,24 @@ Click the "Add Database Connection" button in your notebook to connect to Postgr
#### Detecting data sources from your environment
-marimo detects data sources that are already configured in your
-environment and offers them as one-click additions in the connection dialog.
-Detection inspects the kernel's environment variables and/or configuration files.
+marimo scans your kernel's environment for connection details it recognizes and offers them as **Quick add** suggestions.
+Click a suggestion to insert a ready-to-run cell.
<div align="center">
<figure>
- <img width="700" src="/_static/docs-sql-datasource-quick-add.png"/>
- <figcaption>Quick-add a discovered data source</figcaption>
+ <img width="650" src="/_static/docs-sql-datasource-quick-add.png"/>
</figure>
</div>
-The following non-exhaustive table enumerates the environment variables and configuration files scanned for each supported source:
+| Integration | Detected from |
+| --- | --- |
+| PostgreSQL | `PGHOST`, `PGUSER`, `PGDATABASE` (plus `PGPORT`, `PGPASSWORD`) |
+| MySQL | `MYSQL_HOST`, `MYSQL_USER`, `MYSQL_DATABASE`, and `MYSQL_PASSWORD`/`MYSQL_PWD` (plus `MYSQL_TCP_PORT`) |
+| Trino | `TRINO_HOST`, `TRINO_USER`, `TRINO_CATALOG` (plus `TRINO_PORT`, `TRINO_PASSWORD`, `TRINO_SCHEMA`) |
+| PySpark (Spark Connect) | `SPARK_REMOTE` |
+| PyIceberg catalogs | `PYICEBERG_CATALOG__<name>__*` environment variables, or catalogs resolved from a `.pyiceberg.yaml` file |
-| Source | Detected when |
-| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
-| PostgreSQL | `PGHOST`, `PGUSER`, and `PGDATABASE` are set (optionally `PGPORT`, `PGPASSWORD`) |
-| MySQL | `MYSQL_HOST`, `MYSQL_USER`, `MYSQL_DATABASE`, and a password (`MYSQL_PASSWORD` or `MYSQL_PWD`) are set (optionally `MYSQL_TCP_PORT`) |
-| Trino | `TRINO_HOST`, `TRINO_USER`, and `TRINO_CATALOG` are set (optionally `TRINO_PORT`, `TRINO_PASSWORD`, `TRINO_SCHEMA`) |
-| Amazon S3 | `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are set, or `AWS_PROFILE` is set |
-| S3-compatible storage | As above, with a custom endpoint (`AWS_ENDPOINT_URL` or `AWS_ENDPOINT_URL_S3`), e.g. MinIO or Cloudflare R2 |
-| PySpark (Spark Connect) | `SPARK_REMOTE` is set |
-| PyIceberg | `PYICEBERG_CATALOG__<name>__<property>` variables define a catalog, or a `.pyiceberg.yaml` file configures one |
-
-PyIceberg catalogs are resolved the same way PyIceberg resolves them at
-runtime: `.pyiceberg.yaml` is searched in `PYICEBERG_HOME`, then your home
-directory, then the current directory, with environment variables taking
-precedence.
+Only the *names* of environment variables are shown in the UI — their values are never sent to the frontend.
If you'd like to connect to a database that isn't supported by the UI, you can use the code method below, or submit a [feature request](https://github.com/marimo-team/marimo/issues/new?title=New%20database%20connection:&labels=enhancement&template=feature_request.yaml).
@@ -231,7 +222,7 @@ By default, marimo uses the [in-memory duckdb connection](https://duckdb.org/doc
| ClickHouse | `clickhouse_connect`, `chdb` |
| CockroachDB | `sqlalchemy`, `sqlmodel` |
| Databricks | `sqlalchemy`, `sqlmodel`, `ibis` |
- | dlt | `ibis` |
+ | dlt | `ibis` |
| Datafusion | `ibis` |
| DuckDB | `duckdb` |
| EXASolution | `sqlalchemy`, `sqlmodel`, `ibis` |
diff --git a/frontend/src/components/editor/connections/add-connection-dialog.tsx b/frontend/src/components/editor/connections/add-connection-dialog.tsx
index dd90a6c48e..f5c1d9365b 100644
--- a/frontend/src/components/editor/connections/add-connection-dialog.tsx
+++ b/frontend/src/components/editor/connections/add-connection-dialog.tsx
@@ -87,7 +87,7 @@ export const AddConnectionDialogContent: React.FC<{
<span className="block">{codeSnippetHint}</span>
</DialogDescription>
</DialogHeader>
- <AutoDiscoveredDataSources onSubmit={onClose} />
+ <AutoDiscoveredDataSources onSubmit={onClose} className="-mt-2" />
<Tabs
value={activeTab}
onValueChange={(v) => setActiveTab(v as ConnectionTab)}
diff --git a/frontend/src/components/editor/connections/quick-add-data-sources.tsx b/frontend/src/components/editor/connections/quick-add-data-sources.tsx
index e2024c2e7a..8f23bc4d12 100644
--- a/frontend/src/components/editor/connections/quick-add-data-sources.tsx
+++ b/frontend/src/components/editor/connections/quick-add-data-sources.tsx
@@ -5,11 +5,13 @@ import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
import type { DetectedDataSource } from "@/core/datasets/data-source-discovery";
import { useDataSourceDiscovery } from "@/hooks/useDataSourceDiscovery";
import { useInsertCode } from "./components";
+import { cn } from "@/utils/cn";
export const QuickAddDataSources: React.FC<{
+ className?: string;
sources: DetectedDataSource[];
onAdd: (source: DetectedDataSource) => void;
-}> = ({ sources, onAdd }) => {
+}> = ({ className, sources, onAdd }) => {
if (sources.length === 0) {
return null;
}
@@ -17,12 +19,15 @@ export const QuickAddDataSources: React.FC<{
return (
<section
aria-labelledby="quick-add-data-sources-title"
- className="rounded-md border bg-muted/30 px-3 py-2"
+ className={cn(
+ "rounded-full bg-[linear-gradient(135deg,var(--blue-2),var(--purple-3))] px-3 py-2",
+ className,
+ )}
>
<div className="flex flex-wrap items-center gap-2">
<div className="mr-1 flex items-center gap-1.5">
- <SparklesIcon className="h-3.5 w-3.5 text-muted-foreground" />
- <h3 id="quick-add-data-sources-title" className="text-sm font-medium">
+ <SparklesIcon className="h-3.5 w-3.5 text-(--blue-9)" />
+ <h3 id="quick-add-data-sources-title" className="text-sm">
Quick add
</h3>
</div>
@@ -36,10 +41,10 @@ export const QuickAddDataSources: React.FC<{
<button
type="button"
aria-label={`Add ${source.displayName} connection`}
- className="inline-flex items-center gap-1 rounded-full border border-(--blue-8) bg-(--blue-2) px-2.5 py-1 text-xs font-semibold text-(--blue-11) transition-colors hover:bg-(--blue-3) focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2"
+ className="inline-flex items-center gap-1 rounded-full border border-border/60 bg-background px-2.5 py-1 text-xs font-medium text-foreground/90 transition-colors hover:border-(--blue-7) focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2"
onClick={() => onAdd(source)}
>
- <PlusIcon className="h-3 w-3" />
+ <PlusIcon className="h-3 w-3 text-muted-foreground" />
{source.displayName}
</button>
</Tooltip>
@@ -90,12 +95,14 @@ const DetectedDataSourceDetails: React.FC<{
export const AutoDiscoveredDataSources: React.FC<{
onSubmit: () => void;
-}> = ({ onSubmit }) => {
+ className?: string;
+}> = ({ onSubmit, className }) => {
const insertCode = useInsertCode();
const { data } = useDataSourceDiscovery();
return (
<QuickAddDataSources
+ className={className}
sources={data ?? []}
onAdd={(source) => {
insertCode(source.code);