<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>数据仓库 on 老张开工了</title>
    <link>/%E6%95%B0%E6%8D%AE%E4%BB%93%E5%BA%93/</link>
    <description>Recent content in 数据仓库 on 老张开工了</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Thu, 23 Apr 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="/%E6%95%B0%E6%8D%AE%E4%BB%93%E5%BA%93/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>SQL 在 ETL 中的应用</title>
      <link>/posts/2026/04/etl-sql/</link>
      <pubDate>Thu, 23 Apr 2026 00:00:00 +0000</pubDate>
      <guid>/posts/2026/04/etl-sql/</guid>
      <description>SQL 在 ETL 中的角色 很多人一提到 ETL 就想到 Python 或 Spark，但 SQL 才是 ETL 领域最基础也最强大的工具。无论你用什么框架，最终的数据操作大多会落到 SQL 上。dbt 用 SQL 做转换，Spark SQL 用 SQL 做分析，甚至 Pandas 的 DataFrame 操作在概念上也和 SQL 的 SELECT、GROUP BY、JOIN 一一对应。&#xA;SQL 的优势在于声明式：你告诉数据库&amp;quot;要什么&amp;quot;，而不是&amp;quot;怎么做&amp;quot;。数据库优化器会帮你决定最佳的执行路径。对于数据量在千万级以下的 ETL 任务，纯 SQL 方案往往比 Python 方案更简洁、更高效。&#xA;CTE：构建可读的 ETL 管道 公用表表达式（CTE）是 SQL ETL 中最有用的语法之一。它让你能把复杂的转换拆成多个逻辑步骤，每个步骤清晰独立，就像管道中的一个个节点。&#xA;`sql &amp;ndash; 一个典型的 ETL 管道，用 CTE 分步实现 WITH &amp;ndash; 步骤 1：抽取原始数据 raw_orders AS ( SELECT * FROM orders WHERE order_date &amp;gt;= &amp;lsquo;2026-01-01&amp;rsquo; ),</description>
    </item>
  </channel>
</rss>
