<?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 Iftikhar Liaquat on Medium]]></title>
        <description><![CDATA[Stories by Iftikhar Liaquat on Medium]]></description>
        <link>https://medium.com/@iftikharliaquat1995?source=rss-bb113753b3e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*12EVqrUPb7BuRXlF.jpg</url>
            <title>Stories by Iftikhar Liaquat on Medium</title>
            <link>https://medium.com/@iftikharliaquat1995?source=rss-bb113753b3e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 15:33:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iftikharliaquat1995/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[What Really Happens to Your Data When the Schema Changes in dbt (BigQuery Edition)]]></title>
            <link>https://medium.com/@iftikharliaquat1995/what-really-happens-to-your-data-when-the-schema-changes-in-dbt-bigquery-edition-876511a63fff?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/876511a63fff</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[schema-evolution]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Sat, 31 Oct 2026 21:53:00 GMT</pubDate>
            <atom:updated>2026-10-31T21:53:00.074Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Incremental models, </em><em>on_schema_change, and the quiet ways a pipeline can lose data.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wk_IwMTtKzKAY9fCoAQVqA.png" /></figure><p>I’ve been in this situation more than once. A source team adds a column, renames a field, or changes a type, and nobody tells me. My dbt run on BigQuery either fails at 3 a.m. or, worse, succeeds and quietly drops data.</p><p>I decided to dig into how dbt incremental models actually behave across the most common schema changes. This post is what I learned, and the rules of thumb I now follow.</p><h3>Three facts I keep in mind</h3><ol><li>dbt does not rebuild an incremental table when the schema changes. Incremental models are updated in place. Depending on one setting, dbt alters the table, ignores the change, or fails.</li><li>Nothing backfills automatically. A new column is NULL for older rows until I reprocess them myself.</li><li>The table is rebuilt only when I ask for it. That means --full-refresh or a table materialization. Changing partition_by or cluster_by does not rebuild anything on a normal run.</li></ol><h3>The one setting that decides everything: on_schema_change</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wvs8lgkWa5igUgv8oLqfJw.png" /></figure><p>Two things surprised me:</p><ul><li>The default, ignore, is the dangerous one. A new upstream column simply never shows up in the table, and nothing warns me.</li><li>on_schema_change only tracks top-level columns. Changes inside a STRUCT/RECORD on BigQuery don&#39;t trigger it.</li></ul><h3>Walking through the cases</h3><h3>1. A new column appears in the source</h3><p>With select * and the default ignore, the run succeeds but the column never reaches the destination. That&#39;s silent data loss. fail stops the pipeline until someone handles it. append_new_columns and sync_all_columns both add the column with ALTER TABLE: old rows are NULL, new rows are filled.</p><p>If my model lists columns explicitly and I haven’t touched it, nothing changes. If I add the new column to my SQL but keep ignore, it <em>still</em> isn&#39;t added to the table.</p><ul><li>append_new_columns and sync_all_columns both add the column with ALTER TABLE: old rows are NULL, new rows are filled.</li></ul><p>If my model lists columns explicitly and I haven’t touched it, nothing changes. If I add the new column to my SQL but keep ignore, it <em>still</em> isn&#39;t added to the table.</p><p><strong>My takeaway:</strong> use append_new_columns for the low-risk path. The table is never recreated.</p><h3>2. A column is dropped</h3><p>This is where sync_all_columns bites. It drops the column from the destination along with all of its history, permanently. append_new_columns is gentler: the column stays, with NULLs for new rows. ignore and fail simply fail the run.</p><p>With explicit columns, BigQuery usually fails first with “unrecognized name”, before dbt compares anything.</p><p><strong>My takeaway:</strong> if I must remove a column from the SELECT, I keep it as a default with the same name and type. The schema doesn’t change and history stays intact.</p><h3>3. A column is renamed</h3><p>A rename is really a drop plus an add, so history gets split:</p><ul><li>append_new_columns: the new column is added, the old one stays but is NULL going forward. History is split across two columns.</li><li>sync_all_columns: the new column is added and the old one is dropped. The old history is lost and the new column is NULL for old rows.</li></ul><p><strong>My takeaway:</strong> I alias the new name to the old one (customer_id as user_id). One column, one continuous history, no schema change at all.</p><h3>4. A type change</h3><p>ignore and append_new_columns don&#39;t compare types, so a MERGE may coerce values (risking truncation) or fail on a mismatch. fail stops the run. sync_all_columns applies the change, but on BigQuery that means create or replace table ... as select cast(...): same name, all data rewritten, a full table scan.</p><p><strong>My takeaway:</strong> SAFE_CAST to the destination type keeps the schema stable, but bad values quietly become NULL. I need to know which trade-off I&#39;m choosing.</p><h3>5 &amp; 6. REQUIRED ↔ NULLABLE</h3><p>dbt compares names and types, not column mode, so none of the four settings reacts to a mode change. Relaxing REQUIRED to NULLABLE means NULLs can now arrive. Tightening NULLABLE to REQUIRED leaves existing NULLs in place.</p><p><strong>My takeaway:</strong> I guard this with not_null tests or a quarantine step, not with on_schema_change.</p><h3>7. A new field inside a JSON payload</h3><p>The raw payload column doesn’t change, so dbt sees nothing. The field becomes a column only when I add something like JSON_VALUE(payload, &#39;$.plan&#39;) as plan to the model, and then only with append_new_columns or sync_all_columns. Old rows stay NULL.</p><h3>8. Partition or cluster changes</h3><p>These aren’t governed by on_schema_change at all.</p><ul><li>Changing partition_by or cluster_by is applied only on --full-refresh.</li><li>BigQuery can’t change a table’s partitioning in place, so the manual route is a new table plus a copy.</li><li>Clustering can be updated in place (bq update), but existing data is reclustered only if I run an UPDATE.</li><li>With insert_overwrite, partition values must match partition_by.data_type, or the merge filter errors.</li></ul><p>A rebuild only restores what the source still holds. If the source has been trimmed, a full refresh means lost history.</p><h3>My rules of thumb</h3><ul><li>I don’t leave the default. I pick append_new_columns for most incremental models: additive, cheap, never recreates the table.</li><li>I treat sync_all_columns as a deliberate, reviewed choice. It can permanently delete history.</li><li>I use fail where silence is unacceptable, such as finance or compliance tables, and accept the blocked pipeline.</li><li>I prefer aliases and defaults over renames and removals. They keep one continuous history.</li><li>I plan backfills myself. dbt will never do it for me.</li><li>I test nullability and types separately. The setting doesn’t see them.</li><li>I budget for full refreshes when touching partitioning, and check the source still holds enough history first.</li></ul><h3>Wrapping up</h3><p>dbt’s schema handling is simple once I understood its shape: one setting for top-level columns, no automatic backfill, and rebuilds only on request. The expensive surprises come from the defaults and from assuming dbt is watching things it isn’t, like nested fields, column modes and partitioning.</p><p>I now choose my on_schema_change setting on purpose, and the next upstream schema change becomes a routine PR instead of an incident.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=876511a63fff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Timezone Paradox: Demystifying Timestamp Behavior in Spark and Databricks]]></title>
            <link>https://medium.com/@iftikharliaquat1995/the-timezone-paradox-demystifying-timestamp-behavior-in-spark-and-databricks-8f6ec4fdc509?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f6ec4fdc509</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[handling-timezones]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Fri, 08 May 2026 13:44:46 GMT</pubDate>
            <atom:updated>2026-05-08T13:44:46.962Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have ever looked at a row of data in a Spark notebook and saw a different time than your colleague in a different city, you have encountered the “Timezone Paradox.” In the world of Big Data, time is not a simple string; it is a complex interaction between internal storage, session configurations, and display logic.</p><p>Here is the definitive guide to how Spark and Databricks handle timestamps under the hood.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*mzIxwr3TUdOYGjPXeQktdA.png" /></figure><h3>1. The “Absolute Truth”: Internal Storage</h3><p>The most important rule to remember is that <strong>Spark is a UTC-first engine.</strong></p><p>Internally, when you define a column as TimestampType, Spark does not store the string &quot;2026-05-01 05:00:00 PDT&quot;. Instead, it calculates the number of microseconds that have passed since the Unix Epoch ($1970-01-01$ $00:00:00$ $UTC$).</p><p>Regardless of whether your source data was recorded in Tokyo, London, or Los Angeles, once it is written to a <strong>Delta Lake</strong> or Parquet file, it is physically stored as an absolute UTC value. This “Normalization” is what allows a global data lake to function without conflicting local clocks.</p><h3>2. The “Lens”: Session-Local Timezones</h3><p>If the data is stored in UTC, why do we see local times in our notebooks? This happens because of the <strong>Session Timezone</strong>.</p><p>Spark uses a configuration called spark.sql.session.timeZone. You can think of this as a &quot;lens&quot; through which you view the data.</p><ul><li><strong>The Inbound Shift:</strong> When you read a string into a timestamp, Spark uses the session timezone to calculate how many hours to add or subtract to reach UTC.</li><li><strong>The Outbound Shift:</strong> When you run df.show(), Spark reads the UTC value from S3, looks at your session timezone, and shifts the value back to your &quot;Local&quot; time for display.</li></ul><p><strong>The Danger:</strong> If your session is set to America/New_York (UTC-5) and your data is 12:00:00 UTC, you will see 07:00:00. If you aren&#39;t aware of this shift, you might mistakenly think the data is &quot;wrong.&quot;</p><h3>3. The New Frontier: TimestampNTZType</h3><p>Introduced in Spark 3.4, there is now a way to opt-out of this behavior: <strong>Timestamp No Time Zone (NTZ)</strong>.</p><p><strong>TimestampType (Standard)</strong></p><ul><li>Stored as UTC.</li><li>Shifts based on Session TZ.</li><li>Best for: Global payments/logs.</li></ul><p><strong>TimestampNTZType (New)</strong></p><ul><li>Stored exactly as written (“Wall Clock”).</li><li>Never shifts.</li><li>Best for: Local store hours/schedules.</li></ul><h3>4. Engineering Best Practices</h3><p>To avoid the “Invisible Shift” and ensure your pipeline is production-grade, follow these three rules:</p><ol><li><strong>Enforce UTC at the Start:</strong> Always set your Spark session to UTC at the top of your notebook: spark.conf.set(&quot;spark.sql.session.timeZone&quot;, &quot;UTC&quot;)</li><li><strong>Explicit Conversions:</strong> If you need to show data in a specific timezone for a business report, use from_utc_timestamp(col, &#39;Target/Zone&#39;) rather than relying on the user&#39;s session settings.</li><li><strong>Audit the Raw:</strong> In your Bronze layer, keep the original raw string (e.g., time_completed) alongside your normalized TimestampType column. This allows you to &quot;trace back&quot; to the original source if there is ever a dispute over a transaction time.</li></ol><h3>Conclusion</h3><p>Timezones in Spark aren’t a bug; they are a feature designed to provide a unified timeline for global data. By understanding that <strong>Storage = UTC</strong> and <strong>Display = Session</strong>, you can build pipelines that are accurate, resilient, and — most importantly — consistent across the globe.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f6ec4fdc509" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Great ID Debate: UUID vs. ULID vs. UUIDv7]]></title>
            <link>https://medium.com/@iftikharliaquat1995/the-great-id-debate-uuid-vs-ulid-vs-uuidv7-ec9c9e9ae007?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec9c9e9ae007</guid>
            <category><![CDATA[uuidv7]]></category>
            <category><![CDATA[uuid]]></category>
            <category><![CDATA[ulid]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Mon, 04 May 2026 21:26:50 GMT</pubDate>
            <atom:updated>2026-05-04T21:26:50.461Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85_BdB3CGlWHRqiDMevoCg.png" /></figure><p>When building a database or distributed system, picking the right unique identifier is one of those early architectural decisions that can come back to haunt you years later.</p><p>For a long time, the UUID (Universally Unique Identifier) was the undisputed king. However, as applications scaled, a major performance flaw in the standard UUID design paved the way for a newer alternative: the ULID (Universally Unique Lexicographically Sortable Identifier).</p><p>Here is a pragmatic breakdown of how they compare, why databases struggle with standard UUIDs, and which one you should use for your modern applications today.</p><h3>1. What is a UUID?</h3><p>A UUID is a 128-bit identifier designed to be globally unique without requiring a central coordinator. The most common version you will see in the wild is <strong>UUIDv4</strong>.</p><ul><li><strong>How it works:</strong> UUIDv4 is almost entirely generated from random noise.</li><li><strong>The Format:</strong> It is represented as a 36-character hexadecimal string with hyphens. <em>(Example: </em><em>123e4567-e89b-12d3-a456-426614174000)</em></li><li><strong>The Pros:</strong> Guaranteed collision resistance. You can generate them offline, on any server, concurrently, without worrying about duplicates.</li></ul><h3>2. What is a ULID?</h3><p>A ULID is also a 128-bit identifier, but it was specifically engineered to solve the sorting and database performance problems caused by standard UUIDs.</p><ul><li><strong>How it works:</strong> It splits the 128 bits into two distinct parts: a 48-bit timestamp (accurate to the millisecond) followed by 80 bits of randomness.</li><li><strong>The Format:</strong> It uses Crockford’s Base32 encoding, resulting in a 26-character string without hyphens or ambiguous characters like I, L, O, or U. <em>(Example: </em><em>01ARZ3NDEKTSV4RRFFQ69G5FAV)</em></li><li><strong>The Pros:</strong> It is URL-safe, shorter than a standard UUID string, and most importantly, <strong>sortable by time</strong>.</li></ul><h3>3. The Showdown: Why the Difference Matters</h3><p>The debate between ULID and UUID usually comes down to readability, sortability, and database performance. Here is how they stack up at a glance:</p><p><strong>Length &amp; Format:</strong> UUIDv4 is 36 characters long and relies on hexadecimal formatting broken up by hyphens. ULID is a much more compact 26 characters and uses an alphanumeric format (Base32) with absolutely no hyphens.</p><p><strong>URL-Safety:</strong> Because of its hyphens, UUIDv4 can sometimes be clunky or require extra encoding when passed through URLs. ULID, being purely alphanumeric, is inherently URL-safe.</p><p><strong>Sortability:</strong> This is a massive differentiator. UUIDv4 generation is total chaos; if you generate ten of them, they will sort completely randomly. ULIDs, however, are naturally time-sortable because their first 48 bits represent the exact millisecond they were created.</p><h4>The Database Dealbreaker</h4><p>Database performance is the primary reason engineers switch to ULIDs.</p><p>Relational databases (like PostgreSQL or MySQL) typically use B-Tree indexes for their primary keys. B-Trees love sequential data (like 1, 2, 3…). Because ULIDs start with a timestamp, they are essentially sequential. When you insert a new ULID, the database neatly appends it to the right edge of the index.</p><p>Standard UUIDv4s, on the other hand, are entirely random.</p><blockquote><em>When you insert millions of random strings into a database, the database has to constantly reshuffle its B-Tree to put the new UUID in the middle of the index.</em></blockquote><p>This causes a destructive phenomenon called <strong>Index Fragmentation</strong> and <strong>Page Splitting</strong>. Over time, writing random UUIDs to a database will bloat your RAM usage, drastically slow down write speeds (sometimes by 50%), and destroy your cache hit ratios.</p><h3>4. The Plot Twist: UUIDv7</h3><p>If you look at the comparison above, ULID seems like the obvious winner. However, the Internet Engineering Task Force (IETF) recently leveled the playing field.</p><p>In May 2024, they published RFC 9562, officially standardizing <strong>UUIDv7</strong>.</p><p>UUIDv7 does exactly what ULID does: it places a Unix timestamp at the front of the ID and fills the rest with randomness. This means UUIDv7 gives you the sequential, database-friendly performance of a ULID, but allows you to keep using the standard 36-character UUID format that every programming language, database, and ORM in the world already natively supports.</p><h3>The Verdict: Which Should You Choose?</h3><p>Choosing your primary key strategy doesn’t have to be complicated. Follow these simple guidelines based on your project’s needs:</p><ul><li><strong>Use ULID if:</strong> You want shorter, URL-safe identifiers (26 characters vs 36), or you want a cleaner string format without hyphens for your user-facing APIs.</li><li><strong>Use UUIDv7 if:</strong> You are starting a new project today and want the performance of time-sorted IDs, but prefer to stick to industry-standard formats that require zero third-party libraries to implement.</li><li><strong>Use UUIDv4 if:</strong> You have a strict security requirement where the creation time of the ID <strong>must not</strong> be discoverable by the user, and you are willing to accept the database performance hit that comes with pure randomness.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec9c9e9ae007" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 4 Machine Learning Algorithms You Actually Need to Know]]></title>
            <link>https://medium.com/@iftikharliaquat1995/the-4-machine-learning-algorithms-you-actually-need-to-know-072eea6b969d?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/072eea6b969d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[predictive-analytics]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Sun, 26 Apr 2026 11:59:03 GMT</pubDate>
            <atom:updated>2026-04-26T11:59:03.985Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are stepping into the world of Artificial Intelligence today, the landscape looks terrifying. Every day there is a new paper on ArXiv, a new neural network architecture, and a new buzzword. I can tell you a secret that experienced data scientists know: <strong>You do not need to learn 50 different algorithms.</strong> In production, 95% of business problems are solved by a handful of battle-tested models. If you want to cut through the noise and understand how AI actually works under the hood, here are the four algorithmic engines you need to know, explained pragmatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d3U7bbLjR9RysvgwCCml0A.png" /></figure><h3>1. Logistic Regression: The Pragmatic Baseline</h3><p><em>The algorithm that powers the “Yes/No” decisions of the internet.</em></p><p>When beginners start, they usually want to build a deep neural network to predict if a customer will churn. A senior engineer will stop them and say, “Try Logistic Regression first.”</p><p><strong>How it works:</strong> Imagine plotting all your data points on a graph. Logistic Regression simply tries to draw the single best straight line (or flat plane) through that graph to separate the “Yes” outcomes from the “No” outcomes. It then calculates the mathematical probability that a new data point falls on the “Yes” side of the line.</p><p><strong>Why you need it:</strong> It is incredibly fast, cheap to run, and most importantly, <strong>interpretable</strong>. If a bank denies a loan using Logistic Regression, the engineers can look at the math and tell the customer exactly <em>why</em> (e.g., “Your credit score weight pulled the probability down by 12%”). Try doing that with a deep neural network.</p><h3>2. Gradient Boosted Trees (XGBoost): The Tabular King</h3><p><em>The algorithm that wins Kaggle competitions and runs enterprise data.</em></p><p>If your data lives in rows and columns (like an Excel spreadsheet or a SQL database), you do not use Deep Learning. You use Gradient Boosting.</p><p><strong>How it works:</strong> Instead of building one massive, complex model, Gradient Boosting builds a simple “Decision Tree” (a basic flowchart). That first tree will make mistakes. The algorithm then builds a <em>second</em> tree specifically designed to fix the mistakes of the first tree. Then a third tree to fix the mistakes of the second. It does this thousands of times. By combining thousands of weak, highly-specialized models, you get an absolute powerhouse.</p><p><strong>Why you need it:</strong> Whether it is predicting housing prices, detecting credit card fraud, or forecasting inventory, XGBoost and LightGBM are the absolute heavyweights of structured data.</p><h3>3. K-Means Clustering: The Unsupervised Detective</h3><p><em>The algorithm you use when you don’t know what you are looking for.</em></p><p>The previous algorithms are “Supervised” — meaning you have historical data with the answers already labeled. But what if you just have a giant database of user activity and no labels?</p><p><strong>How it works:</strong> You tell the algorithm, “I want to find 5 distinct groups in this data.” K-Means throws 5 random center-points (centroids) onto your data graph. It then groups every data point to its nearest center. Then, it recalculates the actual center of those new groups and moves the points. It repeats this until the groups stop shifting.</p><p><strong>Why you need it:</strong> This is how marketing teams build “Customer Personas.” It is how Spotify finds sub-genres of music. It looks at the chaos and naturally groups similar things together based on their mathematical proximity.</p><h3>4. The Transformer: The Engine of Modern AI</h3><p>You cannot talk about modern AI without talking about the Transformer architecture. Before 2017, AI struggled to read long paragraphs because it would “forget” the beginning of the sentence by the time it reached the end.</p><p><strong>How it works:</strong> Transformers use a mechanism called <strong>Self-Attention</strong>. Instead of reading a sentence word-by-word sequentially, it looks at <em>every word in the sentence at the exact same time</em>. It mathematically calculates how much “attention” each word should pay to every other word.</p><p>If it reads “The bank of the river,” the attention mechanism links “bank” heavily to “river.” If it reads “The bank on Wall Street,” it links “bank” to “Wall Street.” It understands context dynamically.</p><p><strong>Why you need it:</strong> This is the underlying architecture for Generative AI. Whether you are generating text, translating languages, or writing code, the Transformer is the underlying engine doing the heavy lifting.</p><h3>The Key Takeaway</h3><p>Do not get distracted by the hype. Start by understanding how a simple line separates data (Logistic Regression), then learn how trees learn from mistakes (XGBoost), and finally, you will have the foundation to understand how context is mapped in modern Generative AI (Transformers).</p><p>What kind of data are you hoping to work with first — are you looking at standard tabular database data, or are you wanting to dive into unstructured text and language?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=072eea6b969d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embracing the Chaos: A Pragmatic Guide to Schema Evolution in Delta Lake]]></title>
            <link>https://medium.com/@iftikharliaquat1995/embracing-the-chaos-a-pragmatic-guide-to-schema-evolution-in-delta-lake-c2c285420f33?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2c285420f33</guid>
            <category><![CDATA[schema-evolution]]></category>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[delta-lake]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 19:04:18 GMT</pubDate>
            <atom:updated>2026-04-20T19:04:18.640Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MOqMs_kyp0p1OC0Zbqglfg.png" /></figure><p>Every data engineer has lived through this exact scenario: It is 2:00 PM on a Friday. The upstream software engineering team deploys a new feature. To support it, they add a single user_preferences column to their application database.</p><p>They don’t tell you.</p><p>Your ETL pipeline runs, tries to insert a payload with 15 columns into a data warehouse table that only expects 14, and instantly crashes. Pagers go off. Dashboards fail. You spend the rest of the afternoon manually writing ALTER TABLE ADD COLUMN statements instead of doing actual engineering.</p><p>In the era of modern data engineering, upstream schemas will inevitably change. <strong>Delta Lake</strong> solves this natively through a feature called <strong>Schema Evolution</strong>.</p><p>Here is the guide on how schema evolution works in Delta Lake, how to handle it in PySpark, and the exact configurations you need to use it safely in production.</p><h3>1. The Default State: Schema Enforcement</h3><p>Before we talk about evolution, you must understand Delta Lake’s default behavior. By default, Delta Lake uses <strong>Schema Enforcement</strong> (sometimes called schema validation).</p><p>If you try to write a PySpark DataFrame to a Delta table and the DataFrame has a column that the target table does not, the write will fail immediately with an AnalysisException.</p><p><em>This is a feature, not a bug.</em> It prevents garbage data from silently polluting your pristine tables. However, when you <em>expect</em> the data to change (like in a raw ingestion layer), you need to flip the switch from Enforcement to Evolution.</p><h3>2. Enabling Schema Evolution in PySpark (mergeSchema)</h3><p>Schema evolution allows you to safely update your Delta table’s schema automatically when you append or overwrite data.</p><p>There are two primary ways to enable this in Spark.</p><h4>Method A: The DataFrame Option (Recommended)</h4><p>The safest and most common way to evolve a schema is to explicitly define it at the write operation level using .option(&quot;mergeSchema&quot;, &quot;true&quot;).</p><pre># Assume &#39;df&#39; has a new column: &#39;user_preferences&#39; (StringType)<br><br>(df.write<br>   .format(&quot;delta&quot;)<br>   .mode(&quot;append&quot;)<br>   .option(&quot;mergeSchema&quot;, &quot;true&quot;) # &lt;--- The Magic Switch<br>   .save(&quot;/path/to/delta/table&quot;)<br>)</pre><p>When you run this, Delta Lake automatically updates the transaction log (_delta_log), alters the table schema to include user_preferences, and appends the new Parquet files. For all older records, querying the user_preferences column will simply return null.</p><h4>Method B: The Global Spark Session Config</h4><p>If you are building a massive ingestion pipeline and don’t want to append .option(&quot;mergeSchema&quot;, &quot;true&quot;) to fifty different write statements, you can enable it at the Spark Session level.</p><pre># Enable globally for the current Spark Session<br>spark.conf.set(&quot;spark.databricks.delta.schema.autoMerge.enabled&quot;, &quot;true&quot;)<br><br># Now every Delta write will automatically merge schemas<br>df.write.format(&quot;delta&quot;).mode(&quot;append&quot;).save(&quot;/path/to/delta/table&quot;)</pre><blockquote><strong>The Reality Check:</strong> Be incredibly careful with the global config. If you leave it on, a bug in your transformation logic could accidentally dump 50 misspelled columns into your production Gold tables without triggering an error. Use Method A unless you have a very specific architectural reason not to.</blockquote><h3>3. What Changes are Actually Allowed?</h3><p>mergeSchema is smart, but it is not magic. It only allows safe, non-destructive changes.</p><p><strong>What </strong><strong>mergeSchema WILL do automatically:</strong></p><ul><li>Add new columns.</li><li>Add new nested fields inside complex Structs (JSON objects).</li><li>Upcast specific data types safely (e.g., automatically promoting a ByteType to an IntegerType, or IntegerType to LongType).</li></ul><p><strong>What </strong><strong>mergeSchema WILL NOT do:</strong></p><ul><li>Drop columns that are no longer present in the incoming DataFrame.</li><li>Rename existing columns.</li><li>Perform destructive data type changes (e.g., trying to change an IntegerType to a StringType).</li></ul><h3>4. Dealing with Destructive Changes (overwriteSchema)</h3><p>What happens if the upstream team decides to change a user_id column from an INT to a STRING?</p><p>If you use mergeSchema, the pipeline will crash because Spark cannot safely merge an integer column into a string column without potentially corrupting data. To force this change, you have to use <strong>Schema Overwrite</strong>.</p><p>This is a much more aggressive operation. It drops the old schema completely and replaces it with the schema of your incoming PySpark DataFrame.</p><pre>(df.write<br>   .format(&quot;delta&quot;)<br>   .mode(&quot;overwrite&quot;) # Must be overwrite!<br>   .option(&quot;overwriteSchema&quot;, &quot;true&quot;) # &lt;--- Forcing the destructive change<br>   .save(&quot;/path/to/delta/table&quot;)<br>)</pre><blockquote><strong><em>Note:</em></strong><em> Overwriting the schema requires </em><em>mode(&quot;overwrite&quot;). You cannot append data with a fundamentally different, incompatible data type. If you need to retain old data with the new type, you must read the whole table, cast the old column to the new type in PySpark, and then overwrite the table entirely.</em></blockquote><h3>5. The Production Architecture Rule</h3><p>Just because you <em>can</em> evolve schemas automatically doesn’t mean you <em>should</em> do it everywhere. The industry standard for handling this is tied to the Medallion Architecture:</p><ol><li><strong>Bronze Layer (Raw Data): Turn it ON.</strong> Upstream systems are messy. Your Bronze layer should use .option(&quot;mergeSchema&quot;, &quot;true&quot;) so that new columns are captured automatically without breaking ingestion.</li><li><strong>Silver Layer (Cleansed Data): Keep it OFF.</strong> Your transformation logic expects specific columns. If a column changes unexpectedly here, you want the pipeline to fail so you can investigate.</li><li><strong>Gold Layer (Aggregated Data): Keep it OFF.</strong> These are your final tables powering BI dashboards and executive reports. The schema must be strictly enforced via Data Contracts.</li></ol><p>Schema evolution is one of the most powerful tools in the PySpark/Delta Lake ecosystem. Use it in the landing zones to stop getting paged on Fridays, but maintain strict enforcement downstream to protect your business logic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2c285420f33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vanity Metrics Are Lying to You: The Engineer’s Guide to Cohort Analysis]]></title>
            <link>https://medium.com/@iftikharliaquat1995/vanity-metrics-are-lying-to-you-the-engineers-guide-to-cohort-analysis-bb98b1d5609a?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb98b1d5609a</guid>
            <category><![CDATA[cohort-analysis]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[churn-analysis]]></category>
            <category><![CDATA[user-retention]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 18:05:37 GMT</pubDate>
            <atom:updated>2026-04-20T18:05:37.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ypg1HvAsbC0GmfvD79cAWA.png" /></figure><p>If you are judging the health of your product by looking at aggregate metrics like “Total Registered Users” or standard “Monthly Active Users” (MAU), you are flying blind.</p><p>Aggregate metrics are vanity metrics. They only go up and to the right, which looks great on a slide deck, but they completely mask the underlying reality of user churn. You might be acquiring 10,000 new users a month, but if 9,500 of them abandon your app after day three, you do not have a growing product — you have a leaky bucket.</p><p>To actually understand if your product is sticky, you need to stop looking at the aggregate and start looking at <strong>Cohorts</strong>.</p><p>Here is the battle-tested, pragmatic guide to implementing cohort analysis in your data warehouse, moving past the vanity numbers, and finding out what is actually happening to your users.</p><h3>1. What is a Cohort (and Why Does It Matter)?</h3><p>A cohort is simply a group of users who share a common characteristic within a specific time period. The most common grouping is the <strong>Acquisition Month</strong> (e.g., “Users who signed up in January”).</p><p>By tracking these specific groups over time, you isolate variables. If you release a massive UI overhaul in March, cohort analysis allows you to see if the “March Cohort” retains better in their first 30 days than the “February Cohort” did. It gives you cause and effect.</p><h3>2. The Three Pillars of Setup</h3><p>Before writing any SQL, you have to define your parameters. If you get these wrong, your dashboard will be useless.</p><ul><li><strong>The Cohort Definition (The Grouping):</strong> How are we grouping users? Usually, this is the month they created their account.</li><li><strong>The Engagement Event (The Action):</strong> What defines an “active” user? Logging in is a terrible metric. You need to track the core value metric. For a B2B SaaS app, it might be report_generated. For e-commerce, it is purchase_completed.</li><li><strong>The Time Interval (The Buckets):</strong> How are we measuring the passage of time? For enterprise software, <strong>Months</strong> make the most sense. For mobile gaming or consumer social media, you need <strong>Days</strong> or <strong>Weeks</strong>.</li></ul><h3>3. The SQL Architecture</h3><p>You do not need an expensive product analytics tool to do this. If your data lives in a standard data warehouse (Snowflake, BigQuery, PostgreSQL), you just need a solid multi-step Common Table Expression (CTE) query.</p><p>Here is the blueprint for calculating monthly retention.</p><h4>Step 1 &amp; 2: Find the “Birth” and the “Activity”</h4><p>First, we find the exact month each user signed up, and then we find every subsequent month they performed our core action.</p><pre>WITH cohort_items AS (<br>  -- The Birth Month<br>  SELECT <br>    user_id,<br>    DATE_TRUNC(&#39;month&#39;, MIN(event_timestamp)) AS cohort_month<br>  FROM user_events<br>  WHERE event_name = &#39;account_created&#39;<br>  GROUP BY 1<br>), <br>user_activities AS (<br>  -- The Activity Months<br>  SELECT <br>    user_id,<br>    DATE_TRUNC(&#39;month&#39;, event_timestamp) AS activity_month<br>  FROM user_events<br>  WHERE event_name = &#39;core_value_action&#39;<br>  GROUP BY 1, 2<br>),</pre><h4>Step 3: Calculate the Baseline Size</h4><p>To calculate a percentage later, we need to know exactly how many users were in each original cohort.</p><pre>cohort_size AS (<br>  SELECT <br>    cohort_month,<br>    COUNT(DISTINCT user_id) AS total_users<br>  FROM cohort_items<br>  GROUP BY 1<br>),</pre><h4>Step 4: Calculate the Time Delta</h4><p>This is the engine of the query. We join the user’s birth month to their activity months and calculate the difference to figure out if this was their “Month 1”, “Month 2”, or “Month 12” of activity.</p><pre>retention_base AS (<br>  SELECT <br>    c.cohort_month,<br>    COUNT(DISTINCT a.user_id) AS active_users,<br>    -- Calculate the difference in months<br>    (EXTRACT(YEAR FROM a.activity_month) - EXTRACT(YEAR FROM c.cohort_month)) * 12 + <br>    (EXTRACT(MONTH FROM a.activity_month) - EXTRACT(MONTH FROM c.cohort_month)) AS month_number<br>  FROM cohort_items c<br>  LEFT JOIN user_activities a ON c.user_id = a.user_id<br>  GROUP BY 1, 3<br>)</pre><h4>Step 5: The Final Percentage</h4><p>Finally, we bring it all together.</p><pre>SELECT <br>  r.cohort_month,<br>  s.total_users,<br>  r.month_number,<br>  r.active_users,<br>  ROUND((r.active_users::NUMERIC / s.total_users) * 100, 2) AS retention_percentage<br>FROM retention_base r<br>JOIN cohort_size s ON r.cohort_month = s.cohort_month<br>WHERE r.month_number IS NOT NULL<br>ORDER BY 1, 3;</pre><h3>4. Reading the Heatmap Like an Architect</h3><p>When you plug that SQL output into a BI tool (like Tableau, Looker, or Metabase) and pivot it, you get the classic <strong>Cohort Heatmap</strong> (the triangle chart).</p><p>The Y-Axis represents the Cohort (e.g., Jan 2026, Feb 2026), the X-Axis represents the Time Delta (Month 0, Month 1, Month 2), and the cells display the retention percentage.</p><p>Here is how you read it to diagnose your product:</p><ul><li><strong>Read Down a Column (Evaluating Product Updates):</strong> This tells you if your product is getting better at onboarding. Look at the “Month 1” column. If the January cohort had 20% retention in Month 1, but the April cohort has 35% retention in Month 1, your recent onboarding tweaks are working.</li><li><strong>Read Across a Row (Evaluating Product Lifecycle):</strong> This tells you the lifecycle of a specific group. It shows you the exact month where users hit a wall. If you see a massive drop at Month 3 across <em>all</em> cohorts, you have a 90-day lifecycle problem. Your users are running out of value after three months, and you need to build mid-game features.</li></ul><h3>5. The Rookie Mistake: Survivorship Bias &amp; Data Delays</h3><p>There is one major trap you must avoid when sharing these dashboards with stakeholders: <strong>Incomplete Time Periods.</strong></p><p>If today is April 20th, the “Month 0” data for the April cohort is incomplete. If you plot it blindly, it will look like the April cohort is performing terribly compared to March, which had a full 31 days to log activity. Your executives will panic.</p><p>Always filter out the current, incomplete time period in your BI tool, or add a strict WHERE clause in your SQL to only analyze fully completed months.</p><p>Stop relying on MAU. Implement a cohort model, find out exactly when your users are leaving, and start building features that actually plug the leak.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb98b1d5609a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Delta Lake: How to Bring Database Reliability to Your Data Lake]]></title>
            <link>https://medium.com/@iftikharliaquat1995/demystifying-delta-lake-how-to-bring-database-reliability-to-your-data-lake-a2d29995be02?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2d29995be02</guid>
            <category><![CDATA[data-versioning]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[medallion-architecture]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 17:33:29 GMT</pubDate>
            <atom:updated>2026-04-16T17:33:29.130Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*64wNYHhW6tGHnu-mhQYNOA.png" /></figure><p>For years, data engineering teams have been caught in a painful tug-of-war between two storage paradigms: the <strong>Data Lake</strong> and the <strong>Data Warehouse</strong>.</p><p>We loved Data Lakes (like Amazon S3 or Google Cloud Storage) because they were infinitely scalable, cheap, and could hold any type of data. But they were notoriously unreliable. Failed jobs left behind corrupted files, and multiple users trying to read and write at the same time caused chaos.</p><p>So, we built complex pipelines to move that data into Data Warehouses (like Snowflake or Redshift). Warehouses were reliable, structured, and fast — but they were expensive, locked us into proprietary formats, and struggled with the unstructured data needed for modern machine learning.</p><p>Enter <strong>Delta Lake</strong>, the open-source technology that fundamentally changed this dynamic by creating the <strong>Data Lakehouse</strong>.</p><p>Here is a deep dive into what Delta Lake is, how it works under the hood, and why it has become the backbone of the modern data stack.</p><h3>What is Delta Lake?</h3><p>At its core, Delta Lake is an open-source storage layer that sits directly on top of your existing data lake. It brings the reliability, performance, and ACID transactions of a traditional data warehouse to the cheap, scalable object storage of a data lake.</p><p>It is not a new execution engine (you still use Apache Spark, Presto, or Trino to process the data), and it is not a new proprietary database. It is a framework that organizes your open-source Parquet files in a way that makes them bulletproof.</p><h3>The 4 Superpowers of Delta Lake</h3><p>Why are data teams migrating petabytes of data to Delta Lake? Because it solves the most massive headaches in data engineering:</p><h4>1. ACID Transactions on Object Storage</h4><p>In a standard data lake, if a massive pipeline crashes 90% of the way through, you are left with a “data swamp” of partial, corrupted files. You have to manually find and delete the bad data before rerunning the job. Delta Lake introduces <strong>ACID transactions</strong>. If a job fails, the transaction is automatically rolled back. Your data is never left in a corrupted state. Furthermore, a Spark streaming job can write to a table at the exact same time a BI tool is reading from it, without causing locking errors or reading partial data.</p><h4>2. Time Travel (Data Versioning)</h4><p>Have you ever accidentally dropped a table or overwritten a critical column? In a traditional database, you are making a panicked call to the DBA for a backup. Delta Lake automatically versions every change made to your data. “Time Travel” allows you to query a table exactly as it looked at a specific timestamp or version number.</p><p>SQL</p><pre>-- Query the data as it was exactly one week ago<br>SELECT * FROM users TIMESTAMP AS OF &#39;2026-04-09&#39;;</pre><p>This is a game-changer for auditing, rolling back mistakes, and reproducing machine learning models based on historical datasets.</p><h4>3. Schema Enforcement and Evolution</h4><p>“Bad data” is the enemy of analytics. Delta Lake enforces your schema rigorously. If an upstream software change tries to inject a string into an integer column, Delta Lake will block the write, protecting your downstream dashboards. However, when you <em>want</em> the schema to change (e.g., adding a new feature column), Delta allows for graceful <strong>Schema Evolution</strong>. You can simply add an option to your write command, and the table will automatically update its schema to accommodate the new columns without requiring a massive table rewrite.</p><h4>4. Unified Batch and Streaming</h4><p>Historically, teams had to maintain a “Lambda Architecture” — one pipeline for batch processing (nightly data) and a completely separate pipeline for streaming (real-time data). Delta Lake handles both natively. A Delta table can be a batch table, a streaming source, and a streaming sink all at once.</p><h3>How Does It Actually Work? (The Secret Sauce)</h3><p>If Delta Lake isn’t a database, how does it do all this?</p><p>If you look at a Delta table in your S3 bucket, you won’t see a proprietary black box. You will see two things:</p><ol><li><strong>Data Files:</strong> Standard, open-source .parquet files.</li><li><strong>The </strong><strong>_delta_log Directory:</strong> This is where the magic happens.</li></ol><p>The _delta_log is a sequential transaction log. Every time you insert, update, or delete data, Delta Lake writes a JSON file into this log recording exactly what happened (e.g., &quot;Add file A.parquet, Remove file B.parquet&quot;).</p><p>When a compute engine like Spark goes to read the table, it doesn’t blindly scan your S3 bucket. It reads the _delta_log first. The log gives Spark a definitive blueprint of exactly which Parquet files represent the current, valid state of the table. It simply ignores the files that were deleted or left behind by failed jobs.</p><h3>The Medallion Architecture</h3><p>Delta Lake’s reliability popularized a data design pattern known as the <strong>Medallion Architecture</strong>, which is now the industry standard for Lakehouses. It logically organizes data into three distinct layers:</p><ul><li><strong>Bronze (Raw Data):</strong> Data is ingested from source systems “as-is.” It is append-only and acts as a historical archive.</li><li><strong>Silver (Cleansed Data):</strong> The Bronze data is filtered, cleaned, deduplicated, and enriched. This becomes the “Source of Truth” for the enterprise.</li><li><strong>Gold (Business-Ready Data):</strong> Data is aggregated and modeled (e.g., star schemas) specifically to power BI dashboards and executive reporting.</li></ul><p>Because Delta Lake ensures transactions and data quality at every step, data can flow from Bronze to Gold with complete trust.</p><h3>Final Thoughts</h3><p>Delta Lake represents a paradigm shift. We no longer have to choose between the scalability of a data lake and the reliability of a data warehouse. By adopting an open-format Lakehouse architecture with Delta Lake, data teams can build faster, break things less, and spend more time delivering value rather than firefighting corrupted data.</p><p><em>Have you made the transition from a traditional Data Warehouse to a Lakehouse yet? Let’s discuss your experience in the comments!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2d29995be02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Unbreakable Data Pipelines: How to Ship Updates Daily Without Breaking Analytics]]></title>
            <link>https://medium.com/analytics-vidhya/building-unbreakable-data-pipelines-how-to-ship-updates-daily-without-breaking-analytics-f54f47392ced?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f54f47392ced</guid>
            <category><![CDATA[dataops]]></category>
            <category><![CDATA[data-contract]]></category>
            <category><![CDATA[zero-downtime]]></category>
            <category><![CDATA[decoupled-architecture]]></category>
            <category><![CDATA[wap-pattern]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 12:16:56 GMT</pubDate>
            <atom:updated>2026-04-15T12:16:56.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*84jgRnwC1TQvO_haYgNs2g.png" /></figure><p>If you work in a fast-paced, data-driven company — especially in high-growth sectors like mobility or fintech — you know the core struggle of a data engineer: <strong>The business wants infrastructure improvements and new features deployed instantly, but they also expect their dashboards to never, ever break.</strong> In legacy architectures, these two expectations are fundamentally at odds. If you touch a monolithic SQL script or alter a core table, you risk bringing down executive reporting, machine learning models, and ultimately, business trust.</p><p>So, how do modern scale-ups build data architectures that allow for daily or weekly infrastructure improvements without disrupting existing analytics capabilities?</p><p>The secret isn’t just buying the latest tools; it’s a philosophical shift. You have to stop treating data like a static warehouse and start treating it like a living software product. Here is the blueprint for building a modular, zero-downtime data architecture.</p><h3>1. Adopt the Write-Audit-Publish (WAP) Pattern</h3><p>In a traditional pipeline, an ETL job wakes up, processes data, and overwrites or appends directly to the production tables that your BI tools read from. If the pipeline processes bad data, your business users see it immediately.</p><p>To achieve zero-downtime updates, you need the <strong>Write-Audit-Publish (WAP)</strong> pattern:</p><ul><li><strong>Write:</strong> Your updated pipeline runs and writes data into a hidden “staging” environment or a cloned table.</li><li><strong>Audit:</strong> Automated data quality tests run against this hidden data. Are there unexpected nulls? Did the row count drop by 50%?</li><li><strong>Publish:</strong> Only if all tests pass does the system perform a metadata swap (like an atomic view update). The BI tools are instantly pointed to the fresh data.</li></ul><p>If your new code introduces a bug, the audit fails, the publish step is blocked, and the business continues reading the slightly stale, but 100% accurate, old data while you fix the issue.</p><h3>2. Embrace Modular Transformations (The Medallion Architecture)</h3><p>If your data transformations live in a 2,000-line stored procedure, making a daily improvement is a terrifying game of Jenga. Modern architectures rely on tools like <strong>dbt (data build tool) or spark </strong>to break transformations into modular, version-controlled components.</p><p>By structuring your warehouse using the <strong>Medallion Architecture</strong>, you isolate changes:</p><ul><li><strong>Bronze (Raw):</strong> Unfiltered data directly from the source.</li><li><strong>Silver (Cleansed):</strong> Filtered, deduplicated, and normalized data.</li><li><strong>Gold (Business-Ready):</strong> Highly aggregated tables built specifically for dashboards.</li></ul><p>With this modularity, a data engineer can completely rewrite the underlying logic of a Silver table to make it run 10x faster. As long as they don’t change the final columns passed to the Gold layer, the downstream analytics remain blissfully unaware of the major infrastructure surgery that just occurred.</p><h3>3. Use Views and Contracts as an API</h3><p>You must protect your analytics users from the chaos of upstream engineering.</p><p><strong>Never let BI tools (like Tableau or Looker) connect directly to physical tables.</strong> Instead, create a dedicated “Reporting” schema made entirely of database Views. This acts as an API layer. You can change the underlying physical tables daily — renaming them, partitioning them, or moving them — but as long as the View’s output schema remains identical, the dashboards will never break.</p><p>To protect the pipeline itself, implement <strong>Data Contracts</strong>. These are programmatic agreements between software engineers and data engineers. If a software developer drops a critical column from the production app database, the CI/CD pipeline catches the broken contract and blocks the deployment <em>before</em> it causes an analytics outage.</p><h3>4. Immutable Infrastructure &amp; CI/CD</h3><p>To push daily improvements safely, manual changes in the cloud console must be banned.</p><ul><li><strong>Infrastructure as Code (IaC):</strong> Every piece of the data stack — from S3 buckets and Spark clusters to Snowflake roles and Airflow jobs — should be defined in code using tools like <strong>Terraform</strong>.</li><li><strong>Ephemeral Environments:</strong> When an engineer proposes a change via a pull request, your CI/CD pipeline (e.g., GitHub Actions) should automatically spin up a temporary, isolated clone of your infrastructure, run the pipelines, test the data, and tear it down. If it works, it gets merged into production.</li></ul><h3>The Takeaway</h3><p>Speed and stability are not mutually exclusive in data engineering. By decoupling storage from compute, separating raw data from business logic, and treating pipelines with the same rigorous CI/CD practices as traditional software, you can build a resilient data stack.</p><p>When your architecture is truly modular, your engineering team can move fast, experiment daily, and upgrade infrastructure on the fly — all while your business users enjoy uninterrupted, trusted analytics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f54f47392ced" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/building-unbreakable-data-pipelines-how-to-ship-updates-daily-without-breaking-analytics-f54f47392ced">Building Unbreakable Data Pipelines: How to Ship Updates Daily Without Breaking Analytics</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Flying Blind: A Pragmatic Guide to Production Data Quality]]></title>
            <link>https://medium.com/analytics-vidhya/stop-flying-blind-a-pragmatic-guide-to-production-data-quality-2848f76f2a91?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2848f76f2a91</guid>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[data-governance]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-contract]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 19:59:36 GMT</pubDate>
            <atom:updated>2026-04-14T19:59:36.465Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have spent any time maintaining production data pipelines, you know one absolute truth: <strong>upstream data will eventually break.</strong> A software engineer will rename a column in the application database without telling you. A third-party API will suddenly start returning nulls for a mandatory field. A sensor will glitch and report a temperature of 9,000 degrees.</p><p>In enterprise data engineering, we do not implement Data Quality (DQ) checks because we are perfectionists. We implement them so we do not get paged at 3 AM because a CEO’s dashboard shows negative revenue, or worse, because a machine learning model is making pricing decisions based on corrupted inputs.</p><p>Here is a pragmatic, hype-free guide to implementing data quality checks that actually protect your business, without drowning your team in alert fatigue.</p><h3>1. The Core Dimensions of Data Quality</h3><p>Before writing a single line of test code, you must understand what you are testing for. In the industry, we measure data health across six primary dimensions:</p><ul><li><strong>Completeness:</strong> Are mandatory fields populated? (e.g., <em>No nulls in the </em><em>user_id column.</em>)</li><li><strong>Uniqueness:</strong> Are there duplicate records where there should be singletons? (e.g., <em>One row per </em><em>transaction_id.</em>)</li><li><strong>Validity:</strong> Does the data conform to the expected format and rules? (e.g., <em>Email addresses must contain an ‘@’ symbol.</em>)</li><li><strong>Accuracy:</strong> Does the data reflect reality? (e.g., <em>A customer’s age cannot be 150.</em>)</li><li><strong>Consistency:</strong> Does data match across different systems? (e.g., <em>The total sales in the CRM must match the total sales in the billing system.</em>)</li><li><strong>Timeliness:</strong> Is the data arriving when expected? (e.g., <em>The daily snapshot must be generated by 6:00 AM UTC.</em>)</li></ul><h3>2. Shift-Left: Where to Place Your Checks</h3><p>A common mistake is dumping all data into the data warehouse and then running a massive DQ script at the end of the pipeline. By the time you catch the error, the bad data is already deeply embedded in your architecture.</p><p>Modern data engineering relies on a <strong>“Shift-Left”</strong> methodology — catching errors as close to the source as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b596k_uS_5G9NbIsBQnIXQ.png" /></figure><h3>Stage 1: Ingestion (The Bouncer)</h3><p>At the boundary where data enters your ecosystem (landing zone or raw layer), perform structural checks.</p><ul><li><strong>Schema Enforcement:</strong> Does the incoming payload match the expected schema? If the price column changed from FLOAT to STRING, reject the payload immediately.</li><li><strong>Volume Thresholds:</strong> If you usually receive 10,000 rows a day and today you received 12, something is broken.</li></ul><h3>Stage 2: Transformation (The Inspector)</h3><p>As data moves from raw to refined (Bronze to Silver/Gold in a medallion architecture), perform logical and row-level checks.</p><ul><li><strong>Referential Integrity:</strong> If an order references a customer_id, that customer must exist in the customer table.</li><li><strong>Domain Validations:</strong> ensuring status only contains &#39;PENDING&#39;, &#39;SHIPPED&#39;, or &#39;DELIVERED&#39;.</li></ul><h3>Stage 3: Serving (The Auditor)</h3><p>Before data hits BI dashboards or ML models, perform aggregate and statistical checks.</p><ul><li><strong>Distribution Shifts:</strong> Did the average order value suddenly drop by 40%?</li><li><strong>Freshness:</strong> Has this table been updated in the last 24 hours?</li></ul><h3>3. The Hierarchy of Data Quality Checks</h3><p>When building out your DQ framework, start simple and move to advanced checks only when necessary.</p><h3>Level 1: Static Rules (The Essentials)</h3><p>These are your deterministic, boolean tests. They are cheap to run and catch 80% of pipeline failures.</p><ul><li>NOT NULL checks on primary keys.</li><li>UNIQUE constraints.</li><li>ACCEPTED_VALUES checks.</li><li>Regex matching for strings (UUIDs, Emails, IP addresses).</li></ul><h3>Level 2: Aggregate &amp; Cross-Table Checks</h3><p>These tests ensure logical consistency across your broader data model.</p><ul><li><strong>Row Count Balances:</strong> COUNT(*) in the refined table should equal COUNT(*) in the raw table (minus filtered records).</li><li><strong>Foreign Key Validations:</strong> Left joining a fact table to a dimension table and ensuring no unmatched records fall through.</li></ul><h3>Level 3: Anomaly Detection (Machine Learning DQ)</h3><p>Hardcoded rules fail when data naturally evolves. For example, retail sales spike during Black Friday — a static rule might flag this as an error. Modern platforms (like Monte Carlo or Databricks Data Intelligence Platform) use ML to establish historical baselines and only alert you when metrics deviate from seasonal or historical norms.</p><h3>4. The Circuit Breaker Pattern</h3><p>What happens when a check fails? You have two choices, and picking the right one is critical for pipeline stability.</p><ol><li><strong>Warn (Passive):</strong> The check fails, a log is written, and an alert is sent to a Slack channel, but the pipeline <strong>continues</strong>. Use this for non-critical data (e.g., 2% of utm_campaign tags are missing) so you don&#39;t stall downstream operations for minor hiccups.</li><li><strong>Halt (The Circuit Breaker):</strong> The check fails, and the pipeline <strong>stops</strong>. The bad data is quarantined in a “dead letter queue,” and downstream tables are not updated. Use this for critical financial or compliance data. It is always better for a dashboard to be 2 hours stale than for it to be 100% wrong.</li></ol><h3>5. Avoiding Alert Fatigue: The Real-World Reality</h3><p>The fastest way to destroy a Data Quality initiative is to turn on 5,000 strict rules on day one. Your engineering team will be bombarded with hundreds of Slack alerts every morning. Within a week, they will create a Slack rule to auto-mute the channel.</p><p><strong>How to implement DQ sustainably:</strong></p><ul><li><strong>Prioritize High-Value Assets:</strong> Do not test every table. Identify your Tier-1 tables (financial reporting, core product ML models) and lock them down. Leave the experimental analytics tables alone.</li><li><strong>Tune Your Tolerances:</strong> Instead of expecting 0 nulls, set your expectation to &lt; 1% nulls. Real-world data is messy; give your system breathing room.</li><li><strong>Data Contracts:</strong> Treat data like an API. Work with software engineering to establish <strong>Data Contracts</strong>. If they change a schema without updating the contract, the pipeline rejects their data and <em>they</em> get the alert, not the data team.</li></ul><h3>The Bottom Line</h3><p>Data Quality is not a tool you buy; it is an engineering discipline you adopt. Whether you use dbt tests, Soda, Great Expectations, or native engine features, the goal remains the same. Build defensive pipelines, assume the upstream data is trying to trick you, and establish clear boundaries so you can trust the data you serve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2848f76f2a91" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/stop-flying-blind-a-pragmatic-guide-to-production-data-quality-2848f76f2a91">Stop Flying Blind: A Pragmatic Guide to Production Data Quality</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Engineer’s Guide to Vector Databases: Demystifying the Hype]]></title>
            <link>https://medium.com/analytics-vidhya/the-engineers-guide-to-vector-databases-demystifying-the-hype-ef4db4f75966?source=rss-bb113753b3e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef4db4f75966</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Iftikhar Liaquat]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 10:42:59 GMT</pubDate>
            <atom:updated>2026-04-14T10:42:59.189Z</atom:updated>
            <content:encoded><![CDATA[<p>If you look at the data engineering landscape right now, you would think traditional databases are obsolete. Every week, a new vector database startup raises $50 million, and every tutorial insists you need one to build “AI apps.”</p><p>As someone who has built data pipelines for years, I hate hype. But I will tell you this: <strong>vector databases are not a fad.</strong> They solve a fundamental computing problem that relational databases (like PostgreSQL) and NoSQL document stores (like MongoDB) physically cannot handle at scale.</p><p>Here is the authentic, hype-free guide to what vector databases actually are, how they work under the hood, and when you <em>actually</em> need one.</p><h3>1. The Flaw in Traditional Search (Keywords vs. Meaning)</h3><p>Imagine you have a standard database full of product descriptions. A user searches for &quot;warm winter coat&quot;.</p><p>A traditional database uses lexical (keyword) search. It runs a query like SELECT * FROM products WHERE description LIKE &#39;%warm winter coat%&#39;. If your database describes an item as a &quot;heavy thermal jacket&quot;, it will return zero results. The database does not know that &quot;coat&quot; and &quot;jacket&quot; mean the same thing.</p><p>To solve this in the past, engineers had to build endless synonym lists or complex Elasticsearch rules. Vector databases solve this natively by searching by <strong>meaning</strong>, not by exact spelling. We call this <strong>Semantic Search</strong>.</p><h3>2. What Exactly is a Vector? (The Magic of Embeddings)</h3><p>To search by meaning, we have to teach computers how to understand context. We do this using <strong>Embeddings</strong>.</p><p>An embedding model (like OpenAI’s text-embedding-ada-002 or open-source models like BERT) takes unstructured data—a sentence, a PDF, an image, or an audio clip—and translates it into a fixed-length array of floating-point numbers. This array is a <strong>Vector</strong>.</p><p>Think of a vector as a set of spatial coordinates in a massive, multi-dimensional space.</p><p>If you plot these coordinates, concepts that share semantic meaning are placed close together. The vector for “Apple” (the fruit) will be spatially close to “Banana.” But if the context of the sentence is “Apple” (the company), the model will plot it closer to “Microsoft.”</p><blockquote><strong><em>The Reality Check:</em></strong><em> These vectors are huge. A modern language model represents a single sentence using anywhere from 384 to over 1,500 different dimensions. You are dealing with massive arrays of decimals for every single row of data.</em></blockquote><h3>3. Enter the Vector Database</h3><p>You might be thinking: <em>“Why do I need a special database? Can’t I just save these arrays in a Postgres JSON column?”</em></p><p>You can. But calculating the distance between your search query and a million 1,500-dimensional arrays requires massive computational power. If a standard database tries to compare your query to every single row (known as an exact K-Nearest Neighbors, or KNN search), it will choke and take minutes to return a result.</p><p>A <strong>Vector Database</strong> (like Milvus, Pinecone, Qdrant, or Weaviate) is purpose-built to store, index, and query these massive arrays in milliseconds.</p><p>They achieve this using <strong>Approximate Nearest Neighbor (ANN)</strong> algorithms (such as HNSW or IVF). Instead of comparing your query to every single vector, the database clusters similar vectors together into graphs or trees. When you search, it instantly navigates to the correct “neighborhood” of the vector space and only checks the closest points. You trade a tiny, almost unnoticeable fraction of accuracy for a massive boost in speed.</p><h3>4. How We Query It (The Math)</h3><p>When you query a vector database, you aren’t writing traditional SQL. The workflow looks like this:</p><ol><li><strong>The Prompt:</strong> The user types a query: <em>“warm winter coat”</em>.</li><li><strong>Vectorization:</strong> You pass that text to your embedding model, which turns it into a query vector (an array of numbers).</li><li><strong>The Search:</strong> You send that query vector to the database.</li><li><strong>The Distance Calculation:</strong> The database calculates the mathematical distance between your query vector and the stored vectors. It typically uses <strong>Cosine Similarity</strong> (measuring the angle between vectors to determine directional similarity) or <strong>Euclidean Distance</strong> (measuring the straight-line distance between points).</li><li><strong>The Retrieval:</strong> It returns the top <em>K</em> results (e.g., the 5 closest matches).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jL8ZvN7cGElW_Uk7r-iiw.png" /></figure><h3>5. The Architect’s Reality Check: When Do You Actually Need One?</h3><p>Do not replace your relational database with a vector database. They are complementary tools. You should use a relational database for your application state, and a vector database for your unstructured intelligence.</p><p><strong>Use a Vector Database for:</strong></p><ul><li><strong>Retrieval-Augmented Generation (RAG):</strong> You want to give a Large Language Model (LLM) access to your private company documents. You vectorize the documents, search for the ones relevant to the user’s prompt, and feed them to the LLM so it can generate an accurate answer without hallucinating.</li><li><strong>Recommendation Engines:</strong> Streaming services represent both users and content as vectors. If your “user vector” is physically close to a “movie vector” in the database, it gets recommended to you.</li><li><strong>Unstructured Search:</strong> Searching for a specific image by uploading a similar image, or finding duplicate support tickets based on the description of the problem.</li></ul><p><strong>Do NOT Use a Vector Database for:</strong></p><ul><li><strong>Exact match queries:</strong> Looking up a specific user_id or order_number.</li><li><strong>Analytics and Aggregations:</strong> Performing GROUP BY, SUM, or COUNT operations.</li><li><strong>Financial/Transactional Data:</strong> Systems requiring strict ACID compliance and exact state management.</li></ul><h3>The Bottom Line</h3><p>Vector databases are not magic; they are just highly optimized math engines. By translating human concepts into coordinates and indexing those coordinates for lightning-fast retrieval, they bridge the gap between messy, unstructured data and machine learning. Start small, understand the underlying concept of embeddings, and use them where semantic meaning matters more than an exact match.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef4db4f75966" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/the-engineers-guide-to-vector-databases-demystifying-the-hype-ef4db4f75966">The Engineer’s Guide to Vector Databases: Demystifying the Hype</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>