跳到正文
Skillpedia
数据库18k · #10632

write-pipeline

它能做什么

这个技能说明如何在 Windmill 中用通过共享存储和触发器相连的多个独立脚本构建数据管道,而不是用一个流程。适合逐步移动和转换数据的人。

适用场景

  • ✓当你想在 Windmill 中通过多个步骤摄取、转换或物化数据时。
  • ✓当你需要的是数据管道,而不是单个流程时。
  • ✓当某张表应当由写入 DuckLake 表的 DuckDB 脚本生成时。

技能链接

https://github.com/windmill-labs/windmill/blob/main/system_prompts/auto-generated/skills/write-pipeline/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/windmill-labs/windmill/blob/main/system_prompts/auto-generated/skills/write-pipeline/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我构建一个 Windmill 管道,把我们的销售 CSV 加载到一张表中,然后再生成一张月度汇总表。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能会让你的智能体编写小型脚本,每个脚本都带有说明其读取和写入内容的注释,以便 Windmill 管道视图将它们连接起来。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Data pipeline authoring

A data pipeline is NOT a flow. A flow is one runnable that orchestrates steps internally. A data pipeline is a set of independent scripts, each deployed on its own, that form a DAG by reading and writing shared storage assets (DuckLake tables, data tables, S3 objects, volumes, resources) and by declaring execution triggers. The pipeline is visualized and edited at /pipeline/<folder>; every node is a normal workspace script that happens to carry pipeline annotations. When the user asks for a "data pipeline" (or to "ingest / transform / materialize" data across steps), build pipeline-annotated scripts — do NOT build a flow.

Default to DuckDB + DuckLake

A pipeline node that produces a table should almost always be a duckdb node that materializes its output into a DuckLake table with -- materialize ducklake://<name>/<table> (in a DuckDB node the annotation uses SQL -- comment syntax; write the body as a bare SELECT and let the runtime do the write). DuckLake is the default lakehouse store for pipelines and is the shape the pipeline editor is built around, so prefer it unless the work specifically calls for something else:

  • postgresql / data tables — only for row-level, OLTP-style mutations against an existing Postgres data table (frequent single-row upserts/updates, transactional reads that an app queries live).
  • bun / python3 — only for work that doesn't map to SQL: calling an external API, wrangling files, arbitrary glue. When such a node produces tabular data for downstream steps, write it straight into DuckLake (or a data table) from the same script — see "Ingesting from Python / TypeScript" below — rather than inventing a parallel store.

Do not spread a pipeline across postgres, S3, and DuckLake when one DuckLake lake would do; a consistent DuckLake lakehouse is the goal.

Ingesting from Python / TypeScript

A node that fetches data in code (an API, a SaaS export, a scraper) writes the rows directly into their DuckLake table with wmill.ducklake(), or into a data table with wmill.datatable(). DuckLake already stores every table as parquet files in the workspace object storage, so never stage the raw payload first — no intermediate JSON / CSV / parquet file in S3 and no second "load the raw file" node. One ingestion node, one table.

Pass the rows as a query argument (a list of dicts / array of objects is sent as JSON) and let SQL unnest them; declare the column types so the table gets a real schema:

# pipeline
# on schedule
import wmill

def main():
    rows = fetch_charges()  # list[dict]
    lake = wmill.ducklake()
    lake.query("""
        CREATE OR REPLACE TABLE stripe_charges AS
        SELECT unnest(from_json($rows, '[{"id":"VARCHAR","amount":"BIGINT","created":"BIGINT"}]'), recursive := true)
    """, rows=rows).fetch()
// pipeline
// on schedule
import * as wmill from "windmill-client"

export async function main() {
  const rows = await fetchCharges()
  const lake = wmill.ducklake()
  await lake`CREATE OR REPLACE TABLE stripe_charges AS
    SELECT unnest(from_json(${rows}, '[{"id":"VARCHAR","amount":"BIGINT","created":"BIGINT"}]'), recursive := true)`.fetch()
}
  • Use INSERT INTO <table> SELECT ... instead of CREATE OR REPLACE to append (an incremental pull), with a one-time CREATE TABLE IF NOT EXISTS first.
  • Assign the client to a variable (lake = wmill.ducklake()) and keep the SQL a string literal (Python) or a template without sql.raw (TS): that is what lets the graph record the node's write to ducklake://main/<table>. A chained wmill.ducklake().query(...) or SQL built in a variable records no output, so the downstream edge never forms.
  • wmill.ducklake("<name>") targets a non-default catalog; wmill.datatable("<name>") writes a Postgres data table the same way (Python db.query(sql, *args) with $1 placeholders, TS the same template form) — use it only when the data belongs in Postgres (see above).
  • The downstream node triggers on the table itself: -- on ducklake://main/stripe_charges.

Storage prerequisites

A DuckLake pipeline only runs once the workspace has object storage (S3 / Azure Blob / GCS) and a DuckLake catalog configured — DuckLake tables and s3:// assets can't be materialized or read without it. Check which DuckLake catalogs the workspace has before you build. wmill ducklake list lists them. Drafting the annotated scripts does not

常见问题

数据管道和流程一样吗?

不一样。管道是由共享表相连的一组独立脚本,而流程在一个可运行单元内运行其步骤。

什么是 DuckLake?

它是该技能默认用于管道输出的湖仓表存储。

我在哪里查看管道?

Windmill 会在保存这些脚本的文件夹的管道编辑器中显示它。

详情

作者的原始描述

MUST use when creating or modifying a data pipeline, a set of scripts marked `pipeline` and wired together by `on` / `materialize` annotations.

repo: windmill-labs/windmill

热度

GitHub 星标
18k
排名
#10632
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能