DuckDB本地UI
The DuckDB Local UI

原始链接: https://duckdb.org/2025/03/12/duckdb-ui.html

Jeff Raymakers和Gabor Szarnyas于2025年3月12日宣布发布DuckDB的本地Web UI,可以通过`ui`扩展程序访问。该UI旨在简化数据库交互,可以通过DuckDB CLI使用`-ui`参数或SQL命令启动,并在您的浏览器中打开。 主要功能包括:本地查询执行,确保数据隐私;数据库浏览,包括表摘要和数据分析;交互式笔记本,用于SQL脚本编写,支持语法高亮和自动完成;以及用于结果分析的列浏览器。MotherDuck集成是可选的。 该UI将笔记本和状态存储在本地DuckDB数据库(`ui.db`)中,并使用高效的二进制数据传输来提供快速体验。虽然前端源代码目前尚未开源,但UI扩展本身已在GitHub上提供。欢迎通过GitHub问题或社区渠道提供反馈和支持。新的UI旨在提供简单、快速且功能丰富的体验。

Hacker News 的讨论围绕着 DuckDB 新的本地 UI 展开。用户普遍赞扬该 UI 的美观性和功能性,但对其开源状态表示担忧。有人澄清说,UI 扩展是开源的,但 UI 本身是专有的,远程托管在 ui.duckdb.org 上。这引发了有关数据安全性和对互联网连接依赖性的问题。 人们对 MotherDuck 的参与表示担忧,因为该 UI 是与他们合作构建的,并且可能模糊了免费和开源工作之间的界限。讨论中涉及商业利益可能掩盖 DuckDB 开源方面的问题。 讨论中提到了其他一些替代方案,例如 Perspective、Apache Superset 中的 SqlLab 等。讨论还重点介绍了 DuckDB 的用例及其与 SQLite 和 Supabase 等工具的比较。

原文
Jeff Raymakers and Gabor Szarnyas

Published on 2025-03-12

TL;DR: The DuckDB team and MotherDuck are excited to announce the release of a local UI for DuckDB shipped as part of the ui extension.

The DuckDB project was built to make it simple to leverage modern database technology. DuckDB can be used from many popular languages and runs on a wide variety of platforms. The included Command Line Interface (CLI) provides a convenient way to interactively run SQL queries from a terminal window, and several third-party tools offer more sophisticated UIs.

The DuckDB CLI provides advanced features like interactive multi-line editing, auto-complete, and progress indicators. However, it can be cumbersome for working with lengthy SQL queries, and its data exploration tools are limited. Many of the available third party UIs are great, but selecting, installing, and configuring one is not straightforward. Using DuckDB through a UI should be as simple as using the CLI. And now it is!

The DuckDB UI is the result of a collaboration between DuckDB Labs and MotherDuck and is shipped as part of the ui extension.

Starting with DuckDB v1.2.1, a full-featured local web user interface is available out-of-the-box! You can start it from the terminal by launching the DuckDB CLI client with the -ui argument:

You can also run the following SQL command from a DuckDB client (e.g., CLI, Python, Java, etc.):

Both of these approaches install the ui extension (if it isn't installed yet), then open the DuckDB UI in your browser:

The DuckDB UI uses interactive notebooks to define SQL scripts and show the results of queries. However, its capabilities go far beyond this. Let’s go over its main features.

The DuckDB UI runs all your queries locally: your queries and data never leave your computer. If you would like to use MotherDuck through the UI, you have to opt-in explicitly.

Databases

Your attached databases are shown on the left. This list includes in-memory databases plus any files and URLs you’ve loaded. You can explore tables and views by expanding databases and schemas.

Table Summary

Click on a table or view to show a summary below. The UI shows the number of rows, the name and type of each column, and a profile of the data in each column.

Select a column to see a more detailed summary of its data. You can use the “Preview data” button near the top right to inspect the first 100 rows. You can also find the SQL definition of the table or view here.

Notebooks

You can organize your work into named notebooks. Each cell of the notebook can execute one or more SQL statements. The UI supports syntax highlighting and autocomplete to assist with writing your queries.

You can run the whole cell, or just a selection, then sort, filter, or further transform the results using the provided controls.

Column Explorer

The right panel contains the Column Explorer, which shows a summary of your results. You can dive into each column to gain insights.

MotherDuck Integration

If you would like to connect to MotherDuck, you can sign into MotherDuck to persist files and tables to a cloud data warehouse crafted for using DuckDB at scale and sharing data with your team.

…And More!

The DuckDB UI is under active development. Expect additions and improvements!

Like the DuckDB CLI, the DuckDB UI creates some files in the .duckdb directory in your home directory. The UI puts its files in a sub-directory, extension_data/ui:

  • Your notebooks and some other state are stored in a DuckDB database, ui.db.
  • When you export data to the clipboard or a file (using the controls below the results), some tiny intermediate files (e.g. ui_export.csv) are generated. Your data is cleared from these files after the export is completed, but some near-empty files remain, one per file type.

Support for the UI is implemented in a DuckDB extension. The extension embeds a localhost HTTP server, which serves the UI browser application, and also exposes an API for communication with DuckDB. In this way, the UI leverages the native DuckDB instance from which it was started, enabling full access to your local memory, compute, and file system.

Results are returned in an efficient binary form closely matching DuckDB’s in-memory representation (DataChunk). Server-sent events enable prompt notification of updates such as attaching databases. These techniques and others make for a low-latency experience that keeps you in your flow.

See the UI extension documentation for more details.

In this blog post, we presented the new DuckDB UI, a powerful web interface for DuckDB.

The DuckDB UI shares many of its design principles with the DuckDB database. It’s simple, fast, feature-rich, and portable, and runs locally on your computer. The DuckDB UI extension is also open source: visit the duckdb/duckdb-ui repository if you want to dive in deeper into the extension's code.

The repository does not contain the source code for the frontend, which is currently not available as open-source. Releasing it as open-source is under consideration.

For help or to share feedback, please file an issue, join the #ui channel in either the DuckDB Discord or the MotherDuck Community Slack.

Happy quacking!

联系我们 contact @ memedata.com