# Singer（数据集成规范）

Singer 是一项开源规范，规定了抽取脚本（称为“tap”）与加载脚本（称为“target”）之间交换数据的格式，使得任何 tap 都可以通过管道接入任何 target，从而将数据从任意源迁移到任意目的地。<sup>[1](https://www.singer.io/)</sup> tap 从数据库、Web API、文件或队列等源读取数据，并在标准输出上发出以换行符分隔的 JSON 消息；target 在标准输入上读取这些消息，并将其写入 [PostgreSQL](https://www.edgepedia.org/zh/postgresql)、Google BigQuery 或 CSV 文件等目的地。<sup>[1](https://www.singer.io/)</sup><sup> • </sup><sup>[2](https://7wdata.be/tool/singer-targets/)</sup> 该项目由数据集成公司 Stitch 于 2016 年至 2017 年前后创建，Stitch 后来被 Talend 收购，项目现由 singer-io GitHub 组织维护。<sup>[3](https://7wdata.be/company/singer/)</sup><sup> • </sup><sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义内容 | 一种基于 JSON 的消息格式，通过标准输出和标准输入在抽取器（tap）与加载器（target）之间交换，可借助 Unix 管道组合<sup>[1](https://www.singer.io/)</sup><sup> • </sup><sup>[5](https://github.com/singer-io/getting-started/blob/master/docs/SPEC.md)</sup> |
| 消息类型 | 恰好三种：`SCHEMA`（某个流的 JSON Schema 和 `key_properties`）、`RECORD`（某个流的一行数据）和 `STATE`（用于恢复的书签）<sup>[6](https://hub.meltano.com/singer/spec/)</sup> |
| 规范版本 | 0.3.0，使用语义化版本控制<sup>[6](https://hub.meltano.com/singer/spec/)</sup> |
| tap 的输入 | 一个必需的配置文件（`config`），以及可选的 `state` 和 `catalog` 文件<sup>[5](https://github.com/singer-io/getting-started/blob/master/docs/SPEC.md)</sup><sup> • </sup><sup>[6](https://hub.meltano.com/singer/spec/)</sup> |
| 起源 | 由 Stitch 于 2016–2017 年前后创建（singer-python 仓库可追溯至 2016 年 10 月）；Stitch 于 2018 年被 Talend 收购，现为 Qlik 旗下产品<sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup><sup> • </sup><sup>[7](https://dev.to/airbytehq/airbyte-vs-singer-why-airbyte-is-not-built-on-top-of-singer-20n3)</sup> |
| 生态规模 | singer.io 列出约 106 个 tap 和 10 个 target；MeltanoHub 索引了生态系统中 600 多个连接器<sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup> |
| 实现语言 | 任意语言；tap 和 target 是独立应用程序，基于标准输入输出的 JSON 接口使其与语言无关<sup>[1](https://www.singer.io/)</sup><sup> • </sup><sup>[2](https://7wdata.be/tool/singer-targets/)</sup> |

## 规范如何运作

在 Singer 规范中，tap 是一个接受配置文件以及可选状态文件的程序，按顺序输出 `RECORD`、`STATE` 和 `SCHEMA` 消息；可以使用任何编程语言来构建。<sup>[5](https://github.com/singer-io/getting-started/blob/master/docs/SPEC.md)</sup> 规范定义了三种 JSON 消息类型。`SCHEMA` 消息使用 [JSON Schema](https://www.edgepedia.org/zh/json-schema) 及其 `key_properties` 描述一个流的结构，使 target 能够创建或演进具有丰富数据类型和严格结构的目标表。`RECORD` 消息携带某个流的一行数据，由对应 API 端点或数据库表的 `stream` 名称标识。`STATE` 消息携带运行器应保存的值；下次运行时，tap 读取该状态并从上次中断处继续。<sup>[6](https://hub.meltano.com/singer/spec/)</sup><sup> • </sup><sup>[8](https://docs.meltano.com/reference/glossary)</sup>

由于接口仅是标准输入输出上的 JSON，任何 tap 都可以通过 shell 命令接入任何 target，例如 `tap-exchangeratesapi | target-csv`，singer.io 网站演示了将汇率数据拉取到 CSV 文件中的过程。<sup>[1](https://www.singer.io/)</sup> 这种管道模型意味着不需要中央编排器，不过 Meltano 等工具可以安装、配置和运行 tap 与 target，存储状态书签，并处理 catalog 生成。<sup>[2](https://7wdata.be/tool/singer-targets/)</sup><sup> • </sup><sup>[9](https://docs.meltano.com/guide/integration/)</sup>

状态机制是增量抽取的基础：tap 的状态是一个 JSON 对象，包含一组书签，用于跟踪所有被复制流的恢复点，例如最后更新时间戳。<sup>[8](https://docs.meltano.com/reference/glossary)</sup><sup> • </sup><sup>[2](https://7wdata.be/tool/singer-targets/)</sup> catalog 文件选择要抽取哪些流和字段，并将每个流标记为 FULL_TABLE 或 INCREMENTAL 复制。<sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup>

## 规范之外的能力

规范在高层定义了消息格式，但社区中已经形成了一层规范本身并未记录的常用模式；MeltanoHub 将其编目为“能力”（capabilities）。<sup>[10](https://hub.meltano.com/singer/docs/)</sup> 示例包括：`--catalog` 参数引用一个定义单个或多个流结构的文件；用于同一目的的旧式 `--properties` 参数；以及 `--about` 参数，以 JSON 或 Markdown 格式输出连接器详情、能力和设置，用于程序化生成用户界面表单。<sup>[10](https://hub.meltano.com/singer/docs/)</sup>

另一项能力是内联流映射：tap 或 target 接受 `stream_maps` 配置键，在 tap 与 target 之间执行轻量转换，例如流和属性的别名、流的复制或分叉、PII 的哈希或匿名化、行级过滤，以及流或属性的抑制。此功能内置于 0.3.0 及更高版本基于 SDK 的 tap 和 target 中。<sup>[10](https://hub.meltano.com/singer/docs/)</sup><sup> • </sup><sup>[8](https://docs.meltano.com/reference/glossary)</sup>

一个常见的混淆点涉及删除操作。Singer 中处理删除的两种常用技术是 `ACTIVATE_VERSION` 消息或基于日志的复制（在支持该功能的数据库上），但 `ACTIVATE_VERSION` 并非规范本身的一部分：规范 v0.3.0 恰好定义了三种标准输出消息类型，而 singer-python 将 `ACTIVATE_VERSION` 记录为实验性扩展，大多数 tap 和 target 不应需要它。<sup>[10](https://hub.meltano.com/singer/docs/)</sup><sup> • </sup><sup>[11](https://www.hivebook.wiki/wiki/singer-open-etl-spec-for-taps-and-targets)</sup>

## 工具与生态系统

singer-io GitHub 组织下维护着 200 多个仓库，其中包括核心的 singer-python 库、入门指南，以及大量连接器 tap，覆盖 HubSpot、Marketo、GitLab、AdRoll、Monday.com 和 QuickBase 等服务。<sup>[3](https://7wdata.be/company/singer/)</sup> 辅助工具包括 `singer-check-tap`（验证 tap 的输出是否符合规范）和 `singer-infer-schema`（从 tap 输出推断 JSON Schema，作为通常需要手动编辑的起点）。<sup>[12](https://github.com/singer-io/singer-tools)</sup>

Meltano 是一个围绕 Singer 成长起来的开源 CLI，用于安装 tap 和 target、在 `meltano.yml` 中配置它们、运行它们并存储其进度；它始于 GitLab 内部，于 2021 年 6 月分拆独立。<sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup> MeltanoHub for Singer 将从 GitHub 和 GitLab 等外部来源列出的连接器整理为经过 JSON Schema 验证的 YAML，发布连接器元数据（包括维护者和维护状态）以及 GitHub 指标（如最后更新时间、星标数、未解决问题和拉取请求数）作为衡量质量的间接指标，并通过 JSON API 暴露整个列表。<sup>[10](https://hub.meltano.com/singer/docs/)</sup> Meltano Singer SDK 减少了构建连接器所需的代码，保持其符合规范，并附带预编写的测试。<sup>[10](https://hub.meltano.com/singer/docs/)</sup><sup> • </sup><sup>[13](https://docs.meltano.com/connectors/meltano-hub/maintaining-plugins)</sup>

singer.io 自己的目录列出约 106 个 tap 和 10 个 target，而 MeltanoHub（也列出社区连接器）则宣称拥有 600 多个连接器和工具。<sup>[2](https://7wdata.be/tool/singer-targets/)</sup><sup> • </sup><sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup>

## 历史与 Airbyte 的关系

Stitch 推出 Singer 是为了扩展其预构建的连接器，该项目没有正式的组织结构、没有带薪员工、没有披露的财务信息；它由社区驱动，由 Stitch 赞助。<sup>[3](https://7wdata.be/company/singer/)</sup><sup> • </sup><sup>[4](https://ownpurse.com/landscape/singer-meltano/)</sup><sup> • </sup><sup>[7](https://dev.to/airbytehq/airbyte-vs-singer-why-airbyte-is-not-built-on-top-of-singer-20n3)</sup> 批评者指出了这种模式的后果：每个连接器都是独立的仓库，标准化和协议执行力度薄弱，连接器质量参差不齐，而且由于 API 频繁更改数据结构，存在多年未合并拉取请求的连接器很常见。<sup>[7](https://dev.to/airbytehq/airbyte-vs-singer-why-airbyte-is-not-built-on-top-of-singer-20n3)</sup> 社区自己也承认，许多沿袭的惯例从未被记录下来，修复单个缺陷的分支往往从未合并回上游。<sup>[13](https://docs.meltano.com/connectors/meltano-hub/maintaining-plugins)</sup>

[Airbyte](https://www.edgepedia.org/zh/airbyte) 最初基于 Singer tap 构建产品，但后来转向了自己的 Airbyte 协议（与 Singer 兼容），理由正是那些标准化和所有权方面的担忧；Airbyte 的协议文档将 Singer.io 的规范列为灵感来源。<sup>[7](https://dev.to/airbytehq/airbyte-vs-singer-why-airbyte-is-not-built-on-top-of-singer-20n3)</sup><sup> • </sup><sup>[14](https://github.com/airbytehq/airbyte/blob/master/docs/platform/understanding-airbyte/airbyte-protocol.md)</sup> Airbyte 后来完全移除了其 Singer 适配器，于 2022 年 5 月 5 日删除了 `airbyte-integrations/bases/base-singer`，因此它不再直接运行 Singer tap，不过一个社区包装 tap（MeltanoLabs tap-airbyte-wrapper）可以让 Singer target 消费 Airbyte 源连接器。<sup>[11](https://www.hivebook.wiki/wiki/singer-open-etl-spec-for-taps-and-targets)</sup><sup> • </sup><sup>[15](https://github.com/MeltanoLabs/tap-airbyte-wrapper)</sup>

规范本身实际上已经冻结：规范文档仍显示版本 0.3.0，入门仓库唯一的发布标签是 2017 年 11 月 20 日的 v0.1.0，而生态活动已转移到连接器、SDK 和目录平台工具上。<sup>[11](https://www.hivebook.wiki/wiki/singer-open-etl-spec-for-taps-and-targets)</sup> 2026 年，Meltano 团队发布了一份规范的简化解读，整合了分散在多个页面上的材料，并明确表示不打算取代规范原文，计划将该解读移至中立场所，使其不隶属于任何公司。<sup>[16](https://meltano.com/blog/a-simplified-take-on-the-singer-spec)</sup>

## References

1. [Singer | Open Source ETL](https://www.singer.io/)
2. [Singer Targets, 7wData](https://7wdata.be/tool/singer-targets/)
3. [Singer, 7wData](https://7wdata.be/company/singer/)
4. [Singer and Meltano, the landscape, ownpurse](https://ownpurse.com/landscape/singer-meltano/)
5. [Singer Specification, docs/SPEC.md, singer-io/getting-started, GitHub](https://github.com/singer-io/getting-started/blob/master/docs/SPEC.md)
6. [Singer Spec, Meltano Hub](https://hub.meltano.com/singer/spec/)
7. [Airbyte vs. Singer: Why Airbyte Is Not Built on Top of Singer, DEV Community (John Lafleur, Airbyte COO and co-founder)](https://dev.to/airbytehq/airbyte-vs-singer-why-airbyte-is-not-built-on-top-of-singer-20n3)
8. [Glossary, Meltano Documentation](https://docs.meltano.com/reference/glossary)
9. [Replicate Data, Meltano Documentation](https://docs.meltano.com/guide/integration/)
10. [Meltano Hub for Singer documentation](https://hub.meltano.com/singer/docs/)
11. [Singer, Open ETL Spec for Taps and Targets, Hivebook](https://www.hivebook.wiki/wiki/singer-open-etl-spec-for-taps-and-targets)
12. [singer-io/singer-tools, GitHub](https://github.com/singer-io/singer-tools)
13. [Maintaining Taps & Targets, Meltano Documentation](https://docs.meltano.com/connectors/meltano-hub/maintaining-plugins)
14. [Airbyte Protocol, airbytehq/airbyte documentation, GitHub](https://github.com/airbytehq/airbyte/blob/master/docs/platform/understanding-airbyte/airbyte-protocol.md)
15. [MeltanoLabs/tap-airbyte-wrapper, GitHub](https://github.com/MeltanoLabs/tap-airbyte-wrapper)
16. [A Simplified Take on the Singer Spec, Meltano blog](https://meltano.com/blog/a-simplified-take-on-the-singer-spec)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Data mining, warehousing, and big data

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/singer-data-integration-specification

English original: https://www.edgepedia.org/singer-data-integration-specification
