<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bechir Bejaoui</title>
    <description>The latest articles on DEV Community by Bechir Bejaoui (@bejaouibechir).</description>
    <link>https://dev.to/bejaouibechir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4134552%2Fe4bd4d74-bd01-4006-b48b-2772e2ed25be.jpeg</url>
      <title>DEV Community: Bechir Bejaoui</title>
      <link>https://dev.to/bejaouibechir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bejaouibechir"/>
    <language>en</language>
    <item>
      <title>Protecting the source of a PostgreSQL CDC mirror: a step-by-step walkthrough in Hydra Studio</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Wed, 11 Nov 2026 20:57:24 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/protecting-the-source-of-a-postgresql-cdc-mirror-a-step-by-step-walkthrough-in-hydra-studio-5cnc</link>
      <guid>https://dev.to/bejaouibechir/protecting-the-source-of-a-postgresql-cdc-mirror-a-step-by-step-walkthrough-in-hydra-studio-5cnc</guid>
      <description>&lt;p&gt;This walkthrough shows what Hydra ETL does on a real PostgreSQL 16 to protect the source of CDC mirror, in four scenes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A normal mirror.&lt;/li&gt;
&lt;li&gt;The mirror breaks and the WAL piles up: &lt;strong&gt;Hydra ETL warns, and a workflow sends an alert.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;max_slot_wal_keep_size&lt;/code&gt; protects the disk and PostgreSQL invalidates the slot: &lt;strong&gt;Hydra ETL stops instead of going on with a gap.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Rebuilding the mirror.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Every screenshot below comes from this exact sequence, run end to end.&lt;/p&gt;




&lt;h2&gt;
  
  
  0. Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;Python 3.10+&lt;/li&gt;
&lt;li&gt;The Hydra ETL repository: &lt;a href="https://github.com/bejaouibechir/Hydra" rel="noopener noreferrer"&gt;https://github.com/bejaouibechir/Hydra&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Start PostgreSQL with logical replication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run --name hydra-pg-cdc -e &lt;span class="nv"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;hydra -p 5433:5432 -d postgres:16 -c &lt;span class="nv"&gt;wal_level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;logical
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to the example, create its &lt;code&gt;.env&lt;/code&gt;, and create the two databases: &lt;code&gt;shop&lt;/code&gt; (the application) and &lt;code&gt;analytics&lt;/code&gt; (the mirror):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/bejaouibechir/hydra-tuto-cdc-slot-protection.git
&lt;span class="nb"&gt;cd&lt;/span&gt; examples/postgres-cdc-mirror
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'PG_HOST=127.0.0.1\nPG_PORT=5433\nPG_USER=postgres\nPG_PASSWORD=hydra\n'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .env
docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i hydra-pg-cdc psql -U postgres &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; db/initdb.sql
docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i hydra-pg-cdc psql -U postgres &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; db/seed.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;On Windows PowerShell, &lt;code&gt;&amp;lt;&lt;/code&gt; does not redirect: use &lt;code&gt;Get-Content db/initdb.sql | docker exec -i hydra-pg-cdc psql -U postgres&lt;/code&gt;, and the same for every &lt;code&gt;db/*.sql&lt;/code&gt; script below.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt; &lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;initdb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;docker&lt;/span&gt; &lt;span class="n"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;hydra&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;pg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cdc&lt;/span&gt; &lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt; &lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;docker&lt;/span&gt; &lt;span class="n"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;hydra&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;pg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cdc&lt;/span&gt; &lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start Studio, then open the folder &lt;code&gt;examples/postgres-cdc-mirror&lt;/code&gt; (&lt;strong&gt;Open a project&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hdrctl serve --open
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj8blfkgit4qd78ab2kqt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj8blfkgit4qd78ab2kqt.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A normal mirror&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The job
&lt;/h3&gt;

&lt;p&gt;Open the &lt;code&gt;sync&lt;/code&gt; workflow, then the job &lt;code&gt;orders_mirror&lt;/code&gt;. It has two nodes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the source &lt;code&gt;order_changes&lt;/code&gt;, of type &lt;strong&gt;PostgreSQL CDC&lt;/strong&gt;: table &lt;code&gt;public.orders&lt;/code&gt;, slot &lt;code&gt;hydra_orders&lt;/code&gt;, publication &lt;code&gt;hydra_orders&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;the destination &lt;code&gt;mirror&lt;/code&gt;: PostgreSQL, table &lt;code&gt;analytics.orders&lt;/code&gt;, mode &lt;code&gt;upsert&lt;/code&gt; on &lt;code&gt;order_id&lt;/code&gt;, atomic load.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo3lpxhbtujtm8vadk927.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo3lpxhbtujtm8vadk927.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Double-click the source to see its settings:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fly0bcojpemkfrhagkohh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fly0bcojpemkfrhagkohh.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lower the warning threshold for the demo&lt;/p&gt;

&lt;p&gt;By default, Hydra ETL warns when the slot keeps more than 1 GB of WAL. For the demo we lower it to 5 MB. Add one line under &lt;code&gt;connection&lt;/code&gt; in &lt;code&gt;jobs/orders_mirror/sources.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;      &lt;span class="na"&gt;slot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hydra_orders&lt;/span&gt;
      &lt;span class="na"&gt;publication&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hydra_orders&lt;/span&gt;
      &lt;span class="na"&gt;lag_warning_mb&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;                 &lt;span class="c1"&gt;# demo: warn from 5 MB of WAL kept
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The node form does not show this key. Studio reloads the file and keeps the key when it saves the job. &lt;strong&gt;Hydra DSL&lt;/strong&gt; shows&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flyau0t1z3p30w0r5g2hs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flyau0t1z3p30w0r5g2hs.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First run&lt;/p&gt;

&lt;p&gt;Go to the &lt;strong&gt;Workflow configuration&lt;/strong&gt; tab and clic &lt;strong&gt;Run Workflow&lt;/strong&gt;. On this first run, Hydra ETL creates the publication and the slot, then copies the whole table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fanw6dvy5203ulaazz45s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fanw6dvy5203ulaazz45s.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
Check both tables. Studio has a terminal (the &lt;code&gt;&amp;gt;_&lt;/code&gt; button of the canvas, tab &lt;strong&gt;TERMINAL&lt;/strong&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i hydra-pg-cdc psql -U postgres &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; db/check.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt; &lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;docker&lt;/span&gt; &lt;span class="n"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;hydra&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;pg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cdc&lt;/span&gt; &lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi6vfck5d0so3iakvxb71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fi6vfck5d0so3iakvxb71.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The mirror breaks, the WAL piles up&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Break the mirror
&lt;/h3&gt;

&lt;p&gt;The mirror refuses negative amounts. The shop updates 500 orders and records one order at -15.00:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i hydra-pg-cdc psql -U postgres &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; db/break.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt; &lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;docker&lt;/span&gt; &lt;span class="n"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;hydra&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;pg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cdc&lt;/span&gt; &lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the project. The run fails on the negative amount, the mirror does not change, and the slot does not move: the 500 updates will be read again at the next run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmx4c94hhyi79tc4h22jj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmx4c94hhyi79tc4h22jj.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The source keeps working&lt;/p&gt;

&lt;p&gt;Meanwhile, the application keeps writing. &lt;code&gt;db/wal.sql&lt;/code&gt; writes about 30 MB of WAL into a table that is not mirrored, then shows the slot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; -i hydra-pg-cdc psql -U postgres &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; db/wal.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt; &lt;span class="nc"&gt;Get&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Content&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;wal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;docker&lt;/span&gt; &lt;span class="n"&gt;exec&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="n"&gt;hydra&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;pg&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;cdc&lt;/span&gt; &lt;span class="n"&gt;psql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;U&lt;/span&gt; &lt;span class="n"&gt;postgres&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc2iz0mrpetw0jzkq8s92.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc2iz0mrpetw0jzkq8s92.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What Hydra ETL does before each run&lt;/p&gt;

&lt;p&gt;Run the project again. Before reading anything, the CDC source reads the state of its slot in &lt;code&gt;pg_replication_slots&lt;/code&gt;. The slot keeps more than &lt;code&gt;lag_warning_mb&lt;/code&gt;, and the run says so:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft0cdfn7vsykaskitc8hk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft0cdfn7vsykaskitc8hk.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A warning in a run log is not an alert, though: nobody reads logs on a Saturday. The next step sends it somewhere.&lt;/p&gt;




&lt;h2&gt;
  
  
  2 bis. Send an alert with a fallback
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;fallback&lt;/strong&gt; replaces a workflow when a condition is true, checked just before the workflow starts. Two conditions read the slot:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Returns&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cdc.slot_lag('order_changes')&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;WAL kept by the slot, compared with &lt;code&gt;5MB&lt;/code&gt;, &lt;code&gt;2GB&lt;/code&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cdc.slot_status('order_changes')&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;reserved&lt;/code&gt;, &lt;code&gt;extended&lt;/code&gt;, &lt;code&gt;unreserved&lt;/code&gt;, &lt;code&gt;lost&lt;/code&gt; or &lt;code&gt;missing&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  1) The alert URL as a secret
&lt;/h3&gt;

&lt;p&gt;To try it, take a free URL on &lt;a href="https://webhook.site" rel="noopener noreferrer"&gt;https://webhook.site&lt;/a&gt;: it shows every request it receives. Any chat webhook (Slack, Teams…) works the same way.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Project settings › Secrets&lt;/strong&gt;, add &lt;code&gt;ALERT_WEBHOOK_URL&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdoe0w809e2d0d9g4tgus.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdoe0w809e2d0d9g4tgus.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) The replacement workflow&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;workflows/sync_with_alert.yaml&lt;/code&gt;. It sends the alert, then runs the same job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0"&lt;/span&gt;
&lt;span class="na"&gt;workflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sync_with_alert&lt;/span&gt;
  &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;alert&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;action&lt;/span&gt;
      &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;webhook&lt;/span&gt;
      &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${SECRET:ALERT_WEBHOOK_URL}&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"CDC slot of order_changes is falling behind: the mirror has not loaded for a while."&lt;/span&gt;
      &lt;span class="na"&gt;on_failure&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;continue&lt;/span&gt;        &lt;span class="c1"&gt;# an alert that fails must not block the load
&lt;/span&gt;    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;job&lt;/span&gt;
      &lt;span class="na"&gt;job&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;../jobs/orders_mirror&lt;/span&gt;
      &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Studio picks it up:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftakuzdc4jkk5jbolva9r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftakuzdc4jkk5jbolva9r.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
The replacement runs the job too: the alert does not stop the mirror from catching up once it is repaired.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) The fallback on &lt;code&gt;sync&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In &lt;strong&gt;Project settings › Execution order&lt;/strong&gt;, click the fallback button of &lt;code&gt;sync&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;replace with&lt;/strong&gt;: &lt;code&gt;sync_with_alert&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;when&lt;/strong&gt;: build the condition with the assistant (&lt;strong&gt;insert&lt;/strong&gt; a function, its source, the comparison, the value);&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;if a check cannot answer&lt;/strong&gt;: keep &lt;code&gt;sync&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw48dmae98437dz0v4sso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw48dmae98437dz0v4sso.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvjz3vobpidwr1epv3ir8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvjz3vobpidwr1epv3ir8.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;lost&lt;code&gt;is tested first: on an invalidated slot&lt;/code&gt;cdc.slot_lag&lt;code&gt;cannot answer, and&lt;/code&gt;or&lt;code&gt;stops at the first true condition. The saved&lt;/code&gt;workflows/thread.yaml`:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`yaml&lt;br&gt;
thread:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mode: sequential
workflows:

&lt;ul&gt;
&lt;li&gt;name: sync
fallback:
  use: [sync_with_alert]
  when: "cdc.slot_status('order_changes') == 'lost' or cdc.slot_status('order_changes') == 'unreserved' or cdc.slot_lag('order_changes') &amp;gt; 5MB"
`&lt;code&gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4) Run
&lt;/h3&gt;

&lt;p&gt;Run the project. The run says which workflow ran, and why: the value of each condition.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9lbje4hppv78lx0wx8pk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9lbje4hppv78lx0wx8pk.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The alert was received (here by a local test receiver; webhook.site shows the same body):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo1bizbluau3xxjhmghs0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo1bizbluau3xxjhmghs0.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Protect the disk: &lt;code&gt;max_slot_wal_keep_size&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The alert tells someone. If nobody fixes the mirror over the weekend, the disk still fills up. PostgreSQL 13+ can cap the WAL a slot holds:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
ALTER SYSTEM SET max_slot_wal_keep_size = '20GB';&lt;br&gt;
SELECT pg_reload_conf();&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is a trade-off. Past the limit, PostgreSQL &lt;strong&gt;invalidates&lt;/strong&gt; the slot (&lt;code&gt;wal_status = lost&lt;/code&gt;): the WAL is removed, and the changes made since the last success can no longer be read. The disk is safe, but the change stream now has a gap.&lt;/p&gt;

&lt;p&gt;For the demo, &lt;code&gt;db/limit.sql&lt;/code&gt; sets the limit to 1 MB, and the source writes some more:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
docker exec -i hydra-pg-cdc psql -U postgres &amp;lt; db/limit.sql&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;powershell&lt;br&gt;
 Get-Content db/limit.sql | docker exec -i hydra-pg-cdc psql -U postgres&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7a0rr0l3p4nlxtgrqf4u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7a0rr0l3p4nlxtgrqf4u.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What Hydra ETL does&lt;/p&gt;

&lt;p&gt;Run the project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the fallback switches on &lt;code&gt;cdc.slot_status('order_changes') = lost&lt;/code&gt;, and the alert is sent;&lt;/li&gt;
&lt;li&gt;the job &lt;strong&gt;fails on purpose&lt;/strong&gt;, before reading anything, and says how to rebuild the mirror.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhl7e7qymh9xeaxxrt0wo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhl7e7qymh9xeaxxrt0wo.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Resuming after the gap would have made a mirror that looks fine and is wrong. Hydra ETL refuses to do that.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Rebuild the mirror
&lt;/h2&gt;

&lt;p&gt;Fix the wrong order at the source, then follow the three steps of the message. &lt;code&gt;db/rebuild.sql&lt;/code&gt; drops the slot, empties the mirror and gives the server back its default limit:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
docker exec -i hydra-pg-cdc psql -U postgres &amp;lt; db/repair.sql&lt;br&gt;
docker exec -i hydra-pg-cdc psql -U postgres &amp;lt; db/rebuild.sql&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;powershell&lt;br&gt;
 Get-Content db/repair.sql | docker exec -i hydra-pg-cdc psql -U postgres&lt;br&gt;
 Get-Content db/rebuild.sql | docker exec -i hydra-pg-cdc psql -U postgres&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Run the project. The slot is gone, so &lt;code&gt;cdc.slot_status&lt;/code&gt; is &lt;code&gt;missing&lt;/code&gt; and the fallback is not needed. &lt;code&gt;sync&lt;/code&gt; creates a new slot and copies the table again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbl69aptobmh2r5u0dwq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbl69aptobmh2r5u0dwq8.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
docker exec -i hydra-pg-cdc psql -U postgres &amp;lt; db/check.sql&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&lt;/code&gt;&lt;code&gt;powershell&lt;br&gt;
 Get-Content db/check.sql | docker exec -i hydra-pg-cdc psql -U postgres&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8m8jpc0wrz6q35zbnch5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8m8jpc0wrz6q35zbnch5.png" alt=" " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Summary&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State of the slot&lt;/th&gt;
&lt;th&gt;Before each run, the job&lt;/th&gt;
&lt;th&gt;The &lt;code&gt;cdc.*&lt;/code&gt; fallback conditions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;WAL kept above &lt;code&gt;lag_warning_mb&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;writes a warning, goes on&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cdc.slot_lag(…) &amp;gt; 2GB&lt;/code&gt; → alert&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;wal_status = unreserved&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;writes a warning, goes on&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cdc.slot_status(…) == 'unreserved'&lt;/code&gt; → alert&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;wal_status = lost&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;fails&lt;/strong&gt;, with the steps to rebuild&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cdc.slot_status(…) == 'lost'&lt;/code&gt; → alert&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To watch the slot from your own monitoring:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;sql&lt;br&gt;
SELECT slot_name, active, wal_status, safe_wal_size,&lt;br&gt;
       pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS retained_wal&lt;br&gt;
FROM pg_replication_slots;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Clean up:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;bash&lt;br&gt;
docker rm -f hydra-pg-cdc&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>devops</category>
      <category>sql</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A PostgreSQL mirror that loses nothing, even when the load fails</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Mon, 09 Nov 2026 21:34:05 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/a-postgresql-mirror-that-loses-nothing-even-when-the-load-fails-24nc</link>
      <guid>https://dev.to/bejaouibechir/a-postgresql-mirror-that-loses-nothing-even-when-the-load-fails-24nc</guid>
      <description>&lt;p&gt;You have an application database and you want a copy of one of its tables somewhere else, for reporting. Copying the whole table every night works until the table gets big, or until you need the deletes too.&lt;/p&gt;

&lt;p&gt;The usual answer is change data capture: read the inserts, updates and deletes from PostgreSQL's write-ahead log and apply them to the copy. The usual tool for that is Debezium, which typically runs on Kafka Connect. That's a lot of infrastructure for one mirror table.&lt;/p&gt;

&lt;p&gt;PostgreSQL has had everything needed built in since version 10: logical replication, a publication that says which tables to follow, and a replication slot that remembers how far a reader got. Hydra ETL 0.20 adds a source that uses exactly that, with nothing to install on the server.&lt;/p&gt;

&lt;p&gt;The interesting part isn't reading the changes. It's what happens when writing them fails halfway.&lt;/p&gt;

&lt;p&gt;Everything below runs from one repository: the database, its creation and seed scripts, the Hydra ETL job and the SQL for every step. You only need Docker and Python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/bejaouibechir/hydra-cdc-mirror-demo.git
&lt;span class="nb"&gt;cd &lt;/span&gt;hydra-cdc-mirror-demo
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s2"&gt;"hydra-etl[postgres]&amp;gt;=0.20"&lt;/span&gt;
./scripts/start.sh            &lt;span class="c"&gt;# Windows PowerShell: .\scripts\start.ps1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;start&lt;/code&gt; launches PostgreSQL 16 in Docker with &lt;code&gt;wal_level=logical&lt;/code&gt; (the only server setting CDC needs), on port 5433 so it doesn't clash with a PostgreSQL you may already run. At its first start, the container runs &lt;code&gt;db/initdb.sql&lt;/code&gt; and &lt;code&gt;db/seed.sql&lt;/code&gt;: two databases, &lt;code&gt;shop&lt;/code&gt; (the application) and &lt;code&gt;analytics&lt;/code&gt; (the mirror), and 1,000 orders in &lt;code&gt;shop.orders&lt;/code&gt;. Prefer a zip to git? The repository has one, next to the code.&lt;/p&gt;

&lt;p&gt;The connection settings live in &lt;code&gt;.env&lt;/code&gt;, shared by Docker and Hydra ETL. They are named &lt;code&gt;DEMO_PG_*&lt;/code&gt; on purpose: a &lt;code&gt;PG_PORT&lt;/code&gt; or &lt;code&gt;PG_USER&lt;/code&gt; already set on your machine can't interfere with the demo.&lt;/p&gt;

&lt;p&gt;The Hydra ETL job is two files. The source reads the changes of &lt;code&gt;public.orders&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# jobs/orders_mirror/sources.yaml&lt;/span&gt;
&lt;span class="na"&gt;sources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;order_changes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgresql_cdc&lt;/span&gt;
    &lt;span class="na"&gt;connection&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_HOST&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_PORT&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_USER&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;        &lt;span class="c1"&gt;# needs the REPLICATION attribute&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_PASSWORD&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;shop&lt;/span&gt;
      &lt;span class="na"&gt;slot&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hydra_orders&lt;/span&gt;                    &lt;span class="c1"&gt;# created at the first run&lt;/span&gt;
      &lt;span class="na"&gt;publication&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hydra_orders&lt;/span&gt;             &lt;span class="c1"&gt;# created at the first run&lt;/span&gt;
    &lt;span class="na"&gt;extract&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;public.orders&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The destination applies them to the mirror:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# jobs/orders_mirror/destinations.yaml&lt;/span&gt;
&lt;span class="na"&gt;destinations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;mirror&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgresql&lt;/span&gt;
    &lt;span class="na"&gt;connection&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_HOST&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_PORT&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_USER&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;env:DEMO_PG_PASSWORD&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;analytics&lt;/span&gt;
    &lt;span class="na"&gt;load&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders&lt;/span&gt;
      &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;upsert&lt;/span&gt;       &lt;span class="c1"&gt;# inserts and updates are upserted, deletes are applied&lt;/span&gt;
      &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;order_id&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;atomic&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;       &lt;span class="c1"&gt;# all or nothing&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  First run: the whole table
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hdrctl run &lt;span class="nb"&gt;.&lt;/span&gt;
./scripts/sql.sh check        &lt;span class="c"&gt;# PowerShell: .\scripts\sql.ps1 check&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first run creates the publication and the slot, then copies the whole table. The mirror table is created with the source's types (&lt;code&gt;bigint&lt;/code&gt;, &lt;code&gt;numeric&lt;/code&gt;, &lt;code&gt;jsonb&lt;/code&gt;, &lt;code&gt;timestamptz&lt;/code&gt;) and &lt;code&gt;order_id&lt;/code&gt; as primary key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;shop.orders&lt;/code&gt;: 1,000 rows, total 453855.00&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analytics.orders&lt;/code&gt;: 1,000 rows, total 453855.00&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A day of changes
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;db/changes.sql&lt;/code&gt; adds 20 orders, refunds 3 and deletes 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'paid'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'{"channel": "web"}'&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;generate_series&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1020&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;g&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'refunded'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;updated_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;230&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;DELETE&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;999&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/sql.sh changes
hdrctl run &lt;span class="nb"&gt;.&lt;/span&gt;
./scripts/sql.sh check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This time Hydra ETL reads only the 24 changes, in the order of the transactions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;shop.orders&lt;/code&gt;: 1,019 rows, 3 refunded, total 454582.31&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analytics.orders&lt;/code&gt;: 1,019 rows, 3 refunded, total 454582.31&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each change arrives as a row with three extra columns: &lt;code&gt;_op&lt;/code&gt; (&lt;code&gt;insert&lt;/code&gt;, &lt;code&gt;update&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt;), &lt;code&gt;_lsn&lt;/code&gt; (its position in the log) and &lt;code&gt;_commit_time&lt;/code&gt;. In &lt;code&gt;upsert&lt;/code&gt;, the PostgreSQL destination reads &lt;code&gt;_op&lt;/code&gt;: the last change of each key wins, deletes are applied by key, and the three columns aren't written. In &lt;code&gt;append&lt;/code&gt; mode they are written, which gives you an audit log of every change instead of a mirror.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now the failure
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;db/break.sql&lt;/code&gt; gives the mirror a rule the application doesn't have, no negative amounts, then records 500 legitimate updates and one bad order in the shop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- in analytics&lt;/span&gt;
&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="k"&gt;CONSTRAINT&lt;/span&gt; &lt;span class="n"&gt;amount_not_negative&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;-- in shop&lt;/span&gt;
&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1021&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'paid'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/sql.sh &lt;span class="nb"&gt;break
&lt;/span&gt;hdrctl run &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✗  Step 'orders' FAILED: … CheckViolation: new row for relation "orders" violates check constraint "amount_not_negative"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/sql.sh check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;shop.orders&lt;/code&gt;: 1,020 rows, total 455067.31&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analytics.orders&lt;/code&gt;: 1,019 rows, total 454582.31, exactly as before the run&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of the 500 updates was applied. That part is &lt;code&gt;atomic: true&lt;/code&gt;: the load is one transaction.&lt;/p&gt;

&lt;p&gt;But a CDC pipeline has a second way to lose data. If the source had marked those 501 changes as "read" before the load failed, the next run would start after them, and the 500 updates would be gone for good, without any error.&lt;/p&gt;

&lt;p&gt;That's why Hydra ETL reads the changes without consuming them (&lt;code&gt;pg_logical_slot_peek_binary_changes&lt;/code&gt;), and only moves the slot forward (&lt;code&gt;pg_replication_slot_advance&lt;/code&gt;) after the destination has published. The failed run didn't move the slot.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;db/repair.sql&lt;/code&gt; fixes the bad order at the source:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1021&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/sql.sh repair
hdrctl run &lt;span class="nb"&gt;.&lt;/span&gt;
./scripts/sql.sh check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;shop.orders&lt;/code&gt;: 1,020 rows, total 455097.31&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;analytics.orders&lt;/code&gt;: 1,020 rows, total 455097.31&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 500 updates from the failed run were read again and applied, together with the new ones. The order that was inserted at -15.00 and then corrected arrives in the mirror at 15.00: within a batch, only the last change of each key is written.&lt;/p&gt;

&lt;p&gt;Want to start over? &lt;code&gt;./scripts/reset.sh&lt;/code&gt; removes the container and its data and creates them again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Details that matter in practice
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unchanged large values.&lt;/strong&gt; When an UPDATE doesn't touch a large column (a big JSON document stored out of line, "TOAST"), PostgreSQL doesn't put its value in the log. A naive mirror would write NULL there. Hydra ETL keeps the value the mirror already has.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Primary key.&lt;/strong&gt; The source table needs one, so that updates and deletes can be applied by key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unused slots.&lt;/strong&gt; A slot keeps the server's write-ahead log until it's read. If you stop the pipeline for good, drop it: &lt;code&gt;SELECT pg_drop_replication_slot('hydra_orders');&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rollback.&lt;/strong&gt; A workflow with &lt;code&gt;rollback: true&lt;/code&gt; refuses a CDC source: the slot is confirmed at the end of the job, and a later rollback couldn't move it back. &lt;code&gt;atomic: true&lt;/code&gt; is the right tool here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your own server.&lt;/strong&gt; No Docker? The repository's README shows how to run the same scripts on any PostgreSQL 11 or later with &lt;code&gt;wal_level = logical&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The demo: &lt;a href="https://github.com/bejaouibechir/hydra-cdc-mirror-demo" rel="noopener noreferrer"&gt;github.com/bejaouibechir/hydra-cdc-mirror-demo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hydra ETL: &lt;a href="https://github.com/bejaouibechir/Hydra" rel="noopener noreferrer"&gt;github.com/bejaouibechir/Hydra&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;What's new in 0.20: &lt;a href="https://hydraetl.com/changelog/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=cdc-mirror" rel="noopener noreferrer"&gt;hydraetl.com/changelog&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Disclosure: I'm the author of Hydra ETL. It's a batch tool: each run applies the changes since the last one, it isn't a streaming platform. For one or a few mirror tables, it's a lot less to run than a Kafka cluster.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>dataengineering</category>
      <category>cdc</category>
      <category>python</category>
    </item>
    <item>
      <title>Snowflake to PostgreSQL: the type traps, caught before they reach your tables</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Mon, 09 Nov 2026 20:38:43 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/snowflake-to-postgresql-the-type-traps-caught-before-they-reach-your-tables-kke</link>
      <guid>https://dev.to/bejaouibechir/snowflake-to-postgresql-the-type-traps-caught-before-they-reach-your-tables-kke</guid>
      <description>&lt;p&gt;Moving a table out of Snowflake into PostgreSQL looks like a one-liner. Then the numbers come out slightly wrong, and nobody notices for weeks.&lt;/p&gt;

&lt;p&gt;Here is the order ID I tested with: &lt;strong&gt;9007199254740993&lt;/strong&gt;. In Snowsight, the small chart above the results column shows it as &lt;strong&gt;9007199254740992&lt;/strong&gt;. One digit off. The cell below shows the right value; the chart doesn't, because somewhere along the way the number went through a floating-point value, and a float can't hold every integer above 2^53.&lt;/p&gt;

&lt;p&gt;Any pipeline that lets a value pass through a float, a generic "number" type or a text conversion can do the same thing to your data, silently. So when I added a Snowflake source to Hydra ETL, the goal was simple: every value lands in PostgreSQL exactly as it was in Snowflake, or the run stops before writing anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test
&lt;/h2&gt;

&lt;p&gt;A real Snowflake trial account, a table of 50,000 orders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ORDER_ID NUMBER(38,0)&lt;/code&gt;, starting at 9007199254740993 (just above 2^53)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AMOUNT NUMBER(12,2)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ORDERED_AT TIMESTAMP_TZ&lt;/code&gt;, &lt;code&gt;SHIPPED_ON DATE&lt;/code&gt;, &lt;code&gt;LOADED_AT TIMESTAMP_NTZ&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;IS_GIFT BOOLEAN&lt;/code&gt;, &lt;code&gt;DETAILS VARIANT&lt;/code&gt; (a JSON document)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The whole job is two YAML files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# sources.yaml
&lt;/span&gt;&lt;span class="na"&gt;sources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;snowflake_orders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;snowflake&lt;/span&gt;
    &lt;span class="na"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:SNOWFLAKE_ACCOUNT }}"&lt;/span&gt;
      &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:SNOWFLAKE_USER }}"&lt;/span&gt;
      &lt;span class="na"&gt;private_key_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:SNOWFLAKE_PRIVATE_KEY_FILE }}"&lt;/span&gt;   &lt;span class="c1"&gt;# key-pair authentication
&lt;/span&gt;      &lt;span class="na"&gt;warehouse&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;COMPUTE_WH&lt;/span&gt;
      &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SALES&lt;/span&gt;
      &lt;span class="na"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PUBLIC&lt;/span&gt;
      &lt;span class="na"&gt;column_case&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lower&lt;/span&gt;        &lt;span class="c1"&gt;# ORDER_ID -&amp;gt; order_id
&lt;/span&gt;    &lt;span class="na"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ORDERS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# destinations.yaml
&lt;/span&gt;&lt;span class="na"&gt;destinations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;postgres_orders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgresql&lt;/span&gt;
    &lt;span class="na"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:DEMO_PG_HOST }}"&lt;/span&gt;
      &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:DEMO_PG_PORT }}"&lt;/span&gt;
      &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:DEMO_PG_USER }}"&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:DEMO_PG_PASSWORD }}"&lt;/span&gt;
      &lt;span class="na"&gt;database&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ env:DEMO_PG_DATABASE }}"&lt;/span&gt;
    &lt;span class="na"&gt;load&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders&lt;/span&gt;
      &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;upsert&lt;/span&gt;              &lt;span class="c1"&gt;# re-running updates rows, never duplicates them
&lt;/span&gt;      &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;atomic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;              &lt;span class="c1"&gt;# all or nothing
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then &lt;code&gt;hdrctl run .&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What arrived in PostgreSQL
&lt;/h2&gt;

&lt;p&gt;Same row count, same total, same smallest ID, on both sides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Snowflake: 50,000 rows, total amount 24989859.06, smallest ID 9007199254740993&lt;/li&gt;
&lt;li&gt;PostgreSQL: 50,000 rows, total amount 24989859.06, smallest ID 9007199254740993&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the table Hydra ETL created on the PostgreSQL side has the types you would have chosen by hand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;NUMBER(38,0)&lt;/code&gt; → &lt;code&gt;bigint&lt;/code&gt;, the exact integer, never a float&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NUMBER(12,2)&lt;/code&gt; → &lt;code&gt;numeric&lt;/code&gt;, the exact decimal&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TIMESTAMP_TZ&lt;/code&gt; → &lt;code&gt;timestamp with time zone&lt;/code&gt;, the instant is kept&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TIMESTAMP_NTZ&lt;/code&gt; → &lt;code&gt;timestamp without time zone&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DATE&lt;/code&gt; → &lt;code&gt;date&lt;/code&gt;, not a timestamp at midnight&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;BOOLEAN&lt;/code&gt; → &lt;code&gt;boolean&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VARIANT&lt;/code&gt; → &lt;code&gt;jsonb&lt;/code&gt;, queryable with &lt;code&gt;-&amp;gt;&lt;/code&gt; and &lt;code&gt;-&amp;gt;&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;order_id&lt;/code&gt; → primary key, because the job loads in &lt;code&gt;upsert&lt;/code&gt; on that key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The uppercase Snowflake column names became lowercase (&lt;code&gt;column_case: lower&lt;/code&gt;), so nobody has to write &lt;code&gt;"ORDER_ID"&lt;/code&gt; with quotes in every PostgreSQL query. If two columns only differ by case, the source refuses to start before reading a single row, instead of letting one overwrite the other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Then I broke it on purpose
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;order_id&lt;/code&gt; is a &lt;code&gt;bigint&lt;/code&gt; in PostgreSQL now. Snowflake's &lt;code&gt;NUMBER(38,0)&lt;/code&gt; goes far beyond that. So, in Snowflake:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="no"&gt;SALES&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PUBLIC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ORDERS&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="no"&gt;AMOUNT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;AMOUNT&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="no"&gt;SALES&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PUBLIC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ORDERS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;ORDER_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CUSTOMER_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;AMOUNT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURRENCY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12345678901234567890123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'EUR'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;50,000 updated amounts, plus one ID that cannot fit in a &lt;code&gt;bigint&lt;/code&gt;. The run stopped on that row. And PostgreSQL?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before the run: total amount 24989859.06&lt;/li&gt;
&lt;li&gt;After the failed run: total amount 24989859.06&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not one of the 50,000 updates was applied. With &lt;code&gt;atomic: true&lt;/code&gt;, the whole load is one transaction: either everything is published, or nothing is.&lt;/p&gt;

&lt;p&gt;Hydra ETL 0.20 also checks integer ranges before writing a batch, so the error names the problem instead of PostgreSQL's bare &lt;code&gt;bigint out of range&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;the value 12345678901234567890123 (row … of the batch) does not fit in column 'order_id',
which is bigint in public.orders. Nothing of this batch was written. Widen the column first,
for example:
  ALTER TABLE public.orders ALTER COLUMN order_id TYPE NUMERIC(38,0);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I deleted the oversized row in Snowflake and ran the job again: total amount 25039859.06, exactly 1.00 more on each of the 50,000 orders.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two setup traps worth knowing
&lt;/h2&gt;

&lt;p&gt;Not type traps, but they cost me time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Key-pair authentication.&lt;/strong&gt; Snowflake expects the public key in the &lt;code&gt;BEGIN PUBLIC KEY&lt;/code&gt; format, which starts with &lt;code&gt;MIIBIjANBgkqh&lt;/code&gt;. A key that starts with &lt;code&gt;MIIBCgKCAQEA&lt;/code&gt; is valid RSA, but in another format, and Snowflake rejects it with "Invalid Public key". &lt;code&gt;openssl pkey -in rsa_key.p8 -pubout&lt;/code&gt; gives the right one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account identifier.&lt;/strong&gt; A wrong one fails at login with a &lt;code&gt;404 Not Found&lt;/code&gt;. Use &lt;code&gt;ORGNAME-ACCOUNTNAME&lt;/code&gt;, or the locator with its region as in the Snowsight address (&lt;code&gt;xy12345.eu-central-2.aws&lt;/code&gt;), without &lt;code&gt;https://&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install &lt;span class="s2"&gt;"hydra-etl[snowflake,postgres]"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The complete example, with a PostgreSQL in Docker and a local Snowflake emulator if you don't have an account, is in the repository: &lt;a href="https://github.com/bejaouibechir/Hydra/tree/main/examples/snowflake-to-postgres" rel="noopener noreferrer"&gt;examples/snowflake-to-postgres&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hydra ETL: &lt;a href="https://github.com/bejaouibechir/Hydra" rel="noopener noreferrer"&gt;github.com/bejaouibechir/Hydra&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;What's new in 0.20: &lt;a href="https://hydraetl.com/changelog/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=snowflake-types" rel="noopener noreferrer"&gt;hydraetl.com/changelog&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>snowflake</category>
      <category>postgres</category>
      <category>dataengineering</category>
      <category>python</category>
    </item>
    <item>
      <title>Hydra ETL: The Lean, Declarative Contender in the 2026 Data Ecosystem</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Mon, 09 Nov 2026 10:59:50 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/hydra-etl-the-lean-declarative-contender-in-the-2026-data-ecosystem-3a6g</link>
      <guid>https://dev.to/bejaouibechir/hydra-etl-the-lean-declarative-contender-in-the-2026-data-ecosystem-3a6g</guid>
      <description>&lt;p&gt;Hydra ETL is a recently emerging, highly "engineering-driven" open-source player, charting a radically different course than current market leaders. While modern tools like Fivetran or Matillion push towards complex SaaS architectures or a cloud-first approach, Hydra ETL prioritizes simplicity, lightweight design, and a purely declarative approach (YAML). &lt;/p&gt;

&lt;p&gt;It requires neither a dedicated database, Docker, nor a JVM: a simple &lt;code&gt;pip install&lt;/code&gt; is all it takes to get it running locally or on a server. &lt;/p&gt;

&lt;p&gt;Here’s how Hydra ETL directly compares to the leaders in 2026:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Hydra ETL vs Fivetran &amp;amp; Airbyte (The Ingestion/EL Layer)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Philosophy&lt;/strong&gt;: Fivetran and Airbyte are built for connecting hundreds of complex SaaS applications with no-code or cloud-based solutions. Hydra ETL, in contrast, is tailor-made for file pipelines (CSV, Parquet, JSON) and databases (MySQL, PostgreSQL, SQL Server) that need to stay simple, readable, and ultra-fast locally. [1, 2]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure&lt;/strong&gt;: Fivetran is 100% managed (costly at scale). Airbyte requires Docker/Kubernetes infrastructure if self-hosting. Hydra executes directly from the terminal via a command line interface (CLI) without heavy components (no message brokers, no metadata database). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fub82bf4ymylkza8rkr3f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fub82bf4ymylkza8rkr3f.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Hydra ETL vs dbt (The Transformation Layer)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scope&lt;/strong&gt;: dbt handles transformations only within a data warehouse (In-Warehouse ELT). Hydra is an end-to-end tool (full ETL): it extracts from a source, transforms on-the-fly, and loads into a destination. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transformation Engine&lt;/strong&gt;: dbt uses the processing power of your data warehouse (e.g., Snowflake) via SQL. Hydra ETL integrates and embeds high-performance local engines like Pandas and DuckDB, supplemented by a Rust execution engine for processing millions of rows in seconds at a lower cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbu7ek5xhehmsj1mbc0a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbu7ek5xhehmsj1mbc0a2.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Hydra ETL vs Airflow (The Orchestration Layer)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pipeline Definition&lt;/strong&gt;: In Apache Airflow, pipelines (DAGs) are programmed in pure Python. With Hydra, pipelines are declared in YAML (configuration files for sources, destinations, and transformations).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-execution Validation&lt;/strong&gt;: This is a major strength of Hydra over Airflow. Hydra validates the entire YAML manifest and schema before moving any data, preventing pipeline crashes mid-process or after hours of execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F44p1cr9ee4zay8b9ivuz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F44p1cr9ee4zay8b9ivuz.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct Comparison Table&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Hydra ETL&lt;/th&gt;
&lt;th&gt;Fivetran / Airbyte&lt;/th&gt;
&lt;th&gt;dbt&lt;/th&gt;
&lt;th&gt;Apache Airflow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary Language&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;YAML (Declarative)&lt;/td&gt;
&lt;td&gt;UI / Configuration&lt;/td&gt;
&lt;td&gt;SQL + YAML&lt;/td&gt;
&lt;td&gt;Python (Code-First)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deployment / Footprint&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lightweight (pip install), no broker/DB&lt;/td&gt;
&lt;td&gt;Heavy (SaaS or Docker/K8s)&lt;/td&gt;
&lt;td&gt;Lightweight / Cloud&lt;/td&gt;
&lt;td&gt;Heavy (Server, Scheduler, DB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Execution Engine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Local / Hybrid (Rust, DuckDB, Pandas)&lt;/td&gt;
&lt;td&gt;Cloud Servers&lt;/td&gt;
&lt;td&gt;Data Warehouse (Snowflake/BigQuery)&lt;/td&gt;
&lt;td&gt;Infrastructure Worker Nodes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Visual Interface&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hydra Studio included (simple command)&lt;/td&gt;
&lt;td&gt;Natively Integrated&lt;/td&gt;
&lt;td&gt;dbt Cloud only&lt;/td&gt;
&lt;td&gt;Monitoring UI (no editing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AI Features&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Native (MCP server support for natural language interaction)&lt;/td&gt;
&lt;td&gt;Limited or via third-party connectors&lt;/td&gt;
&lt;td&gt;dbt Copilot (Cloud)&lt;/td&gt;
&lt;td&gt;Via third-party plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Hydra ETL is an emerging, highly "engineering-driven" open-source player, charting a radically different course than current market leaders. While modern tools like Fivetran or Matillion push towards complex SaaS architectures or a cloud-first approach, Hydra ETL prioritizes simplicity, lightweight design, and a purely declarative approach (YAML).&lt;/p&gt;

&lt;p&gt;It requires neither a dedicated database, Docker, nor a JVM: a simple &lt;code&gt;pip install&lt;/code&gt; is all it takes to get it running locally or on a server.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Hydra ETL vs. The SaaS/Cloud Giants&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Here’s how Hydra ETL directly compares to the overall market leaders in 2026:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Hydra ETL vs Fivetran &amp;amp; Airbyte (The Ingestion/EL Layer)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Philosophy&lt;/strong&gt;: Fivetran and Airbyte are built to connect hundreds of complex SaaS applications using no-code or cloud-managed solutions. Hydra ETL, in contrast, is tailor-made for file pipelines (CSV, Parquet, JSON) and databases (MySQL, PostgreSQL, SQL Server) that need to stay simple, readable, and ultra-fast locally. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure&lt;/strong&gt;: Fivetran is 100% managed (costly at volume). Airbyte requires a Docker/Kubernetes infrastructure if you self-host. Hydra executes directly from the terminal via a command line interface (CLI) without heavy components (no message brokers, no metadata database).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fncplv2aossckhy2qobl6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fncplv2aossckhy2qobl6.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Hydra ETL vs dbt (The Transformation Layer)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scope&lt;/strong&gt;: dbt handles transformations &lt;em&gt;only&lt;/em&gt; inside a data warehouse (In-Warehouse ELT). Hydra is an end-to-end tool (full ETL): it extracts from a source, transforms on-the-fly, and loads into a destination. [1]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transformation Engine&lt;/strong&gt;: dbt uses the processing power of your data warehouse (e.g., Snowflake) via SQL. Hydra ETL integrates and embeds high-performance local engines like Pandas and DuckDB, supplemented by a Rust execution engine for processing millions of rows in seconds at a lower cost. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj0lnuxzjf5ublf9zqwqu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj0lnuxzjf5ublf9zqwqu.png" alt=" " width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Hydra ETL vs Airflow (The Orchestration Layer)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pipeline Definition&lt;/strong&gt;: In Apache Airflow, pipelines (DAGs) are programmed in pure Python. With Hydra, pipelines are declared in YAML (configuration files defining sources, destinations, and transformations).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-execution Validation&lt;/strong&gt;: This is a major strength of Hydra over Airflow. Hydra validates the entire YAML manifest and schema before moving &lt;em&gt;any&lt;/em&gt; data, preventing pipeline crashes mid-process or after hours of execution. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpo9aqe9yvooppu6o86xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpo9aqe9yvooppu6o86xw.png" alt=" " width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct Comparison Table (Primary Market)&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Hydra ETL&lt;/th&gt;
&lt;th&gt;Fivetran / Airbyte&lt;/th&gt;
&lt;th&gt;dbt&lt;/th&gt;
&lt;th&gt;Apache Airflow&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary Language&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;YAML (Declarative)&lt;/td&gt;
&lt;td&gt;UI / Configuration&lt;/td&gt;
&lt;td&gt;SQL + YAML&lt;/td&gt;
&lt;td&gt;Python (Code-First)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deployment / Footprint&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lightweight (pip install), no broker/DB&lt;/td&gt;
&lt;td&gt;Heavy (SaaS or Docker/K8s)&lt;/td&gt;
&lt;td&gt;Lightweight / Cloud&lt;/td&gt;
&lt;td&gt;Heavy (Server, Scheduler, DB)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Execution Engine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Local / Hybrid (Rust, DuckDB, Pandas)&lt;/td&gt;
&lt;td&gt;Cloud Servers&lt;/td&gt;
&lt;td&gt;Data Warehouse (Snowflake/BigQuery)&lt;/td&gt;
&lt;td&gt;Infrastructure Worker Nodes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Visual Interface&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Hydra Studio included (simple command)&lt;/td&gt;
&lt;td&gt;Natively Integrated&lt;/td&gt;
&lt;td&gt;dbt Cloud only&lt;/td&gt;
&lt;td&gt;Monitoring UI (no editing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AI Features&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Native (MCP server support for natural language interaction)&lt;/td&gt;
&lt;td&gt;Limited or via third-party connectors&lt;/td&gt;
&lt;td&gt;dbt Copilot (Cloud)&lt;/td&gt;
&lt;td&gt;Via third-party plugins&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;Hydra ETL vs. Other Developer-Centric, Lean Tools&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Since Hydra ETL operates outside the usual scope of complex Cloud-based setups, it shouldn't be compared to enterprise platforms (like Informatica). Instead, it's best compared to other lightweight, code- or config-driven, developer-oriented tools.&lt;/p&gt;

&lt;p&gt;Here is who it really competes with in the 2026 market:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Direct Code-Driven Ingestion Competitor: dlt (data load tool)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Common Ground&lt;/strong&gt;: dlt and Hydra ETL share the same philosophy: an ultra-lightweight Python library, installable in one line (&lt;code&gt;pip install&lt;/code&gt;), which runs locally or on any simple container without requiring a server or complex metadata database. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Difference&lt;/strong&gt;: dlt is tailor-made for pure &lt;em&gt;Code-First&lt;/em&gt; (you write Python scripts) and focuses mainly on the Ingestion part (Extract and Load). Hydra ETL differentiates itself by being &lt;em&gt;Declarative&lt;/em&gt; (YAML) and natively integrating the local transformation layer (via DuckDB or Pandas) while validating the schema &lt;em&gt;before&lt;/em&gt; launching execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7bt0z1q25nbmtylmzq72.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7bt0z1q25nbmtylmzq72.png" alt=" " width="799" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The "Local No-Code" Legacy Competitor: Apache NiFi&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Common Ground&lt;/strong&gt;: Both are pure ETL tools (transformation occurs during the flow, before loading). They allow building a complete pipeline connecting a specific source to a specific destination with intermediate steps. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Difference&lt;/strong&gt;: Apache NiFi relies on a heavy graphical interface and a large Java (JVM) infrastructure. In contrast, Hydra ETL offers a much more modern &lt;em&gt;Configuration-as-Code&lt;/em&gt; approach in YAML for Git versioning, and replaces the JVM's bulk with an ultra-fast execution engine combining Rust and DuckDB. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. The Modern Challenger for Local Transformation: Meltano&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Common Ground&lt;/strong&gt;: Meltano and Hydra ETL both target Data Engineers tired of SaaS interfaces that charge by volume. Both rely on configuration via YAML files to orchestrate reproducible pipelines suitable for a DataOps approach (CI/CD).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Difference&lt;/strong&gt;: Meltano primarily serves as "glue" to bind other tools (it encapsulates the Singer connector standard for ingestion, and dbt for transformation). Hydra ETL is much more unified: it's a single, standalone engine that embeds its own validation logic and local compute engines. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. The Traditional Software Alternative: Talend (Open Studio)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Common Ground&lt;/strong&gt;: They are both pure ETLs that process data in a "row-by-row" or batch format with explicit mapping and filtering functions between the source and target.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Difference&lt;/strong&gt;: Talend generates heavy Java code, suffers from significant technical legacy, and pushes towards expensive Cloud licenses. Hydra ETL represents the next generation (2026): open-source, designed for terminals (CLI), relying on readable, lightweight manifests. &lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;In Summary: The True Architectural Equivalence&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If we were to summarize Hydra ETL’s place in the current ecosystem:&lt;/p&gt;

&lt;p&gt;Making a pipeline with Hydra ETL gives you the security and robustness guarantees of an "Airflow + dlt + dbt" triplet (which requires three tools and dozens of lines of code), but only by writing a single YAML configuration file executed by a local Rust engine.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;When to Choose Hydra ETL?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Hydra ETL is not designed to replace a massive enterprise data factory that must centralize 50 SaaS tools (like Salesforce, HubSpot, SAP).&lt;/p&gt;

&lt;p&gt;However, it is the perfect tool in 2026 if your team wants to set up fast, Git-versionable pipelines that are easy to maintain (thanks to YAML) for moving large files and relational databases without having to deploy and pay for a complex cloud setup. &lt;br&gt;
&lt;strong&gt;In Summary: When to Choose Hydra ETL?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hydra ETL isn't meant to replace a massive enterprise data factory consolidating 50 SaaS tools (like Salesforce, HubSpot, SAP).&lt;/p&gt;

&lt;p&gt;However, it's the perfect tool in 2026 if your team wants to build fast, Git-versionable pipelines that are easy to maintain (thanks to YAML) for moving large files and relational databases without deploying and paying for a complex cloud setup. &lt;/p&gt;

&lt;p&gt;Here is the complete translation with the added section, including illustrative diagrams to visualize Hydra's position in the market.&lt;/p&gt;

</description>
      <category>airebyte</category>
      <category>dbt</category>
      <category>dlt</category>
      <category>fivetran</category>
    </item>
    <item>
      <title>Snowflake into PostgreSQL using Hydra ETL</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Sun, 08 Nov 2026 19:38:10 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/snowflake-into-postgresql-using-hydra-etl-511e</link>
      <guid>https://dev.to/bejaouibechir/snowflake-into-postgresql-using-hydra-etl-511e</guid>
      <description>&lt;p&gt;Moving data out of Snowflake into PostgreSQL looks easy until the types come out wrong!&lt;/p&gt;

&lt;p&gt;That's the kind of silent change I wanted Hydra ETL's new Snowflake source to rule out. Tested on a real Snowflake account, 50,000 orders into PostgreSQL:&lt;br&gt;
→ 38-digit IDs and decimal amounts stay exact&lt;br&gt;
→ DATE stays a date, TIMESTAMP_TZ keeps its time zone&lt;br&gt;
→ VARIANT lands as JSONB&lt;br&gt;
→ Snowflake's uppercase column names can be lowercased for PostgreSQL&lt;br&gt;
Then I broke it on purpose: an ID too large for PostgreSQL's bigint, in the middle of 50,000 updates. The run stopped, and PostgreSQL still held exactly the previous data, to the cent. Nothing half-loaded.&lt;br&gt;
Coming in Hydra ETL 0.20. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuvjaarpyontkaiyzx9av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuvjaarpyontkaiyzx9av.png" alt=" " width="799" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The example, with a local Snowflake emulator if you don't have an account, is in the first comment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiaoqkxrpvhifi6gcl34g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiaoqkxrpvhifi6gcl34g.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example: &lt;a href="https://github.com/bejaouibechir/Hydra/tree/main/examples/snowflake-to-postgres" rel="noopener noreferrer"&gt;https://github.com/bejaouibechir/Hydra/tree/main/examples/snowflake-to-postgres&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>dataengineering</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Same guarantees, without programming them: Hydra ETL vs Airflow + dlt + dbt vs Airflow + Airbyte + dbt</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Fri, 06 Nov 2026 08:25:03 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/same-guarantees-without-programming-them-hydra-etl-vs-airflow-dlt-dbt-vs-airflow-airbyte--2m4n</link>
      <guid>https://dev.to/bejaouibechir/same-guarantees-without-programming-them-hydra-etl-vs-airflow-dlt-dbt-vs-airflow-airbyte--2m4n</guid>
      <description>&lt;p&gt;Most comparisons of data tools show the happy path. I wanted to see the other one: what happens when the source file is missing, when one value is unreadable, or when the second output fails after the first one was written.&lt;/p&gt;

&lt;p&gt;So I built the same small pipeline three times, injected the same four failures into each, and measured what it took to keep the outputs correct. Everything is public, so you can check it or run it yourself: &lt;a href="https://github.com/bejaouibechir/hydra-etl-benchmark" rel="noopener noreferrer"&gt;github.com/bejaouibechir/hydra-etl-benchmark&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pipeline
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input&lt;/strong&gt;: 200,000 orders and 2,000 customers (CSV).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Work&lt;/strong&gt;: keep paid orders, join customers, compute revenue by country and revenue by month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output&lt;/strong&gt;: two CSV reports.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backup&lt;/strong&gt;: yesterday's export, to use if today's data is unusable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before every run, the outputs hold the day-before-yesterday's reports. After the run, each output must come from &lt;strong&gt;today's data&lt;/strong&gt; or &lt;strong&gt;the backup&lt;/strong&gt;, and both outputs must come from the same one.&lt;/p&gt;

&lt;p&gt;The three stacks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hydra ETL&lt;/strong&gt; (declarative YAML pipelines, validated before they run). Disclosure: I'm the author.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Airflow + dlt + dbt&lt;/strong&gt; (DuckDB).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Airflow + Airbyte + dbt&lt;/strong&gt; (PostgreSQL).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each stack exists in two variants: &lt;strong&gt;without protection&lt;/strong&gt; (what you usually write first) and &lt;strong&gt;with protections&lt;/strong&gt; (fallback to the backup, outputs published all-or-nothing, timeouts).&lt;/p&gt;

&lt;p&gt;The four scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Normal&lt;/strong&gt;: nothing breaks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing source&lt;/strong&gt;: today's &lt;code&gt;orders.csv&lt;/code&gt; is not there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unreadable amount&lt;/strong&gt;: one amount is &lt;code&gt;abc&lt;/code&gt;, so the first report fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impossible date&lt;/strong&gt;: one date is &lt;code&gt;2026-13-45&lt;/code&gt;, so only the second report fails.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Without protection, every stack can leave inconsistent outputs. With protections, all three get it right.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3opkismg7xuqne1o8dr9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3opkismg7xuqne1o8dr9.png" alt="What the two reports contain after each failure, for each stack, without and with protections" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;"Inconsistent" means the country report is today's and the month report is the day-before-yesterday's. Nothing failed loudly enough to notice; the dashboard is simply wrong.&lt;/p&gt;

&lt;p&gt;Without protection, the Airbyte stack stayed consistent, but not thanks to Airbyte: in that DAG, the CSV export is a separate step that only runs after dbt fully succeeds. It's a design choice in the DAG, not a property of the tool.&lt;/p&gt;

&lt;p&gt;With protections, the guarantees are the same everywhere. The difference is &lt;strong&gt;how you get them&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How each stack gets there
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Airflow + dlt + dbt&lt;/strong&gt;: about 26 lines of Python. A backup task with &lt;code&gt;trigger_rule="one_failed"&lt;/code&gt;, staging folders, and a publish task that copies both reports next to the target and renames them, written by hand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;backup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;build_backup&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data/backup/orders.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;HOME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/staging/backup&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;backup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;trigger_rule&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;one_failed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="nd"&gt;@task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trigger_rule&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;one_success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Publish both reports of the same run, or nothing.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;stage&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;main&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;backup&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;HOME&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;staging&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;stage&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;OUTPUTS&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;OUTPUTS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;HOME&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.tmp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;OUTPUTS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;HOME&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;.tmp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;HOME&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;stage&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;no complete set of reports to publish&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My first version of this DAG had a logic bug: the backup ran even after a success. That's the risk with guarantees you program yourself. And this atomic publish only works for files; for a database you'd still have to write a table swap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hydra ETL&lt;/strong&gt;: about 21 lines of YAML. The workflow undoes what it did if a step fails, and the execution order declares a backup workflow and when to use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# workflows/daily_revenue.yaml&lt;/span&gt;
&lt;span class="na"&gt;workflow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;daily_revenue&lt;/span&gt;
  &lt;span class="na"&gt;rollback&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;            &lt;span class="c1"&gt;# if a step fails, undo the steps already done&lt;/span&gt;
  &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;by_country&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;job&lt;/span&gt;
      &lt;span class="na"&gt;job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;../jobs/revenue_by_country&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;by_month&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;job&lt;/span&gt;
      &lt;span class="na"&gt;job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;../jobs/revenue_by_month&lt;/span&gt;
      &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;by_country&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# workflows/thread.yaml&lt;/span&gt;
&lt;span class="na"&gt;thread&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sequential&lt;/span&gt;
    &lt;span class="na"&gt;workflows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;daily_revenue&lt;/span&gt;
        &lt;span class="na"&gt;timeout&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10m&lt;/span&gt;
        &lt;span class="na"&gt;fallback&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;use&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;daily_revenue_backup&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
          &lt;span class="na"&gt;when&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;file_exists('data/orders.csv')"&lt;/span&gt;   &lt;span class="c1"&gt;# checked before the start&lt;/span&gt;
          &lt;span class="na"&gt;on_failure&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;                             &lt;span class="c1"&gt;# also after a failure that left nothing published&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the "impossible date" run (Hydra ETL 0.19.1, long error lines trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ▶  Workflow  daily_revenue
     ✓  Step 'by_country' OK (1.9s)
     ✗  Step 'by_month' FAILED: ValueError: Step 2/5: cast: cannot convert column='order_date' to type='datetime': time data "2026-13-45" …
     ↩  Step 'by_country' undone
     │ output/revenue_by_country.csv: previous file restored
  ↯  Workflow 'daily_revenue' failed (2.8s), nothing published — replaced by daily_revenue_backup
  ▶  Workflow  daily_revenue_backup  (fallback, in place of daily_revenue)
     ✓  Step 'use_backup_export' OK (0.0s)
     ✓  Step 'by_country' OK (1.1s)
     ✓  Step 'by_month' OK (1.5s)
  ✓  Workflow 'daily_revenue_backup' OK (2.6s)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two differences in behaviour, beyond the syntax:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hydra ETL decides before starting.&lt;/strong&gt; If today's file is missing, the backup runs directly. Airflow has to fail first, which leaves a failed task and an alert.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hydra ETL only falls back if nothing was published.&lt;/strong&gt; If the failed run had already written something it couldn't undo, it stops and says why, instead of mixing two versions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Is it less code? No.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flw4kqhpzzujq39ft41sq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flw4kqhpzzujq39ft41sq.png" alt="Useful lines of code per stack, without and with protections" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The volume is comparable. The difference is that the guarantees are &lt;strong&gt;declared&lt;/strong&gt; and enforced by the engine, instead of &lt;strong&gt;programmed&lt;/strong&gt; in a DAG, and that it's one tool and one language instead of three. With Airbyte, add the configuration of sources, destination and connections: 58 lines of API calls here, or clicks in the UI.&lt;/p&gt;

&lt;h2&gt;
  
  
  How long a run takes
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4y8lbbm7lbkkta9m5w34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4y8lbbm7lbkkta9m5w34.png" alt="End-to-end run time per scenario and per stack, log scale" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On one EC2 machine (Ubuntu 24.04, 4 vCPUs, 15 GB), Hydra ETL takes 1 to 2 seconds, Airflow + dlt + dbt 14 to 23 seconds, and Airflow + Airbyte + dbt 1 to 3 minutes; each Airbyte sync starts containers, which takes 60 to 80 seconds on its own.&lt;/p&gt;

&lt;p&gt;Read these with care: the Airflow runs use &lt;code&gt;airflow dags test&lt;/code&gt;, which pays Airflow's start-up on every run. In production the scheduler runs continuously.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs to install and run
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F85ig93a7g3ep8wdcmykn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F85ig93a7g3ep8wdcmykn.png" alt="Python packages, disk and memory at rest for each stack" width="799" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hydra ETL is one &lt;code&gt;pip install&lt;/code&gt; with nothing to operate. Airflow needs its scheduler in production. The Airbyte stack adds Docker, a local Kubernetes cluster (kind), Airbyte itself and PostgreSQL: 18 containers using about 3.7 GB of memory while idle.&lt;/p&gt;

&lt;p&gt;A few things I ran into with Airbyte, which say more about my setup than about Airbyte: its file source in web mode requires &lt;code&gt;https://&lt;/code&gt; (I switched to SFTP); dbt views on the raw tables blocked Airbyte's full-refresh syncs until I made the intermediate models ephemeral; and the API error was a generic "Something went wrong in the connector" until I wrote a diagnostic script.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about bigger volumes?
&lt;/h2&gt;

&lt;p&gt;On the same pipeline without Airflow, Hydra ETL was the fastest up to about 2 million rows per run (up to 6 times faster than dlt + dbt at 200,000 rows, where dlt + dbt pay about 9 seconds of fixed start-up). Above that, a columnar engine like DuckDB took the lead. Since version 0.15, Hydra ETL can hand its aggregations, sorts and joins to DuckDB itself above that threshold.&lt;/p&gt;

&lt;p&gt;Most pipelines are on the left side of that line: analyses of production warehouse workloads published in recent years (Amazon's Redset dataset, VLDB 2024) show that most queries scan modest amounts of data. You probably don't have a big-data problem; you probably have a correctness problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits of this test
&lt;/h2&gt;

&lt;p&gt;One machine. 200,000 rows. One run per scenario for Airbyte (median of three for the others). &lt;code&gt;airflow dags test&lt;/code&gt; instead of a running scheduler. Airbyte in &lt;code&gt;--low-resource-mode&lt;/code&gt;. The measurements were taken with Hydra ETL 0.14.0 on October 28; I re-ran the four failures with 0.19.1 before publishing, with the same results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check it yourself
&lt;/h2&gt;

&lt;p&gt;The three implementations, the scripts that run and measure them, the raw results, the logs and the script that draws these charts are here: &lt;a href="https://github.com/bejaouibechir/hydra-etl-benchmark" rel="noopener noreferrer"&gt;github.com/bejaouibechir/hydra-etl-benchmark&lt;/a&gt;. &lt;code&gt;python3 run.py&lt;/code&gt; replays the whole test on a fresh Ubuntu machine; the README shows how to replay only the four failures in a few minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway
&lt;/h2&gt;

&lt;p&gt;Every stack in this test can be made safe. The question is what that costs you: in Airflow you write the safety net yourself, in Python, and it's easy to get subtly wrong. In Hydra ETL it's a few declared lines that the engine checks before anything runs, with one &lt;code&gt;pip install&lt;/code&gt; and nothing else to operate.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hydra ETL: &lt;a href="https://github.com/bejaouibechir/Hydra" rel="noopener noreferrer"&gt;github.com/bejaouibechir/Hydra&lt;/a&gt; · &lt;code&gt;pip install hydra-etl&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Every release: &lt;a href="https://hydraetl.com/changelog/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=comparison" rel="noopener noreferrer"&gt;hydraetl.com/changelog&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's in beta, with one maintainer. If you see a flaw in the method, open an issue on the benchmark repository: I'd rather fix the test than defend it.&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>python</category>
      <category>etl</category>
      <category>airflow</category>
    </item>
    <item>
      <title>From YAML validator to event-driven projects: 14 releases of Hydra ETL in six weeks</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Wed, 04 Nov 2026 22:34:34 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/from-yaml-validator-to-event-driven-projects-14-releases-of-hydra-etl-in-six-weeks-3lgc</link>
      <guid>https://dev.to/bejaouibechir/from-yaml-validator-to-event-driven-projects-14-releases-of-hydra-etl-in-six-weeks-3lgc</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8pt7umpam64fyy77tbvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8pt7umpam64fyy77tbvu.png" alt="http://www.hydra.com" width="192" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the end of September, Hydra ETL did one thing well: you described a data job in four YAML files, &lt;code&gt;hdrctl validate&lt;/code&gt; checked them before any data was read, and the same job ran from the terminal, a REST API or a visual editor.&lt;/p&gt;

&lt;p&gt;Six weeks and 14 releases later, a Hydra ETL project can start itself when a file lands in a folder, roll back what it wrote when something fails, aggregate 20 million rows in about half a minute, and call another project as a step. The latest one, 0.19.0, &lt;strong&gt;shipped on November 4, which also happens to be my birthday&lt;/strong&gt;. Not a bad way to celebrate.&lt;br&gt;
This post walks through that evolution in five steps, and what stayed the same.&lt;/p&gt;
&lt;h2&gt;
  
  
  The starting point: a job you can read and check
&lt;/h2&gt;

&lt;p&gt;A Hydra ETL job is four files: &lt;code&gt;sources.yaml&lt;/code&gt;, &lt;code&gt;transformations.yaml&lt;/code&gt;, &lt;code&gt;destinations.yaml&lt;/code&gt;, &lt;code&gt;pipeline.yaml&lt;/code&gt;. Nothing runs until the manifests are valid. That was the promise in September, and every release since has kept it: each new feature comes with its own checks, run before anything touches your data.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. The project becomes the unit (0.11.4 → 0.12.3)
&lt;/h2&gt;

&lt;p&gt;Teams don't run one job; they run a set of them in a certain order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hdrctl init&lt;/code&gt; now scaffolds a &lt;strong&gt;project&lt;/strong&gt;: jobs, workflows, parameters, environments.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;workflows/thread.yaml&lt;/code&gt; declares the order: stages, sequential or parallel, delays, loops.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hdrctl run &amp;lt;project&amp;gt;&lt;/code&gt; checks &lt;strong&gt;the whole project&lt;/strong&gt; — every workflow, every job, every &lt;code&gt;pipeline.yaml&lt;/code&gt; — and lists every problem before starting anything.&lt;/li&gt;
&lt;li&gt;Studio stopped overwriting files edited outside it: a change made in your editor or by git is detected, and the latest change wins.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2. Failures stop leaving half-written data (0.13 → 0.14)
&lt;/h2&gt;

&lt;p&gt;This is the part I care most about. A pipeline that fails halfway is worse than one that never starts.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/ZvDhzJc3VRI?start=74" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;All-or-nothing load per job&lt;/strong&gt;: a job writes through one load session. A failure or Ctrl+C leaves the destination as it was (transactions on PostgreSQL, MySQL/MariaDB and SQL Server; temporary file then swap on CSV and Parquet).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflow rollback&lt;/strong&gt;: with &lt;code&gt;rollback: true&lt;/code&gt;, a failed workflow undoes the steps it already did, last one first. Actions that touch the outside world (webhook, email, scripts) must declare how to undo them, or explicitly say they can't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fallback workflows&lt;/strong&gt;: a backup workflow can take over — before the start, when a condition is true (&lt;code&gt;not source_available('crm_db')&lt;/code&gt;), or after a failure, but &lt;strong&gt;only if the failed workflow published nothing&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Timeouts&lt;/strong&gt; per workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Volume (0.15 → 0.16)
&lt;/h2&gt;

&lt;p&gt;pandas stays the default, but above two million estimated rows Hydra ETL can read CSV with pyarrow and run aggregations, sorts and joins in DuckDB. Results are identical to pandas, sums included.&lt;/p&gt;

&lt;p&gt;Measured on 20 million rows, 2 CPUs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;aggregation: &lt;strong&gt;112.8 s / 5.4 GB → 34.3 s / 1.4 GB&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;right join then aggregation: &lt;strong&gt;71.8 s / 3.4 GB → 27.7 s / 2.6 GB&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No silent fallback: when a step can't run in DuckDB, the log says so. And a new &lt;code&gt;engine:&lt;/code&gt; key chooses the engine per job.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Secrets and environments (0.17 → 0.18)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Secrets are &lt;strong&gt;masked everywhere&lt;/strong&gt; Hydra ETL writes text: logs, errors, tracebacks, the output of scripts, stored runs.&lt;/li&gt;
&lt;li&gt;Secrets can be encrypted with &lt;strong&gt;SOPS&lt;/strong&gt; (age, PGP, cloud KMS) and are decrypted in memory only.&lt;/li&gt;
&lt;li&gt;One project, several environments: global variables per machine, parameter values and secrets per environment, managed with &lt;code&gt;hdrctl env&lt;/code&gt;, &lt;code&gt;hdrctl param&lt;/code&gt; and &lt;code&gt;hdrctl secret&lt;/code&gt;. A secret value is never passed on the command line.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Projects that start themselves (0.19)
&lt;/h2&gt;

&lt;p&gt;The latest release adds &lt;strong&gt;project triggers&lt;/strong&gt;. A &lt;code&gt;triggers.yaml&lt;/code&gt; at the project root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.0"&lt;/span&gt;
&lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nightly&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cron&lt;/span&gt;
    &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;
    &lt;span class="na"&gt;timezone&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Europe/Paris&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;new_orders&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;file&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;inbox/*.csv&lt;/span&gt;
    &lt;span class="na"&gt;debounce&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2s&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;after_crm&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;after_project&lt;/span&gt;
    &lt;span class="na"&gt;project&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;../crm&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;on"&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;success&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;hdrctl trigger validate&lt;/code&gt; checks it, then &lt;code&gt;hdrctl watch&lt;/code&gt; runs it. Dropping a CSV into &lt;code&gt;inbox/&lt;/code&gt;, then finishing the &lt;code&gt;crm&lt;/code&gt; project, gives:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Waiting for events. Ctrl+C to stop.
  2026-11-04 21:29:36 ▶ sales/new_orders  files: inbox/orders_2026-11-04.csv  env: none
  2026-11-04 21:29:39 ✓ sales/new_orders  2.6s
  2026-11-04 21:30:07 ▶ sales/after_crm  project crm ended: success  env: none
  2026-11-04 21:30:12 ✓ sales/after_crm  4.9s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seven trigger types in total: cron, interval, file, marker file, change in a source table, webhook with a token, and the end of another project.&lt;/p&gt;

&lt;p&gt;The guarantees are what make this usable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a file is only read once it has stopped changing;&lt;/li&gt;
&lt;li&gt;a trigger already running is not started twice;&lt;/li&gt;
&lt;li&gt;a change to &lt;code&gt;triggers.yaml&lt;/code&gt; is picked up without restarting;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;after_project&lt;/code&gt; loops are refused.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same release adds &lt;strong&gt;sub-projects&lt;/strong&gt;: a workflow step &lt;code&gt;type: project&lt;/code&gt; runs another project, with cycle detection and results the next steps can read.&lt;/p&gt;

&lt;h2&gt;
  
  
  The six weeks at a glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;th&gt;What changed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0.11.3–0.11.4&lt;/td&gt;
&lt;td&gt;Sep 27 – Oct 17&lt;/td&gt;
&lt;td&gt;Secrets resolve; PostgreSQL upsert fixed; projects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.12.x&lt;/td&gt;
&lt;td&gt;Oct 22–24&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;thread.yaml&lt;/code&gt;, &lt;code&gt;hdrctl run &amp;lt;project&amp;gt;&lt;/code&gt;, loops, Studio ↔ disk sync&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.13–0.14&lt;/td&gt;
&lt;td&gt;Oct 26–28&lt;/td&gt;
&lt;td&gt;All-or-nothing loads, rollback, fallback, timeouts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.15–0.16&lt;/td&gt;
&lt;td&gt;Oct 28–29&lt;/td&gt;
&lt;td&gt;DuckDB large-volume engine, &lt;code&gt;engine:&lt;/code&gt; per job&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.17–0.18&lt;/td&gt;
&lt;td&gt;Nov 1–2&lt;/td&gt;
&lt;td&gt;Masked secrets, SOPS, environments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.19&lt;/td&gt;
&lt;td&gt;Nov 4&lt;/td&gt;
&lt;td&gt;Project triggers, &lt;code&gt;hdrctl watch&lt;/code&gt;, sub-projects&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What didn't change
&lt;/h2&gt;

&lt;p&gt;Still one &lt;code&gt;pip install&lt;/code&gt;, no database, no broker, no Node. Still YAML you can review in a pull request. Still checked before it runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's not there yet
&lt;/h2&gt;

&lt;p&gt;Hydra ETL is in beta, with one maintainer. File triggers watch local folders; SFTP and S3 are planned. If you try it and something breaks, an issue helps more than a star.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Hydra Studio Quick tour
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/d_yaYXV1Hao?start=12" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Try Hydra ETL in playground: &lt;a href="https://killercoda.com/hydra-etl" rel="noopener noreferrer"&gt;killercoda.com/hydra-etl&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Every release, with its notes: &lt;a href="https://hydraetl.com/changelog/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=evolution" rel="noopener noreferrer"&gt;hydraetl.com/changelog&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Source: &lt;a href="https://github.com/bejaouibechir/Hydra" rel="noopener noreferrer"&gt;github.com/bejaouibechir/Hydra&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install: &lt;code&gt;pip install -U hydra-etl&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dataengineering</category>
      <category>python</category>
      <category>etl</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Clean a million rows with Hydra ETL — no database, no Docker</title>
      <dc:creator>Bechir Bejaoui</dc:creator>
      <pubDate>Sun, 20 Sep 2026 20:07:00 +0000</pubDate>
      <link>https://dev.to/bejaouibechir/clean-a-million-rows-with-hydra-etl-no-database-no-docker-nm1</link>
      <guid>https://dev.to/bejaouibechir/clean-a-million-rows-with-hydra-etl-no-database-no-docker-nm1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Originally published on &lt;a href="https://hydraetl.com/blog/one-million-rows" rel="noopener noreferrer"&gt;hydraetl.com&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Everything below runs on a laptop with &lt;strong&gt;one install and no service to start&lt;/strong&gt;: no database, no Docker, no cluster. You will generate a million-row CSV, describe the job in four small YAML files, check it before it runs, execute it, then run the exact same job on the optional Rust engine and compare.&lt;/p&gt;

&lt;p&gt;Total time: about five minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;hydra-etl        &lt;span class="c"&gt;# 0.10.2 or later&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Python 3.9+, Linux, macOS or Windows. Nothing else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One rule for the whole tutorial:&lt;/strong&gt; create an empty folder, and run every command from it. That folder &lt;em&gt;is&lt;/em&gt; the Hydra ETL job — the manifests sit at its root and &lt;code&gt;data/&lt;/code&gt; sits inside it. By the end it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;orders-demo/            ← your terminal stays here, always
├── gen.py
├── sources.yaml
├── transformations.yaml
├── destinations.yaml
├── pipeline.yaml
├── workflow.yaml
└── data/
    ├── orders.csv       (generated in step 2)
    └── orders_clean.csv (written in step 5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;orders-demo &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;orders-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you use a virtual environment, create it here too (&lt;code&gt;python -m venv .venv&lt;/code&gt;) and activate it before installing.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Make the data (no download, no hunting on your disk)
&lt;/h2&gt;

&lt;p&gt;Save this as &lt;code&gt;gen.py&lt;/code&gt; and run &lt;code&gt;python gen.py&lt;/code&gt;. It uses the standard library only and takes a few seconds.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;
&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data/orders.csv&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newline&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;csv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerow&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;customer_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;country&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;qty&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1_000_001&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writerow&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;randint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50_000&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;choice&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TN&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FR&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ES&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;PT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]),&lt;/span&gt;
                    &lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;randint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;data &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; python gen.py     &lt;span class="c"&gt;# from orders-demo/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get &lt;code&gt;data/orders.csv&lt;/code&gt;, 1,000,000 rows, about 25 MB. Note the negative prices: that is the dirt we are going to filter out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id,customer_id,country,price,qty
1,41906,TN,7.63,5
2,16050,FR,65.47,2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Describe the job — four files, 30 lines
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sources.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.0"&lt;/span&gt;
&lt;span class="na"&gt;sources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;src_orders&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;csv&lt;/span&gt;
    &lt;span class="na"&gt;connection&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;base_path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;data&lt;/span&gt;
    &lt;span class="na"&gt;extract&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders.csv&lt;/span&gt;
      &lt;span class="na"&gt;batch_size&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;transformations.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.0"&lt;/span&gt;
&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cast&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;mapping&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;int&lt;/span&gt;
        &lt;span class="na"&gt;customer_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;int&lt;/span&gt;
        &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;float&lt;/span&gt;
        &lt;span class="na"&gt;qty&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;int&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0"&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;calculate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;column&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;total&lt;/span&gt;
      &lt;span class="na"&gt;expr&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;price&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;qty"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;destinations.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.0"&lt;/span&gt;
&lt;span class="na"&gt;destinations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;dst_clean&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;csv&lt;/span&gt;
    &lt;span class="na"&gt;connection&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;base_path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;data&lt;/span&gt;
    &lt;span class="na"&gt;load&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;table&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders_clean.csv&lt;/span&gt;
      &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;replace&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;pipeline.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.0"&lt;/span&gt;
&lt;span class="na"&gt;pipeline&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;src_orders&lt;/span&gt;
  &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dst_clean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the whole job: fix the types, drop invalid rows, compute a column. A reviewer can read it in a pull request without running anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Check it before it runs
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;.&lt;/code&gt; means "the job in the current folder", so run this from &lt;code&gt;orders-demo/&lt;/code&gt;, not from &lt;code&gt;data/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hdrctl validate &lt;span class="nt"&gt;--strict&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ok  sources.yaml            — Pydantic valid
  ok  destinations.yaml       — Pydantic valid
  ok  transformations.yaml    — Pydantic valid
  ok  pipeline.from           — resolved: src_orders
  ok  pipeline.to             — resolved: dst_clean

  Strict checks
  ok  Recognized operations   — cast, filter, calculate
  ok  filter.expr             — 'price &amp;gt; 0'
  ok  calculate.total         — 'price * qty'

  ✅ DSL valid — no errors detected.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No data was read and nothing was written. Try breaking something on purpose — rename &lt;code&gt;dst_clean&lt;/code&gt; in &lt;code&gt;pipeline.yaml&lt;/code&gt;, or write &lt;code&gt;price * (qty&lt;/code&gt; — and run it again: validation fails with exit code 1, which is what you want in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Run it
&lt;/h2&gt;

&lt;p&gt;Still from &lt;code&gt;orders-demo/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hdrctl run &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result lands in &lt;code&gt;data/orders_clean.csv&lt;/code&gt;: 990,055 rows (about 1% of the rows had a negative price and were dropped) plus the new &lt;code&gt;total&lt;/code&gt; column.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id,customer_id,country,price,qty,total
1,41906,TN,7.63,5,38.15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Same job, Rust engine
&lt;/h2&gt;

&lt;p&gt;Part of the engine has an optional Rust implementation. It is off by default; turning it on changes nothing else about the job.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s2"&gt;"hydra-etl[native]"&lt;/span&gt;
&lt;span class="nv"&gt;HYDRA_BACKEND&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;rust hdrctl run &lt;span class="nb"&gt;.&lt;/span&gt;          &lt;span class="c"&gt;# from orders-demo/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows PowerShell, set the variable first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;HYDRA_BACKEND&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rust"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;hdrctl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Measured on two machines, three runs each, on the 1M-row file above:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Machine&lt;/th&gt;
&lt;th&gt;Python (default)&lt;/th&gt;
&lt;th&gt;Rust (&lt;code&gt;HYDRA_BACKEND=rust&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Faster by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Windows 11 (25H2), Python 3.13.7&lt;/td&gt;
&lt;td&gt;6.4 · 6.5 · 6.7 s&lt;/td&gt;
&lt;td&gt;3.5 · 3.7 · 3.8 s&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;~42%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Linux VM, Python 3.10.12&lt;/td&gt;
&lt;td&gt;8.5 · 8.7 · 9.2 s&lt;/td&gt;
&lt;td&gt;6.4 · 6.8 · 7.6 s&lt;/td&gt;
&lt;td&gt;~22%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Between 20% and 45% faster end to end, depending on the machine.&lt;/strong&gt; Be careful with bigger claims you may read elsewhere, including ours: the Rust part accelerates CSV &lt;em&gt;reading&lt;/em&gt;, and reading is only one stage of this pipeline. Speeding up one stage by 4× does not make the whole job 4× faster — and the share it represents depends on your disk, your filesystem and what else runs on the machine.&lt;/p&gt;

&lt;p&gt;One run out of the six on the Windows laptop came out at 7.7 s with the Rust engine, twice the other two. That is what a background process looks like in a benchmark; we report it rather than hide it. Run each engine at least three times before drawing a conclusion on your own hardware.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fex8tfkjxh60qfhtvsrp2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fex8tfkjxh60qfhtvsrp2.png" alt="Same job, same 1,000,000 rows 65 s with the Python engine, 38 s with the Rust engine" width="798" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output is the same, byte for byte:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;md5sum &lt;/span&gt;data/orders_clean.csv   &lt;span class="c"&gt;# identical after a Python run and after a Rust run&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the point of the Rust backend: same results, less time on the read, and an automatic fallback to Python whenever that guarantee cannot be kept.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Let Hydra ETL time itself
&lt;/h2&gt;

&lt;p&gt;Timing a job with a stopwatch is fine once. In practice you want the pipeline to report on itself — and that is what workflows are for. A workflow orders several steps in a DAG; a step is either a &lt;strong&gt;job&lt;/strong&gt; or an &lt;strong&gt;action&lt;/strong&gt; (Python, Bash, PowerShell, SSH, webhook, email…).&lt;/p&gt;

&lt;p&gt;Here, three steps: start a timer, run the job, report. The actions are Python, so the same file works on Linux, macOS and Windows.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;workflow.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;workflow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;timed_clean_orders"&lt;/span&gt;
  &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Clean&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;one&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;million&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;rows&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;and&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;report&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;how&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;long&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;it&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;took"&lt;/span&gt;
  &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;manual&lt;/span&gt;
  &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;start_timer"&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;action&lt;/span&gt;
      &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;python&lt;/span&gt;
      &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;import&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;time,&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;pathlib;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;pathlib.Path('.hydra_t0').write_text(str(time.time()));&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;print('timer&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;started')"&lt;/span&gt;
      &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[]&lt;/span&gt;

    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clean_orders"&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;job&lt;/span&gt;
      &lt;span class="na"&gt;job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;."&lt;/span&gt;
      &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;start_timer"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;on_failure&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;fail&lt;/span&gt;

    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;report_time"&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;action&lt;/span&gt;
      &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;python&lt;/span&gt;
      &lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;import time, pathlib&lt;/span&gt;
          &lt;span class="s"&gt;t0 = float(pathlib.Path(".hydra_t0").read_text())&lt;/span&gt;
          &lt;span class="s"&gt;rows = sum(1 for _ in open("data/orders_clean.csv")) - 1&lt;/span&gt;
          &lt;span class="s"&gt;seconds = time.time() - t0&lt;/span&gt;
          &lt;span class="s"&gt;print(f"{rows:,} rows written in {seconds:.1f} s ({rows/seconds:,.0f} rows/s)")&lt;/span&gt;
      &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;clean_orders"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Workflows are validated before they run, exactly like jobs:&lt;/p&gt;

&lt;p&gt;Again from &lt;code&gt;orders-demo/&lt;/code&gt;, where &lt;code&gt;workflow.yaml&lt;/code&gt; now sits next to the four manifests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hdrctl workflow validate ./workflow.yaml
hdrctl workflow run ./workflow.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Workflow  timed_clean_orders
  ────────────────────────────────────────────────────────

  ✓  Step 'start_timer' OK (0.0s)
     │ timer started
  ✓  Step 'clean_orders' OK (7.8s)
  ✓  Step 'report_time' OK (0.2s)
     │ 990,055 rows written in 7.9 s (124,977 rows/s)

  ✅ Workflow 'timed_clean_orders' completed in 8.0s — 3/3 steps OK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things happened here. The runner reported the duration of &lt;strong&gt;each step&lt;/strong&gt;, which is the cheapest profiling you will ever set up. And the report came out of the pipeline itself, so the same action could just as well push it to a webhook, send it by email, or write it next to the data.&lt;/p&gt;

&lt;p&gt;Run the same workflow with &lt;code&gt;HYDRA_BACKEND=rust&lt;/code&gt; and you get the Python-versus-Rust comparison above without touching a stopwatch.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this shows
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A pipeline is a few readable files, versioned with your code.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hdrctl validate&lt;/code&gt; fails fast on your laptop or in CI, before a single row is read.&lt;/li&gt;
&lt;li&gt;One &lt;code&gt;pip install&lt;/code&gt; and no infrastructure.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When not to use Hydra ETL
&lt;/h2&gt;

&lt;p&gt;If you orchestrate hundreds of heterogeneous tasks across a cluster, use Airflow or Dagster. If your data already lives in a warehouse, dbt is the natural fit. Hydra ETL targets file-and-database pipelines that should stay readable and run without infrastructure. It is beta: pin your version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Code and docs: &lt;a href="https://github.com/bejaouibechir/Hydra" rel="noopener noreferrer"&gt;github.com/bejaouibechir/Hydra&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Try it in the browser: &lt;a href="https://hydraetl.com" rel="noopener noreferrer"&gt;hydraetl.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dataengineering</category>
      <category>python</category>
      <category>rust</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
