



















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")
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 的数仓架构:


此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。