惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Check Point Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
WordPress大学
WordPress大学
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
N
Netflix TechBlog - Medium
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 聂微东
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 叶小钗
Cisco Talos Blog
Cisco Talos Blog
S
Schneier on Security
T
Threat Research - Cisco Blogs
腾讯CDC
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Hacker News
The Hacker News
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
N
News | PayPal Newsroom
L
LINUX DO - 最新话题
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Palo Alto Networks Blog
T
Tenable Blog
S
Secure Thoughts
T
Threatpost
V2EX - 技术
V2EX - 技术
大猫的无限游戏
大猫的无限游戏
Martin Fowler
Martin Fowler
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
罗磊的独立博客
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
小众软件
小众软件
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Y
Y Combinator Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
P
Privacy International News Feed
H
Heimdal Security Blog
量子位
B
Blog

博客园 - harrychinese

机器学习实战示例和基础知识查漏补缺 jupyter notebook上的java kernel 数据分析中几个常用的java类 我认为 C# 几个重要的设计缺陷 Jupyter notebook 最简安装方法 使用Tribuo分析波士顿房产数据 Java 语言常用的技巧 Java AI agent框架 java jbang 工具让java作为脚本语言 VS code + Jypyter 插件构建 Java notebook 环境 使用 VS code + Oracle java 插件搭建java语言原生的notebook环境 【计算机科学速成课】[40集全/精校] - Crash Course Computer Science Handy toolbox for IT developers 中学学校教材下载 深度学习模型训练5个关键步骤 使用SpringBoot实现一个执行通用SQL的Rest接口 学益升X1和国悦K3阅读器 状态机 使用场景规则匹配模式代替复杂的if else条件判断 vscode 数据处理的插件 iPhone XR 升级非最新版IOS nuget打包部署完整步骤 ML.Net机器学习基本知识 机器学习资料汇总 优化算法知识和类库 C# XML 序列化器 画草图和示意图的好工具 .net debug tools 运筹学/最优化讲义.pdf Lazarus
duckdb
harrychinese · 2025-05-31 · via 博客园 - harrychinese

duckdb 的限制

  1. 可以多线程并发读, 但不能多线程并发写数据库.

duckdb 的作用

  1. 数据交换格式, 尤其适合于用于较大的数据传输, 比csv格式更好, 有主外键约束, 有非空约束, 每列都有强数据类型, 避免出现脏数据, 列式数据库文件压缩效果好
  2. 数据处理引擎, 可以读写csv/json/parquet文件, 甚至支持RDBMS读写, 然后利用duckdb强大的SQL特性, 进行数据分析和处理.
  3. 数据探索工具, 可以非常容易集成到Jupyter Notebook中, 可以从Python DataFrame对象读取, 然后利用强大的SQL特性, 进行数据分析. 也可以将sql的结果回写到 DataFrame, 可以同时获得SQL和DataFrame的数据探索的优势.

duckdb 读取 DataFrame 的示例

import duckdb
import pandas as pd

# Create a DataFrame, in this case using Pandas
my_df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})

# Query it directly with SQL - no explicit conversion needed
result = duckdb.sql("SELECT * FROM my_df WHERE a > 1")

将 duckdb 转成 DataFrame 并可视化

import duckdb
import polars as pl
import plotly.express as px

# Use SQL to load data and apply a complex aggregation
regional_summary = duckdb.query("""
    SELECT 
        region, 
        SUM(sales) as total_sales,
        COUNT(DISTINCT customer_id) as customer_count,
        SUM(sales) / COUNT(DISTINCT customer_id) as sales_per_customer
    FROM read_csv('sales_data*.csv')
    WHERE sale_date >= '2024-01-01'
    GROUP BY region
    ORDER BY total_sales DESC
""").pl()

# Use summarised data in Polars for visualization
fig = px.bar(
    regional_summary,
    x="region",
    y="sales_per_customer",
)

fig.show()


参考

https://endjin.com/blog/2025/04/duckdb-in-depth-how-it-works-what-makes-it-fast
https://endjin.com/blog/2025/04/duckdb-in-practice-enterprise-integration-architectural-patterns
https://www.timestored.com/data/duckdb/
https://github.com/davidgasquez/awesome-duckdb

建构数仓项目完整架构体系

https://dlthub.com/blog/dlt-motherduck-demo
https://datawise.dev/a-portable-data-stack-with-dagster-docker-duckdb-dbt-and-superset

参考博文1中给出了一个基于 dlt 和 dbt 和 duckdb 的数仓架构:
图片

图片