使用Duckdb
之前使用Duckdb,通常是使用培python调用duckdb进行数据分析,或者是直接使用命令行
这两种方式虽说是非常不错,但是针对非技术人员来说,还是有一些陌生,而使用第三方的图形界面
例如:DBeaver Community 或者 Navicat 社区版 则又要下载安装和配置。 Navicat Premium Lite 还有人数限制
Command Line Interface (CLI) 命令行
Graphical User Interface (GUI) 图形用户界面
现在使用duckdb
在版本1.2,又了新的选择,即使用duckdb自带的UI界面,这个UI界面是基于浏览器的。
使用方式
方式一: 打开duckdb的时候使用 duckdb -ui
UI started at http://localhost:4213/
方式二: 打开duckdb后执行命令 CALL start_ui();
宣称数据是本地查看,需要看以下源代码,因为 localhost:4213/config 中有访问外部链接
查看安装的插件
: In-tree extensions and out-of-tree extensions.
SELECT extension_name, installed, description FROM duckdb_extensions() where installed =true;
ui │ true │ Adds local UI for DuckDB
.show
创建一个全局存储在Python模块中的内存数据库。如果关闭启动连接的程序,就会丢失数据库和数据。
如果希望持久化数据,则传递文件名进行连接,以便它创建与数据库对应的文件
在Chrome 浏览器打开有问题,在windows 自带的浏览器可以打开
Welcome to the DuckDB UI
前端没有开源--后端开源了,看什么时候前端也开源吧
架构
文件: 数据存储--数据库的安装
third_party/httplib/httplib.hpp
嵌入了一个http服务器-- a localhost HTTP server, UI browser 浏览器作为客户端
CALL start_ui_server();
cpp-httplib 是个开源的库,是一个c++封装的http库,使用这个库可以在linux、windows平台下完成http客户端、http服务端的搭建,
这是一个多线程“阻塞”HTTP 库
https://github.com/yhirose/cpp-httplib/blob/v0.14.3/httplib.h
third_party/httplib/httplib.hpp
src/http_server.cpp
server->DoStart(port, remote_url)
server.listen("localhost", local_port);
HTTP 500错误,也称为“500 Internal Server Error”,是一个常见的服务器端错误状态码
Jwt is missing
在处理JWT(JSON Web Tokens)时,如果遇到“Jwt is missing”这样的错误,通常表示在请求中没有正确地包含JWT
localhost
localhost:4213/config
{
"apiUrl": "https://api.motherduck.com",
"momApiUrl": "https://api.motherduck.com/mom",
"datadog": {
"applicationId": "09ea56",
"clientToken": " ",
"site": "datadoghq.com",
"env": "prod",
"allowedTracingOrigins": ["https://api.motherduck.com"]
},
"logging": {
"enabled": true,
"env": "prod"
},
"defaultFeatureValues": {
"MDDuckDBCompatibilityModeMigrationSetting": true,
"MDFixIt": true
},
"calendlyOnboardingCallUrl": "https://calendly.com/d/cmyb-8m7-8dr/intro-to-motherduck-call"
Datadog作为一款专为云时代设计的监控和分析平台
Modern monitoring & security
the setting is only respected if allow_unsigned_extensions is enabled.
参考
The DuckDB Local UI https://duckdb.org/2025/03/12/duckdb-ui.html
MotherDuck UI https://motherduck.com/docs/getting-started/motherduck-quick-tour/
SET ui_local_port = 4213; https://github.com/duckdb/duckdb-ui
https://github.com/duckdb/duckdb/releases/tag/v1.2.1