Skip to content

Commit 5a66b65

Browse files
authored
Rely more on ADBC when possible (#3085)
1 parent bdf6e44 commit 5a66b65

File tree

5 files changed

+22
-171
lines changed

5 files changed

+22
-171
lines changed

lib/livebook/notebook/learn.ex

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ defmodule Livebook.Notebook.Learn do
6262
cover_filename: "learn-deploy.svg"
6363
}
6464
},
65-
%{
66-
path: Path.join(__DIR__, "learn/intro_to_explorer.livemd"),
67-
details: %{
68-
description: "Intuitive data visualizations and data pipelines on the fly.",
69-
cover_filename: "explorer.png"
70-
}
71-
},
7265
%{
7366
path: Path.join(__DIR__, "learn/intro_to_vega_lite.livemd"),
7467
details: %{

lib/livebook/notebook/learn/intro_to_explorer.livemd

Lines changed: 0 additions & 131 deletions
This file was deleted.

lib/livebook/notebook/learn/kino/intro_to_kino.livemd

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ Mix.install([
1010

1111
Throughout the Learning section, we have used Kino several times.
1212
Sometimes we use built-in Kinos, such as using `Kino.Control` and
13-
`Kino.Frame` to [deploy applications](/learn/notebooks/deploy-apps),
14-
other times we used custom Kinos tailored for
15-
[data exploration](/learn/notebooks/intro-to-explorer) or
16-
[plotting](/learn/notebooks/intro-to-vega-lite).
13+
`Kino.Frame` to [deploy applications](/learn/notebooks/deploy-apps)
14+
or for [plotting](/learn/notebooks/intro-to-vega-lite).
1715

1816
In this notebook, we will explore several of the built-in Kinos.
1917
`kino` is already listed as a dependency, so let's get started.

lib/livebook/runtime/definitions.ex

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defmodule Livebook.Runtime.Definitions do
1717

1818
kino_db = %{
1919
name: "kino_db",
20-
dependency: %{dep: {:kino_db, "~> 0.3.0"}, config: []}
20+
dependency: %{dep: {:kino_db, "~> 0.4.0"}, config: []}
2121
}
2222

2323
exqlite = %{
@@ -50,11 +50,6 @@ defmodule Livebook.Runtime.Definitions do
5050
dependency: %{dep: {:torchx, ">= 0.0.0"}, config: [nx: [default_backend: Torchx.Backend]]}
5151
}
5252

53-
kino_explorer = %{
54-
name: "kino_explorer",
55-
dependency: %{dep: {:kino_explorer, "~> 0.1.20"}, config: []}
56-
}
57-
5853
kino_flame = %{
5954
name: "kino_flame",
6055
dependency: %{dep: {:kino_flame, "~> 0.1.5"}, config: []}
@@ -85,6 +80,11 @@ defmodule Livebook.Runtime.Definitions do
8580
dependency: %{dep: {:yaml_elixir, "~> 2.0"}, config: []}
8681
}
8782

83+
adbc = %{
84+
name: "adbc",
85+
dependency: %{dep: {:adbc, "~> 0.8"}, config: []}
86+
}
87+
8888
windows? = match?({:win32, _}, :os.type())
8989
nx_backend_package = if(windows?, do: torchx, else: exla)
9090

@@ -119,7 +119,6 @@ defmodule Livebook.Runtime.Definitions do
119119
name: "DuckDB",
120120
packages: [
121121
kino_db,
122-
kino_explorer,
123122
%{
124123
name: "adbc",
125124
dependency: %{dep: {:adbc, ">= 0.0.0"}, config: [adbc: [drivers: [:duckdb]]]}
@@ -130,7 +129,6 @@ defmodule Livebook.Runtime.Definitions do
130129
name: "Google BigQuery",
131130
packages: [
132131
kino_db,
133-
kino_explorer,
134132
%{
135133
name: "adbc",
136134
dependency: %{dep: {:adbc, ">= 0.0.0"}, config: [adbc: [drivers: [:bigquery]]]}
@@ -155,7 +153,6 @@ defmodule Livebook.Runtime.Definitions do
155153
name: "Snowflake",
156154
packages: [
157155
kino_db,
158-
kino_explorer,
159156
%{
160157
name: "adbc",
161158
dependency: %{dep: {:adbc, ">= 0.0.0"}, config: [adbc: [drivers: [:snowflake]]]}
@@ -225,16 +222,6 @@ defmodule Livebook.Runtime.Definitions do
225222
}
226223
]
227224
},
228-
%{
229-
kind: "Elixir.KinoExplorer.DataTransformCell",
230-
name: "Data transform",
231-
requirement_presets: [
232-
%{
233-
name: "Default",
234-
packages: [kino_explorer]
235-
}
236-
]
237-
},
238225
%{
239226
kind: "Elixir.Kino.RemoteExecutionCell",
240227
name: "Remote execution",
@@ -318,24 +305,28 @@ defmodule Livebook.Runtime.Definitions do
318305
%{
319306
type: :file_action,
320307
file_types: ["text/csv"],
321-
description: "Create a dataframe",
308+
description: "Load into DuckDB",
322309
source: """
323-
df =
324-
Kino.FS.file_path("{{NAME}}")
325-
|> Explorer.DataFrame.from_csv!()\
310+
Adbc.download_driver!(:duckdb)
311+
db = Kino.start_child!({Adbc.Database, driver: :duckdb})
312+
conn = Kino.start_child!({Adbc.Connection, database: db})
313+
path = Kino.FS.file_path("{{NAME}}")
314+
Adbc.Connection.query!(conn, "SELECT * FROM read_csv($1)", [path])
326315
""",
327-
packages: [kino, kino_explorer]
316+
packages: [kino, kino_db, adbc]
328317
},
329318
%{
330319
type: :file_action,
331320
file_types: [".parquet"],
332-
description: "Create a dataframe",
321+
description: "Load into DuckDB",
333322
source: """
334-
df =
335-
Kino.FS.file_spec("{{NAME}}")
336-
|> Explorer.DataFrame.from_parquet!(lazy: true)\
323+
Adbc.download_driver!(:duckdb)
324+
db = Kino.start_child!({Adbc.Database, driver: :duckdb})
325+
conn = Kino.start_child!({Adbc.Connection, database: db})
326+
path = Kino.FS.file_path("{{NAME}}")
327+
Adbc.Connection.query!(conn, "SELECT * FROM read_parquet($1)", [path])
337328
""",
338-
packages: [kino, kino_explorer]
329+
packages: [kino, kino_db, adbc]
339330
},
340331
%{
341332
type: :file_action,

static/images/explorer.png

-72.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)