<?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 Sakshi Agrawal on Medium]]></title>
        <description><![CDATA[Stories by Sakshi Agrawal on Medium]]></description>
        <link>https://medium.com/@agrawal_sakshi?source=rss-c70670729515------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CXebxaf7Aq0bRFRlMOMtJw.jpeg</url>
            <title>Stories by Sakshi Agrawal on Medium</title>
            <link>https://medium.com/@agrawal_sakshi?source=rss-c70670729515------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:05:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@agrawal_sakshi/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[Data Engineering: Noise Cancellation]]></title>
            <link>https://medium.com/@agrawal_sakshi/data-engineering-noise-cancellation-1acbdc763d9f?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/1acbdc763d9f</guid>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[tech-career]]></category>
            <category><![CDATA[job-search]]></category>
            <category><![CDATA[job-hunting]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Sat, 07 Nov 2026 15:47:22 GMT</pubDate>
            <atom:updated>2026-11-07T15:51:30.696Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Open LinkedIn. Search “Data Engineer.” Give it ten minutes.</strong></p><p>If your head starts spinning by minute three, this article is for you.</p><p>Pull up a chair. Let me make you a virtual cup of tea. We are going to talk about this together.</p><h3>The Job Description That Started It All</h3><p>Here is a completely real, completely normal Data Engineer job description you will find today:</p><blockquote>Required: Snowflake, Databricks, AWS, GCP, Azure, Apache Spark, PySpark, Scala, Kafka, Airflow, dbt, Streamlit, Java, JavaScript, Version Control, DevOps, MLOps…</blockquote><p>And then, because 2024 happened:</p><blockquote>…and now, AI. GenAI. Agentic AI. RAG pipelines. LLM orchestration.</blockquote><p><em>It is okay.</em></p><p><em>Take a breath. There, there.🫂</em></p><p>You are not behind. Nobody knows all of this. The person who wrote that job description does not know all of this.</p><p>What you are looking at is not a job requirement. It is a company’s entire data team’s collective CV, collapsed into one bullet list and aimed at a single human being.</p><p>The good news: you do not need all of it. You need to understand something more important first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwIgN0frOcLJ-9qJHh-lXg.png" /></figure><h3>The Doctor Analogy Nobody Told You About</h3><p><em>Think of yourself as a doctor. Your </em><strong><em>data </em></strong><em>is the patient.</em></p><p><em>The patient walks in with a problem that is your business requirement. Understanding what is actually wrong, asking the right questions, and reading the symptoms correctly is the most important skill in the room.</em></p><p><em>Not the scalpel. Not the anesthesia machine. Not the seventeen-piece surgical tray.</em></p><p><em>The operating theatre is your data pipeline.</em></p><p><em>Source data comes in: the patient is prepped.</em></p><p><em>You clean the area: data is cleaned.</em></p><p><em>Surgery happens: transformations are applied.</em></p><p><em>The patient goes to recovery: data lands in a user-facing layer, clean and ready.</em></p><p><em>The tools on that surgical tray? Snowflake, Spark, Kafka, dbt: those are instruments.</em> Important ones. But a surgeon who deeply understands the patient will figure out the instruments. A surgeon who only knows the instruments and does not understand the patient is a much scarier proposition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*-MAxhpVPNs4C7anVOIACBQ.png" /></figure><p>A data engineer who knows Snowflake deeply will pick up Databricks. Someone fluent in Azure will get comfortable on AWS. The underlying concepts- distributed compute, storage layers, transformation patterns, orchestration- transfer.</p><p><strong><em>The syntax is just syntax.</em></strong></p><p>Not knowing every tool on the JD is fine. Everyone needs to understand this.</p><p>HR included.<em> (Hi HR. We say this with love.)</em></p><h3>What Data Engineering Actually Is</h3><p>Here is what the job description does not tell you.</p><p>Data engineering is not keeping your head down and resolving PR conflicts. That is part of it, but a small part.</p><h4><strong><em>You are an architect.</em></strong></h4><p>Someone has to design the end-to-end pipeline before a single line of code is written. What does the source look like? How does it land? Where does it transform? Who consumes it and how? These are not just engineering questions. They are systems thinking questions. The tool comes after the design, not before.</p><h4><strong><em>You are a bridge.</em></strong></h4><p>Half your week is spent translating between what the business wants and what the data actually contains, between what the upstream team built and what the downstream team expects, between what is theoretically possible and what is practically deliverable by Friday.</p><p>That is a human skill. No amount of Spark knowledge replaces it.</p><h4><strong><em>You are a detective.</em></strong></h4><p>When the pipeline breaks at 2 AM and it will break at 2 AM, the question is never “which tool failed.”</p><p>Back to the doctor analogy: when a patient crashes in the OR, nobody blames the scalpel. You go back to the diagnosis. What changed? What did we miss?</p><p>The answer usually lives somewhere in the data itself. A field that changed type. A source system that started sending nulls. A dimension table that quietly grew duplicates.</p><p>The engineer who finds that in twenty minutes is not the one with the longest tools list. It is the one who understood the patient.<em> (I may be watching too much The Good Doctor lately, but the analogy holds.)</em></p><h4><strong>And then there is this:</strong> the best and the worst part of the job.</h4><p>When you understand the patient better than the patient’s family does.</p><p>You have spent weeks with this data. You know where it comes from, what it means, where it breaks, and what the numbers actually say. And then you have to walk into a room and tell a stakeholder politely, clearly, without being condescending, that the numbers they have been reporting for the last two years have a gap in them.</p><p>That is tough.</p><p>That is also data engineering. No tool on any job description prepares you for that conversation.</p><p>Experience does. Empathy does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*ZlcC8SqQbyBSsvkQj1vjBg.png" /></figure><h3>How You Actually Know You Are Getting There</h3><p>Nobody tells you when you level up in data engineering. There is no notification. No badge.</p><p>But looking back, I can point to exactly three moments that told me something had shifted.</p><h4><strong><em>Moment one:</em></strong></h4><p>A client reached out about a transformation I had built two years earlier. They wanted to understand the logic behind a specific field, why it was calculated the way it was, what the edge cases were, and what would break if they changed it.</p><p>I could answer every question without looking at the code.</p><p>Not because I had a great memory. Because I had understood the data well enough when I built it that the logic had made complete sense at the time.</p><p>The tool I used to build it? I barely remembered.</p><p>The thinking behind it? Crystal clear.</p><h4><strong><em>Moment two:</em></strong></h4><p>Saying no to a stakeholder. Not defensively, not apologetically, clearly.</p><p>The request was to make a logical change to a critical downstream attribute, on an ad hoc basis, with almost no UAT time. I explained exactly why that was too risky: what depended on that field, what could break, what the right process looked like.</p><p>The stakeholder pushed back. I held the line.</p><p>That conversation had nothing to do with any tool. It had everything to do with knowing the patient well enough to protect them.</p><h4><strong><em>Moment three:</em></strong></h4><p>Writing a SQL query that answered a question nobody had thought to ask yet, cleanly, in one go, no Stack Overflow, no back and forth.</p><p><em>BC. Before Claude. Before Cortex.</em> When it was just you and the query editor and the data. (<em>AI is helpful. But there was something about that feeling.</em>)</p><blockquote>That moment when the result appears exactly as you expected it is when SQL stops being a tool and starts being a language you actually think in.</blockquote><p>None of those moments were about which tools I knew.</p><p>They were all about how well I understood what I was working with.</p><p>That is what to build toward. Not the longest tools list.</p><h3>The Part About AI</h3><p>Yes, it is everywhere. Yes, every job description has it now.</p><p>No, you do not need to rebuild yourself from scratch.</p><p>Here is what is actually happening: AI systems need clean, reliable, well-modelled data to function. That is data engineering. The fundamentals do not change; they become more important.</p><p>A RAG pipeline with bad source data is just bad data engineering with extra steps.</p><p>Learn the concepts. Understand how LLMs consume data, what a vector store is, and how retrieval works. You do not need to become an ML engineer. You need to understand what the AI layer needs from the data layer, and build that layer well.</p><p>That is still your job.</p><h3>The Point</h3><p>The next time you open a job description and feel like you are looking at an impossible list, read it differently.</p><p>That list is a menu, not a mandate. It tells you what world that team lives in. Your job in an interview is to show that you understand the fundamentals well enough that the tools are learnable.</p><p>Because they are.</p><blockquote>Tools change every two years. The ability to understand a dataset, design a reliable pipeline, communicate clearly with stakeholders, and debug something that broke on the weekend does not go out of style.</blockquote><p>You are not behind. You are building the foundation.</p><p>The instruments come after.</p><p><em>Now finish that cup of tea. You have got this.</em></p><p><em>Claps help this reach more engineers who need to read it. | </em><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #CareerAdvice #DataEngineer #Snowflake #Spark #TechCareers #DataPlatform</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1acbdc763d9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowpark Is Not SQL. Snowpark Is Not PySpark. It’s Time We Talked About That.]]></title>
            <link>https://medium.com/towards-data-engineering/snowpark-is-not-sql-snowpark-is-not-pyspark-its-time-we-talked-about-that-8607973cb108?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/8607973cb108</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[snowpark]]></category>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Thu, 05 Nov 2026 11:17:17 GMT</pubDate>
            <atom:updated>2026-11-05T11:17:17.714Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What actually changes when you move from PySpark or SQL to Snowpark and why it matters.</em></p><p>When I first started working with Snowpark, my instinct was to question whether it was necessary at all. SQL already runs inside Snowflake. PySpark already handles complex transformations at scale. <em>So what exactly is Snowpark bringing to the table?</em></p><p>The answer is not about syntax. It is about the execution environment, and once that distinction clicks, everything else about Snowpark starts to make sense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iNVn0OZfarNQSIT6QmEprw.png" /></figure><h3>First, what exactly is Snowpark?</h3><p><strong><em>Snowpark is Snowflake’s developer framework that allows you to work with data using programming languages such as Python, Java, and Scala.</em></strong></p><p>Instead of writing every transformation as a SQL query, you can use familiar programming APIs to build data processing workflows.</p><p>For example, you can read a table, filter records, join datasets, apply transformations, and write the result back to Snowflake using Python.</p><p>So why use Snowpark when Snowflake already supports SQL?</p><p>SQL is excellent for expressing relational operations. But real-world data engineering often involves more than straightforward queries.</p><p>You might need to:</p><ul><li>Build reusable transformation logic.</li><li>Generate processing logic dynamically from metadata.</li><li>Apply conditional business rules.</li><li>Integrate Python libraries.</li><li>Develop complex workflows and stored procedures.</li></ul><p>You can accomplish many of these things with SQL, too. Snowpark simply gives developers another way to express and organize that logic while keeping supported processing within Snowflake.</p><h3>SQL, PySpark, and Snowpark: What’s the real difference?</h3><p>Let’s start with the most important distinction.</p><blockquote><strong>SQL is a query language. PySpark is an API for Apache Spark. Snowpark is an API for Snowflake.</strong></blockquote><p>They overlap in the operations they support, but their execution environments are different.</p><h3>1. SQL: Tell the database what you want</h3><blockquote><strong><em>SQL is a declarative language. You describe the result you want, and the database engine determines how to execute the query.</em></strong></blockquote><p>For example:</p><pre>SELECT department, AVG(salary)<br>FROM employees<br>GROUP BY department;</pre><p>You don’t tell the database how to distribute the work or which execution steps to perform. The database optimizer handles that.</p><p>SQL is particularly effective for relational operations such as filtering, joining, grouping, and aggregating data.</p><h3>2. PySpark: Work with data through a distributed processing engine</h3><blockquote><strong><em>PySpark is the Python API for Apache Spark.</em></strong></blockquote><p>It allows you to build data transformations using Python while Spark handles distributed execution across a cluster.</p><p>For example:</p><pre>from pyspark.sql.functions import avg<br><br>result = (<br>    df.groupBy(&quot;department&quot;)<br>      .agg(avg(&quot;salary&quot;))<br>)</pre><p>Spark creates an execution plan and distributes the work across available resources when an action triggers execution.</p><p>PySpark is useful when you’re working with large-scale distributed processing, multiple data sources, and the broader Spark ecosystem.</p><h3>3. Snowpark: Use programming APIs to work with Snowflake</h3><blockquote><strong><em>Snowpark provides a DataFrame API for building data transformations that Snowflake can execute in its own environment.</em></strong></blockquote><p>For example:</p><pre>from snowflake.snowpark.functions import avg<br><br>result = (<br>    df.group_by(&quot;department&quot;)<br>      .agg(avg(&quot;salary&quot;))<br>)</pre><p>The syntax looks very similar to PySpark. But the execution engine is different.</p><p><em>Snowpark builds a logical plan of operations. Snowflake’s optimizer determines how to execute that plan, typically using Snowflake’s query execution engine.</em></p><p>You don’t need to manage a Spark cluster or Spark executors to run these transformations.</p><p>That’s the fundamental difference.</p><h3>The architectural difference matters more than the syntax</h3><p>This is where the distinction becomes particularly important.</p><blockquote><strong>SQL:</strong> You submit a query to a database. The database engine parses, optimizes, and executes it. The exact execution architecture depends on the database.</blockquote><blockquote><strong>PySpark:</strong> Your application interacts with the Spark driver, which coordinates work across executors in a distributed Spark cluster. Spark’s execution engine handles the processing.</blockquote><blockquote><strong>Snowpark:</strong> Your Python application builds a DataFrame execution plan. Snowflake optimizes and executes supported operations within its environment, using Snowflake compute resources.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*xHIHX07USEb5-B483ShBew.png" /></figure><p>Snowpark isn’t simply Python code converted into SQL line by line. It builds an execution plan that Snowflake can optimize.</p><h3>The Snowpark mental model: Lazy evaluation</h3><p>One of the most important concepts to understand in Snowpark is lazy evaluation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*cFxMGjB2weEG7FXuH8KKBg.png" /></figure><p>Consider this example:</p><pre>df = session.table(&quot;ORDERS&quot;)<br><br>result = (<br>    df.filter(df[&quot;STATUS&quot;] == &quot;COMPLETED&quot;)<br>      .group_by(&quot;CUSTOMER_ID&quot;)<br>      .agg(sum(&quot;AMOUNT&quot;))<br>)</pre><p>At this point, Snowpark has built a sequence of operations. It hasn’t necessarily executed the query yet.</p><p><strong>An action such as <em>collect</em>(), <em>show</em>(), or <em>count</em>() can trigger execution.</strong></p><pre>result.show()</pre><p>Snowpark can then translate the DataFrame operations into a query plan that Snowflake optimizes and executes.</p><p>This is conceptually similar to PySpark’s lazy DataFrame transformations, but the execution engine is not the same.</p><h3>What about cache_result()?</h3><p>This is another area where PySpark developers need to adjust their mental model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*_kw4mTINh_pPyRu9ZFeEtA.png" /></figure><p>In PySpark, <strong>.<em>cache</em>()</strong> is commonly used to persist data in memory or other configured storage levels across operations.</p><p>Snowpark’s<strong> <em>cache_result</em>()</strong> works differently. It materializes the result into a Snowflake-managed temporary table-backed result, allowing subsequent operations to reuse that materialized data.</p><p>It is not simply an equivalent of Spark’s in-memory cache.</p><p>Materialization can be useful when an intermediate result is expensive to calculate and reused multiple times. But it also has storage and execution costs, so it shouldn’t be used automatically.</p><h3>When should you use SQL, PySpark, or Snowpark?</h3><p>They aren’t mutually exclusive. The right choice depends on your architecture and workload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YENhZPW_DRKoZZ1DEf_pNQ.png" /></figure><p>You can also combine them. Snowpark supports executing SQL through <em>session.sql</em>(), and Spark supports SQL through Spark SQL.</p><p>The goal isn’t to replace one with another. It’s to choose the right tool for the job.</p><h3>A few practical things to remember when working with Snowpark</h3><ol><li><strong>Don’t assume every DataFrame operation executes immediately.</strong> Understand which operations build the plan and which trigger execution.</li><li><strong>Don’t assume longer transformation chains are automatically inefficient.</strong> Snowflake’s optimizer can optimize many operations together.</li><li><strong>Inspect the generated query and execution plan.</strong> Use <em>DataFrame.explain</em>() and <em>DataFrame.queries</em> where appropriate.</li><li><strong>Use Query Profile to investigate performance.</strong> Look at the actual execution rather than judging performance by Python code alone.</li><li><strong>Materialize intermediate results deliberately.</strong> Use <em>cache_result</em>() when reuse justifies the additional cost.</li></ol><h3>The takeaway</h3><p>SQL, PySpark, and Snowpark can all perform the same data operations. The difference is not the syntax, it is where and how the computation runs.</p><blockquote>Snowpark is not a replacement for SQL and it is not a Snowflake port of PySpark. <strong>Snowpark is a programming interface to Snowflake’s execution engine, one that becomes genuinely useful when your pipeline logic outgrows what a query language alone can cleanly express.</strong></blockquote><p>Once you stop treating it as either of those things, the mental model becomes much cleaner.</p><p><em>Found your answer here? A clap helps the next engineer find it too.</em></p><p><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #Snowflake #Snowpark #PySpark #SQL #DataPipelines #CloudDataWarehouse</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8607973cb108" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/snowpark-is-not-sql-snowpark-is-not-pyspark-its-time-we-talked-about-that-8607973cb108">Snowpark Is Not SQL. Snowpark Is Not PySpark. It’s Time We Talked About That.</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Disk Spillage in Snowflake: Why Pipelines Stall and How to Fix Them]]></title>
            <link>https://medium.com/towards-data-engineering/demystifying-disk-spillage-in-snowflake-why-pipelines-stall-and-how-to-fix-them-4bf73c44a5a0?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bf73c44a5a0</guid>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[cloud-architecture]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Sat, 31 Oct 2026 10:12:02 GMT</pubDate>
            <atom:updated>2026-10-31T11:22:56.393Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Why your queries suddenly crawl, how to distinguish local from remote spillage in QUERY_HISTORY, and how to fix memory exhaustion errors before resizing compute.</em></h4><blockquote><strong>SQL compilation error: Compilation memory exhausted</strong></blockquote><p>Every data engineer has encountered this scenario: an automated ETL job that routinely finishes in four minutes suddenly grinds through 45 minutes on the same virtual warehouse. The data volume hasn’t quadrupled, the code hasn’t changed, yet the pipeline is hanging or worse, terminating with a memory exhaustion error.</p><p>When you open Snowflake’s Query Profile to investigate, you don’t see an execution engine bottleneck or queuing delay. Instead, you see two telling metrics:</p><ul><li><strong>Bytes spilled to local storage:</strong> <em>Dozens of gigabytes.</em></li><li><strong>Bytes spilled to remote storage:</strong> <em>Hundreds of gigabytes.</em></li></ul><p>In one of my previous article (<a href="https://medium.com/towards-data-engineering/performance-optimization-a-data-engineers-guide-to-faster-leaner-systems-0a3a2a307c2e"><em>Performance Optimization: A Data Engineer’s Guide to Faster, Leaner Systems</em></a>), I mentioned spillage as a monitoring metric, its outsized impact on runaway compute costs and breached SLAs warrants a dedicated architectural deep dive.</p><p>What is actually happening under the hood when a query spills? Why is remote spilling so punishing to execution times? And most importantly, how do you fix the underlying engineering problem before reaching for the warehouse slider?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMNDVYYPMFFBgccvgNwQxQ.png" /></figure><h3>1. Under the Hood: The Memory Hierarchy of a Snowflake Warehouse</h3><p>To understand spillage, we have to look at the physical compute architecture powering virtual warehouses.</p><p>When you spin up a Snowflake warehouse (from <em>X-Small</em> to <em>4X-Large</em>), you are provisioning a cluster of cloud compute nodes. Each node comes with three distinct memory and storage tiers:</p><pre>┌────────────────────────────────────────────────────────────────────────┐<br>│                        1. In-Memory RAM                                │<br>│          Sub-microsecond latency | Ultra-fast data processing          │<br>└───────────────────────────────────┬────────────────────────────────────┘<br>                                    │ Memory pressure exceeds capacity<br>                                    ▼<br>┌────────────────────────────────────────────────────────────────────────┐<br>│                      2. Local SSD Storage                              │<br>│       Moderate latency | Spilled to the virtual machine&#39;s local disk   │<br>└───────────────────────────────────┬────────────────────────────────────┘<br>                                    │ Local SSD capacity exhausted<br>                                    ▼<br>┌────────────────────────────────────────────────────────────────────────┐<br>│                      3. Remote Cloud Storage (S3 / GCS / Azure Blob)   │<br>│       High network latency | Network I/O penalty &amp; drastic slowdown    │<br>└────────────────────────────────────────────────────────────────────────┘</pre><h4>The Three Tiers of Query Execution</h4><ol><li><strong>In-Memory RAM:</strong> The execution engine reads micro-partitions and processes joins, aggregations, and window functions directly in RAM. As long as working data fits here, queries run at peak speed.</li><li><strong>Local Storage Spilling (Local SSD):</strong> When an operation (such as building an in-memory hash table for a massive join) exceeds available node RAM, the engine writes intermediate data blocks to the node’s local ephemeral SSDs. You will observe a slight dip in performance due to disk I/O, but runtimes generally remain manageable.</li><li><strong>Remote Storage Spilling (Cloud Object Storage):</strong> When the local SSDs on the warehouse nodes fill up completely, Snowflake has only one fallback left to prevent the query from failing: it writes intermediate state out to remote cloud object storage (Amazon S3, Google Cloud Storage, or Azure Blob Storage). Because this requires network round-trips over cloud fabric, execution times degrade dramatically.</li></ol><h3>2. Diagnosing Spillage Proactively with QUERY_HISTORY</h3><p>Relying on manual UI inspection after an alert fires is reactive. A stronger practice is querying <em>SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY</em> to trace memory pressure across your automated production workloads before an incident occurs.</p><p>Here is a ready-to-run query to surface your top spillage offenders over the past 7 days:</p><pre>SELECT <br>    query_id,<br>    user_name,<br>    warehouse_name,<br>    warehouse_size,<br>    ROUND(total_elapsed_time / 1000 / 60, 2) AS runtime_minutes,<br>    ROUND(bytes_spilled_to_local_storage / 1024 / 1024 / 1024, 2) AS spilled_local_gb,<br>    ROUND(bytes_spilled_to_remote_storage / 1024 / 1024 / 1024, 2) AS spilled_remote_gb,<br>    query_text<br>FROM snowflake.account_usage.query_history<br>WHERE start_time &gt;= DATEADD(&#39;day&#39;, -7, CURRENT_TIMESTAMP())<br>  AND (bytes_spilled_to_local_storage &gt; 0 <br>OR bytes_spilled_to_remote_storage &gt; 0)<br>  AND execution_status = &#39;SUCCESS&#39;<br>ORDER BY bytes_spilled_to_remote_storage DESC, <br>bytes_spilled_to_local_storage DESC<br>LIMIT 20;</pre><h4>How to Read the Results</h4><ul><li><strong>High Local, Zero Remote:</strong> The query is bumping up against memory limits, but local SSDs absorbed the surge. It is a candidate for optimization, but not necessarily a burning emergency.</li><li><strong>Non-Zero Remote Spillage:</strong> This is an immediate red flag. The pipeline is paying a heavy network penalty, burning unnecessary credits, and running at risk of out-of-memory or timeout failures.</li></ul><h3>3. The 4 Common Architectural Culprits (And How to Fix Them)</h3><p>When a query spills, the immediate instinct across many teams is: <em>“Let’s resize from a Medium to an X-Large.”</em></p><p>While adding hardware provides more collective RAM, resizing often masks an underlying data design flaw that will reappear once volume expands again. Here are the 4 most common root causes of spillage and how to address them at the code level.</p><h4>Culprit 1: Unintended Row Explosion in Joins</h4><p>By far, the most frequent cause of massive remote spillage is a join condition that produces unintentional duplicates. If a lookup table contains multiple records for what you expected to be a unique key, an M times N record multiplication occurs. The warehouse execution engine must construct an enormous hash table that rapidly exhausts all memory tiers.</p><pre>-- Initial Approach: Joining without verifying granularity<br>SELECT <br>    ord.order_id,<br>    ord.order_date,<br>    cust.customer_segment<br>FROM raw_orders ord<br>JOIN dim_customer_history cust<br>  ON ord.customer_id = cust.customer_id;<br>-- If dim_customer_history has multiple snapshots per customer_id, rows explode.</pre><p><strong>The Upstream Fix: Deduplicate and Filter Before Joining</strong></p><p>Isolate the exact business grain in an upstream CTE or staging view before joining:</p><pre>-- Streamlined Approach: Enforce unique keys prior to hash join<br>WITH current_customers AS (<br>    SELECT <br>        customer_id,<br>        customer_segment<br>    FROM dim_customer_history<br>    QUALIFY ROW_NUMBER() OVER (<br>        PARTITION BY customer_id <br>        ORDER BY effective_date DESC<br>    ) = 1<br>)<br>SELECT <br>    ord.order_id,<br>    ord.order_date,<br>    cust.customer_segment<br>FROM raw_orders ord<br>JOIN current_customers cust<br>  ON ord.customer_id = cust.customer_id;</pre><h4>Culprit 2: Unbounded Window Functions and Sorting</h4><p>Window functions (<em>RANK(), ROW_NUMBER(), SUM() OVER (…)</em>) are powerful, but calculating them requires the execution engine to buffer and sort rows in memory.</p><p>If you write an empty <em>OVER ()</em> clause or partition by a low-cardinality attribute across hundreds of millions of records, a single compute node has to hold all those rows in memory to compute the ordering.</p><pre>-- Initial Approach: Sorting an entire multi-million row table in a single memory buffer<br>SELECT <br>    transaction_id,<br>    transaction_amount,<br>    ROW_NUMBER() OVER (ORDER BY transaction_date DESC) AS global_sequence<br>FROM enterprise_transactions;</pre><p><strong>The Upstream Fix: Narrow Down Partitions and Filter Early</strong></p><ul><li>If you only need top records within a specific domain, partition by a granular key (<em>PARTITION BY account_id, region_code</em>).</li><li>Filter the source dataset upstream so the window calculation only evaluates relevant time windows.</li></ul><h4>Culprit 3: Multiple High-Cardinality COUNT(DISTINCT) Operations</h4><p>Calculating an exact distinct count requires the engine to maintain a hash table of every distinct value encountered. When a single query computes multiple <em>COUNT(DISTINCT)</em> metrics across wide columns on large tables:</p><pre>-- High-Pressure Pattern: Multiple simultaneous distinct hash maps<br>SELECT <br>    store_id,<br>    COUNT(DISTINCT customer_id) AS unique_shoppers,<br>    COUNT(DISTINCT session_id)  AS unique_sessions,<br>    COUNT(DISTINCT credit_card_hash) AS unique_payment_methods<br>FROM retail_events<br>GROUP BY store_id;</pre><p><strong>The Upstream Fix: Approximate Where Appropriate</strong></p><p>For executive dashboards, broad trends, or data exploration, hyper-exact distinct counting is often unnecessary. Snowflake’s native <em>APPROX_COUNT_DISTINCT </em>uses the HyperLogLog algorithm, reducing memory consumption by orders of magnitude with negligible variance:</p><pre>-- Streamlined Pattern: Near-zero memory footprint using HyperLogLog<br>SELECT <br>    store_id,<br>    APPROX_COUNT_DISTINCT(customer_id) AS unique_shoppers,<br>    APPROX_COUNT_DISTINCT(session_id)  AS unique_sessions<br>FROM retail_events<br>GROUP BY store_id;</pre><h4>Culprit 4: Severe Data Skew Across Nodes</h4><p>In a distributed cloud warehouse, Snowflake distributes intermediate calculation tasks across worker nodes. If a join or aggregation key is heavily skewed (for example, customer_id IS NULL or region_code = ‘UNKNOWN’ accounts for 40% of all data), a single worker node receives a disproportionate volume of rows.</p><p>While 7 out of 8 nodes finish their work in seconds, the single node handling the skewed key runs out of RAM, begins spilling to disk, and delays the entire pipeline.</p><p><strong>The Upstream Fix: Null Filtering and Salted Keys</strong></p><ul><li>Filter out placeholder values and NULLs before joining:</li></ul><pre>WHERE customer_id IS NOT NULL AND customer_id != &#39;-1&#39;</pre><ul><li>For skewed business entities that cannot be filtered, separate the processing of high-volume outliers from standard records and combine the results via UNION ALL.</li></ul><h3>4. When Upsizing Is the Right Engineering Decision</h3><p>While code-level and schema-level adjustments should always be the first line of defense, there are valid scenarios where resizing your warehouse is the correct architectural choice.</p><h4>The FinOps Math of Upsizing</h4><p>In Snowflake’s per-second credit model, compute pricing doubles with each size increment, but capacity and memory also scale:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*xEEsVH-G18IFayRRce4csA.png" /></figure><p>If a query on a <strong>Medium</strong> warehouse spills 80 GB to remote storage and runs for <strong>20 minutes</strong>, it consumes:<br><em>4 credits ÷ 60 min × 20 min = 1.33 credits</em></p><p>If running that same query on a <strong>Large</strong> or <strong>X-Large</strong> warehouse provides enough combined RAM to keep the operation entirely in-memory, execution time might drop to <strong>2 minutes</strong>:<br><em>16 credits ÷ 60 min × 2 min = 0.53 credits</em></p><blockquote><strong><em>Key Rule of Thumb:</em></strong><em> If a query has already been tuned for sargability, minimal projection, and clean join grains, but remote spilling persists simply due to large raw volume, </em><strong><em>scaling up compute can actually be cheaper than letting a smaller warehouse spill to remote storage.</em></strong></blockquote><h3>Proactive Prevention Checklist</h3><p>Before marking an optimization complete, run through this five-point diagnostic:</p><ol><li><strong>Verify Join Grain:</strong> Are lookup keys 100% unique before entering hash joins?</li><li><strong>Review Window Partitioning:</strong> Are <em>OVER ()</em> clauses appropriately partitioned, or are they attempting an unbounded global sort?</li><li><strong>Audit Distinct Aggregations:</strong> Can exact distinct counts be replaced with <em>APPROX_COUNT_DISTINCT</em>?</li><li><strong>Inspect for Skew:</strong> Does the <em>Query Profile</em> show all nodes finishing at roughly the same pace, or is one lone worker node lagging?</li><li><strong>Monitor Telemetry:</strong> Is <strong><em>bytes_spilled_to_remote_storage </em></strong>consistently near zero in your weekly <strong><em>QUERY_HISTORY </em></strong>reviews?</li></ol><h3>Solving the Root Cause</h3><p>Disk spillage isn’t an inevitable cost of doing business in cloud data warehouses. It is a direct signal from the execution engine that an operation is outgrowing its memory boundaries.</p><blockquote>By shifting our focus from reactive warehouse sizing to understanding how joins, window functions, and data profiles interact with warehouse memory, we build pipelines that are resilient, predictable, and cost-effective.</blockquote><p><em>👏 Found this useful? A clap helps others find it. | </em><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #Spillage #MemoryExhausation #PerformanceTuning #CostOptimization #DataPipelines</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bf73c44a5a0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/demystifying-disk-spillage-in-snowflake-why-pipelines-stall-and-how-to-fix-them-4bf73c44a5a0">Demystifying Disk Spillage in Snowflake: Why Pipelines Stall and How to Fix Them</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance Optimization: A Data Engineer’s Guide to Faster, Leaner Systems]]></title>
            <link>https://medium.com/towards-data-engineering/performance-optimization-a-data-engineers-guide-to-faster-leaner-systems-0a3a2a307c2e?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a3a2a307c2e</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Sat, 31 Oct 2026 08:59:51 GMT</pubDate>
            <atom:updated>2026-10-31T11:14:57.796Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Because the best time to optimize a pipeline is before you build it.</em></h4><p>Every data engineer knows the quiet satisfaction of watching a complex pipeline finish in record time while cloud compute costs stay well within budget.</p><p>Yet in the daily rush of delivery, performance optimization is often treated as an afterthought, addressed only when a sluggish dashboard or an SLA breach prompts us to scale up a virtual warehouse. While scaling compute is a natural triage move, a deeper truth emerges as datasets grow:</p><blockquote><strong>Scaling compute keeps the lights on today, but thoughtful design creates efficiency that lasts.</strong></blockquote><p>Across my journey architecting and modernizing enterprise data pipelines, I have found that the most impactful optimizations happen long before we ever open a query profiler or adjust a warehouse slider. They happen in the discovery room with business stakeholders, when we profile our source data, choose our data types, structure our joins, and orchestrate our workflows.</p><p>Here is a practical, end-to-end framework for weaving speed and cost-efficiency into every stage of your data engineering lifecycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5XD3Y_UL9VTFq7Qh_yNvA.png" /></figure><h3>Phase 1: The Scoping &amp; Requirements Phase (Zero Lines of Code)</h3><h4>Prune Requirements with Your Stakeholders</h4><p>The fastest, most cost-effective query is the one that processes only what is truly necessary, and the lightest dataset is the one curated with clear business intent.</p><p>Over time, tables naturally accumulate historical fields. It is common to see schemas with 120 attributes where current business intelligence reports and machine learning models only ever reference twelve.</p><ul><li><strong>Collaborative Discovery:</strong> Partner closely with business analysts and product owners. Walk through the reporting goals together: Which metrics actively guide decision-making? Which attributes are legacy fields from older source systems that are no longer referenced?</li><li><strong>Traveling Light:</strong> Ingesting and transforming only the necessary columns across Bronze, Silver, and Gold layers reduces I/O footprint, simplifies downstream transformations, and keeps memory clean across every stage of the pipeline.</li></ul><h3>Phase 2: Schema Design &amp; Data Profiling</h3><h4>Design Schemas for Analytical Exploration</h4><p>Third Normal Form (3NF) is a brilliant design pattern for transactional operational systems that handle row-by-row updates. However, analytical cloud data warehouses (such as Snowflake and BigQuery) thrive on architectures tailored for analytical querying:</p><ul><li><strong>Embrace Dimensional Modeling:</strong> Build clean star and dimensional schemas that mirror how analysts aggregate and drill into data.</li><li><strong>Thoughtful Denormalization:</strong> Pre-joining or denormalizing high-frequency dimensions eliminates repeated, compute-heavy shuffling across billion-row tables during daily business hours.</li></ul><h4>Data Profiling: Precision in Data Types</h4><p>Taking time upfront to understand data profiles yields major performance dividends later on:</p><ul><li><strong>Mindful Datatype Sizing:</strong> While modern columnar cloud warehouses compress text efficiently, choosing appropriate datatype bounds supports query compilation, memory allocation planning, and accurate metadata statistics.</li><li><strong>Harmonize Keys at the DDL Level:</strong> If an identifier is defined as a string in one table and a numeric type in another, queries often rely on explicit or implicit runtime casting (e.g., <em>CAST(table_a.id AS VARCHAR</em>)). This extra step can consume avoidable CPU cycles. Aligning datatypes during table creation ensures seamless, native joins.</li></ul><pre>-- Initial Approach: Runtime casting in join conditions bypasses partition pruning<br>SELECT a.transaction_id, a.amount, b.customer_tier<br>FROM core_transactions a<br>JOIN dim_customer b <br>  ON a.customer_id = CAST(b.legacy_customer_id AS VARCHAR);<br><br>-- Streamlined Approach: Harmonized datatypes at the schema level enable native pruning<br>SELECT a.transaction_id, a.amount, b.customer_tier<br>FROM core_transactions a<br>JOIN dim_customer b <br>  ON a.customer_id = b.customer_id;</pre><h3>Phase 3: Query &amp; Join Logic Engineering</h3><h4>Smart Joining: Early Filtering and Focused Keys</h4><p>When combining large datasets, the guiding goal is simple: narrow down the volume of rows before the join engine performs heavy shuffling.</p><ul><li><strong>Push Filters Upstream:</strong> Whenever possible, filter records inside Common Table Expressions (CTEs) or staging views before joining tables, rather than filtering after a massive dataset has already been merged in memory.</li><li><strong>Transitive Predicates:</strong> Explicitly including shared filter criteria across joined datasets (e.g., ensuring both tables filter on the relevant date partition) helps cloud optimizers scan only the relevant micro-partitions right from storage.</li><li><strong>Multi-Attribute Keys:</strong> When your business domain naturally models records with composite identifiers (such as <em>customer_id </em>and <em>region_code</em>), using both in your join condition narrows the search space and accelerates hash matching.</li></ul><h4>Deduplicate Early: Establish a Clear Single Source of Truth</h4><p>In evolving customer and transaction systems, duplicate or historical events naturally occur; for example, a candidate applying for multiple openings across two years.</p><ul><li><strong>Define Business Truth Together:</strong> Clarify whether downstream analytics require the most recent event, the initial interaction, or a complete history.</li><li><strong>Resolve Early in the Pipeline:</strong> By applying window functions such as <em>QUALIFY ROW_NUMBER() OVER (…) = 1</em> during the staging phase, you ensure clean, unique records are fed into downstream joins, avoiding unintended row expansion and keeping query memory compact.</li></ul><pre>-- Resilient Pattern: Isolate the most recent active record prior to downstream joins<br>WITH latest_applications AS (<br>    SELECT <br>        applicant_id,<br>        application_date,<br>        status,<br>        job_id<br>    FROM raw_applications<br>    QUALIFY ROW_NUMBER() OVER (<br>        PARTITION BY applicant_id <br>        ORDER BY application_date DESC<br>    ) = 1<br>)<br>SELECT <br>    app.applicant_id,<br>    app.status,<br>    pos.title AS position_title<br>FROM latest_applications app<br>JOIN dim_positions pos <br>  ON app.job_id = pos.job_id;</pre><h4>Writing Pruning-Friendly (Sargable) Filters</h4><p>Cloud data platforms rely on metadata min/max statistics to skip micro-partitions that don’t match your query criteria. Writing filter predicates that preserve this built-in capability keeps queries fast and economical:</p><pre>-- Initial Approach: Wrapping partition columns in functions forces a full scan<br>WHERE DATE(transaction_timestamp) = &#39;2024-03-01&#39;<br>WHERE UPPER(customer_email) = &#39;USER@EXAMPLE.COM&#39;<br><br>-- Streamlined Approach: Direct boundary comparisons allow native partition skipping<br>WHERE transaction_timestamp &gt;= &#39;2024-03-01 00:00:00&#39; <br>  AND transaction_timestamp &lt; &#39;2024-03-02 00:00:00&#39;</pre><h3>Phase 4: Pipeline Architecture &amp; Orchestration</h3><h4>Thoughtful Orchestration: Concurrency and Efficiency</h4><p>How your pipelines are scheduled is just as important as how your queries are written:</p><ul><li><strong>Parallel Workstreams:</strong> Structuring DAGs so that unrelated workloads run in parallel reduces overall wall-clock time significantly without changing any query logic.</li><li><strong>Batching Compute:</strong> Grouping related workloads together keeps warehouse compute actively and productively utilized, minimizing start-up pauses and idle cycles.</li></ul><h4>Benefiting from Cloud Caching and Pre-Computation</h4><p>Modern data platforms provide powerful caching tiers that reward intentional query design:</p><ul><li><strong>Query Result Caching:</strong> When source data has not changed, repeating deterministic queries can return results near-instantaneously with minimal credit usage. Keeping queries deterministic (e.g., using snapshot parameters rather than dynamic timestamps where appropriate) unlocks this benefit.</li><li><strong>Materialized Views and Dynamic Tables:</strong> For complex aggregations queried repeatedly throughout the day, precomputing results incrementally ensures business users enjoy sub-second response times without rescanning tables on every refresh.</li></ul><h3>Phase 5: Warehouse Sizing and Clustering: Last and Deliberately</h3><p>Once requirements are dialed in, schemas are aligned, and query logic is streamlined, then it makes sense to think about compute.</p><h4>Warehouse Right-Sizing &amp; Tracing Spillage via QUERY_HISTORY</h4><p>When <strong><em>evaluating compute size and cost-time trade-offs</em></strong>, you don’t have to wait for an <strong><em>Out-Of-Memory (OOM) failure</em></strong> to know a pipeline is strained. By proactively monitoring <em>SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY</em>, you can trace early warning signs like memory spillage:</p><ul><li><strong>Tracing Spillage (BYTES_SPILLED_TO_LOCAL_STORAGE &amp; BYTES_SPILLED_TO_REMOTE_STORAGE):</strong> When a query processes more than fits in warehouse RAM, it spills to disk, slowing execution and signaling potential <em>memory exhaustion</em>. Checking these columns in <em>QUERY_HISTORY </em>helps you catch heavy joins early, apply upstream filter/deduplication fixes, or right-size the warehouse when large volume is genuinely required. <em>Read my detailed article on [</em><a href="https://medium.com/towards-data-engineering/demystifying-disk-spillage-in-snowflake-why-pipelines-stall-and-how-to-fix-them-4bf73c44a5a0"><em>Snowflake Disk Spillage</em></a><em>] for more insights.</em></li><li><strong>Queuing (QUEUED_OVERLOAD_TIME):</strong> If queries are waiting in queue, scaling <em>up</em> (larger size) won’t help; scaling <em>out</em> by enabling multi-cluster warehouses handles concurrency smoothly.</li><li><strong>Auto-Suspend Timing:</strong> Set auto-suspend to 60 seconds for automated, batch ETL warehouses so you are never paying for idle time between batch runs.</li></ul><h4>Clustering: use it intentionally, not reflexively</h4><p>Automatic clustering is powerful for very large tables with consistent, high-frequency query patterns on a specific dimension. But clustering maintenance runs as a background cloud service and carries an ongoing cost. The right approach:</p><ul><li>Reserve clustering keys for tables where query profiles confirm partition scanning is the genuine bottleneck</li><li>Confirm the business query pattern is consistent enough to justify background maintenance cost</li><li>Do not apply it by default, apply it when the data and the query profile point to it clearly</li></ul><h3>The Proactive Engineering Checklist</h3><p>Before reaching for compute sliders or configuring background services, walk through this quick five-point sanity check with your team:</p><pre>       ┌──────────────────────────────────────────────────────────┐<br>       │ 1. Business Scoping: Focus on essential fields &amp; metrics │<br>       ├──────────────────────────────────────────────────────────┤<br>       │ 2. Schema Alignment: Harmonize datatypes &amp; star schemas  │<br>       ├──────────────────────────────────────────────────────────┤<br>       │ 3. Query Logic: Filter pushdown, early deduplication     │<br>       ├──────────────────────────────────────────────────────────┤<br>       │ 4. Orchestration: Parallel DAGs, Caching, Materialization│<br>       ├──────────────────────────────────────────────────────────┤<br>       │ 5. Compute Right-Sizing: Warehouse sizing &amp; Clustering   │<br>       └──────────────────────────────────────────────────────────┘</pre><ol><li><strong>Scoping:</strong> Are we processing the fields and datasets that directly power current business decisions?</li><li><strong>Datatypes:</strong> Are our primary join keys cleanly matched across DDL definitions to prevent runtime casting?</li><li><strong>Filtering &amp; Deduplication:</strong> Have we pushed filter predicates upstream and resolved duplicate records early?</li><li><strong>Orchestration:</strong> Are independent pipeline stages executing concurrently in the DAG?</li><li><strong>Compute Match:</strong> Does our warehouse sizing directly match the workload’s memory and concurrency profile?</li></ol><h3>Designing for Tomorrow, Starting Today</h3><p>Performance optimization is not a phase at the end of a project. It is a way of thinking that starts the moment requirements are gathered and carries through every design decision.</p><blockquote><em>The most durable speed and cost efficiency come from pipelines that were built thoughtfully from the start, not from pipelines that were scaled up after the fact.</em></blockquote><blockquote><em>Start small on your next pipeline: question unused fields, align your join keys early, and filter upstream. The results tend to compound quietly and meaningfully over time.</em></blockquote><p><em>What is your favorite upstream habit for keeping data pipelines fast and cost-effective? I’d love to hear your experiences and lessons learned in the comments!</em></p><p><em>👏 Resonated with this? A clap helps others find it. | </em><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #PerformanceTuning #CostOptimization #</em>CloudEngineering <em>#</em>DataPipelines <em>#DataWarehouse</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a3a2a307c2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/performance-optimization-a-data-engineers-guide-to-faster-leaner-systems-0a3a2a307c2e">Performance Optimization: A Data Engineer’s Guide to Faster, Leaner Systems</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Engineer. Consultant. Translator. Firefighter.]]></title>
            <link>https://medium.com/towards-data-engineering/data-engineer-consultant-translator-firefighter-4f022129b211?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f022129b211</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[client-facing]]></category>
            <category><![CDATA[data-engineer]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[consulting]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Thu, 17 Sep 2026 08:39:04 GMT</pubDate>
            <atom:updated>2026-09-18T13:00:10.443Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Many Roles of a Client-Facing Data Engineer</h3><p><em>Nobody puts this in the job description.</em></p><p>When I started as a Data Engineer, the role felt clear enough.</p><p>Build pipelines. Design schemas. Make data move from A to B reliably.</p><p>What the job description did not mention: explaining the same pipeline to different teams for the 99th time. Debugging a UAT defect at 11pm. Learning that some of the most critical skills you need have nothing to do with SQL.</p><p>Client-facing data engineering is a different discipline. It demands everything a traditional DE role demands, plus several more things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QZz06z_oVhzOGY6HFImSMg.png" /><figcaption>Wearing Every Data Hat</figcaption></figure><h3>The Consultant: Asking “Why?”</h3><p>The hardest part of being a consultant is not the technical complexity.</p><p>It is managing the gap between what you <em>want</em> to say and what you <em>actually</em> say, professionally and calmly.</p><p>Every client-facing engineer develops this over time. You learn to hear something that defies logic and respond with:</p><blockquote>“That’s an interesting approach; let me think through the implications with you.”</blockquote><p>But beyond diplomacy, there is a more substantive challenge.</p><p>Technical decisions in a client-facing role are never purely technical. Take something as simple as applying a ROW_NUMBER() to handle duplicates:</p><pre>ROW_NUMBER() OVER (<br>    PARTITION BY customer_id<br>    ORDER BY record_start_date DESC<br>)</pre><p>Technically straightforward. But the questions surrounding it are anything but:</p><ul><li>Which columns should drive the partition and <strong><em>why</em></strong>?</li><li>Does the latest record always reflect the correct state, or does a status flag take precedence?</li><li>How does this deduplication change the reports three downstream teams are already using?</li><li>Has the business signed off on that impact?</li></ul><p>The technical answer and the client answer are two different conversations.</p><p>Holding both at the same time, staying technically precise while navigating business implications together is what the consultant role actually looks like in practice.</p><h3>The Translator: Living Between Two Languages</h3><p>As the data engineer on a client-facing project, you are often the only person expected to fully understand both sides: <em>the business </em>and <em>the system</em>.</p><p>The stakeholder knows what the data should mean.<br>You know what the pipeline actually does.<br>The gap between those two things is where most of the real work happens.</p><p>A few things that come with this territory:</p><p><strong>Requirements change. Constantly.</strong><br>Sometimes a change makes complete sense once you understand the business context. Sometimes you are the one explaining why one field changing in a source system cascades into twelve downstream tables.</p><p><strong>You sometimes know the client’s data better than they do.</strong><br>Telling someone that a number they have been reporting for months does not mean what they think it means takes clarity, diplomacy, and patience. All at once.</p><p><strong>You explain the same things. Repeatedly.</strong><br>The pipeline. The logic. The impact. With a smile, every time.</p><p>It is also, genuinely, one of the most interesting parts of the job.</p><p>Every engagement is an education in a new domain: healthcare, finance, retail, supply chain. You learn the business from the inside. The frustration and the reward are, more often than not, the same conversation.</p><h3>The Firefighter: The 11pm Debugging Session Nobody Talks About</h3><p>Every client-facing data engineer has a version of this story.</p><p>Here is one of mine.</p><p>We were handling what seemed like a contained change, adding new columns to a few critical tables with significant downstream dependencies. Default values needed to be populated for all historical data.</p><p>The logic was scoped. The code was done. Testing was complete.</p><p>Then, the day before delivery, a request came in to change the default values for historical records in a few of those tables.</p><p>The team accommodated it.</p><p>With the deadline hours away, high-level testing was done, and data was handed to downstream teams for UAT.</p><p>What we had not caught: the change had been applied in the user-facing layer but not propagated back to the source tables.</p><p>One small, last-minute change. Two layers of the pipeline now telling a different story.</p><p>By the time UAT flagged it, the downstream impact had already spread. What followed was a long night, a lot of back-and-forth, and a reminder that in complex pipelines, no change is ever truly small.</p><p>It was not one big mistake.</p><p>It was a series of small pressures: a tight timeline, a late change, compressed testing that compounded into something that took far longer to unravel than anyone wanted.</p><p><strong>What gets you through moments like this:</strong></p><ul><li>Validation checks built in <em>before</em> the pressure starts</li><li>Knowing your pipeline well enough to isolate a failure quickly</li><li>Communicating clearly what you know, what you are investigating, what the timeline looks like without overpromising or catastrophizing</li></ul><blockquote>The firefighter role is unavoidable. The goal is not to never fight fires.</blockquote><p>It is to build systems and habits that make them less frequent, less severe, and faster to resolve.</p><h3>What Nobody Prepares You For</h3><p>The technical onboarding is the easy part.</p><p>What takes years to develop and what nobody puts in the job description:</p><p><strong>Communication under pressure.</strong><br>Not presentation skills. The ability to translate technical reality into language a stakeholder can act on, in real time, when things are going wrong.</p><p><strong>Not taking it personally.</strong><br>Escalations, last-minute changes, UAT defects none of it is personal, even when it feels that way. Staying objective and redirecting energy into solving the problem is a skill worth building deliberately.</p><p><strong>Managing data and people. Simultaneously.</strong><br>The pipeline failing is one problem. The client’s reaction to it is another. Both need attention often at the same time.</p><p><strong>Knowing when to push back.</strong><br>The best consultants are not the ones who say yes to everything. They are the ones who say:</p><blockquote>“Let me make sure we consider the downstream impact before we commit.”</blockquote><p>And make it land as genuine care, not resistance.</p><h3>The Part That Makes It Worth It</h3><p>Client-facing data engineering is harder than it looks.</p><p>The technical challenges are real. The human challenges are real. There are days both arrive at the same time.</p><p>But there is something genuinely rewarding about it: <strong>You see the impact.</strong></p><p>You are on the call when data you built starts answering questions the business did not previously know how to ask. You build relationships where clients come to trust your judgment as a partner, not just a delivery resource.</p><p>And occasionally, you catch something nobody else had.</p><p>A pipeline producing subtly incorrect output. A metric that did not mean what everyone assumed. A data issue that had quietly existed long enough to feel like a feature.</p><p><em>Finding it. Fixing it. Explaining what changed and why.</em></p><p>That is the work at its best.</p><h3>To Anyone Just Starting Out</h3><p>My honest first instinct when someone asks what this role is like?</p><p><strong>Run. Run and don’t look back.</strong></p><p>But what I actually tell them is: nobody walks in fully ready.</p><p>The technical skills matter enormously; they are the foundation. But what defines how far you go is everything else. How you communicate under pressure. How fast you learn not to take things personally. How you handle a client escalation at 11pm while simultaneously debugging the pipeline that caused it.</p><blockquote>The goal is not to have all the answers.</blockquote><blockquote>It is to ask the right questions, stay steady when things get hard, and stay genuinely curious about the data and the business behind it.</blockquote><p>We are all figuring it out as we go.</p><p>That is, more or less, the job, and most days, it is a good one.</p><p><em>👏 Resonated with this? A clap helps others find it. | </em><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #Consulting #CareerAdvice #DataEngineer #TechCareers #ClientFacing</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f022129b211" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/data-engineer-consultant-translator-firefighter-4f022129b211">Data Engineer. Consultant. Translator. Firefighter.</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Validation in Migration Projects: It’s Not Just About Matching Numbers]]></title>
            <link>https://medium.com/towards-data-engineering/data-validation-in-migration-projects-its-not-just-about-matching-numbers-c76f5f8dd9e1?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/c76f5f8dd9e1</guid>
            <category><![CDATA[etl-data-pipeline]]></category>
            <category><![CDATA[cloud-migration]]></category>
            <category><![CDATA[business-rules]]></category>
            <category><![CDATA[data-validation]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Fri, 01 May 2026 05:18:51 GMT</pubDate>
            <atom:updated>2026-05-13T12:53:46.328Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What “Is it expected?” taught me about the real meaning of data correctness.</em></p><p>There is a question I have heard from stakeholders more times than I can count, across multiple migration projects and dozens of UAT cycles.</p><p><strong>“Is it expected?”</strong></p><blockquote>Not “is it correct?” Not “Is it matching?” but “Is it expected?<em>”</em></blockquote><p>That phrasing carries more wisdom than it might initially seem. It acknowledges that data is not a fixed, objective truth sitting in a database somewhere waiting to be copied correctly. It is a reflection of business logic, historical decisions, system quirks, and sometimes behaviours that have been part of the system for so long they feel like features.</p><p>Data validation in a migration project is not a checkbox exercise. It is an investigation. And doing it well is one of the most underrated skills in data engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y--Ca5rwikVXUyzwPuTqig.png" /></figure><h3>What Data Validation Actually Means in a Migration Context</h3><p>When most people think about data validation, they picture row counts and column checks. Apple-to-apple comparisons. Source equals target.</p><p>That is a starting point, not a finish line.</p><p>In a migration, especially one that involves structural or logical changes on the cloud side, the data in the new system is often <em>intentionally</em> different from what was on-prem. Business rules get refined. Deduplication logic gets revisited. Calculations get aligned to the agreed specification. If your validation strategy is purely “does it match the source?”, you will either flag every intentional change as a defect or carry forward assumptions that the migration was specifically designed to move past.</p><p>True validation means understanding what the data <em>should</em> look like, and that requires engagement with the business that goes well beyond SQL.</p><h3>The Validation Layers That Actually Matter</h3><h3>1. Row Counts- The Starting Point, Not the Whole Picture</h3><p>Row counts are the first thing anyone checks, and rightly so, a significant discrepancy is a clear signal. But a matching row count is not a green light; it simply means the investigation can move deeper.</p><pre>SELECT COUNT(*) AS source_count FROM source_db.schema.table;<br>SELECT COUNT(*) AS target_count FROM snowflake_db.schema.table;</pre><p>Total counts can match, while distributions are completely off. Always break counts down by meaningful dimensions:</p><ul><li>By date or date range</li><li>By status or category code</li><li>By region or product type</li></ul><p>Segment-level counts surface discrepancies that total counts will never show.</p><h3>2. Distinct Values and Code Validation</h3><p>For categorical columns, status codes, product codes, and classification flags, validating distinct values is one of the fastest ways to spot issues. A code going missing or an unexpected default value appearing are both worth investigating.</p><pre>-- Codes present in source but missing from target<br>SELECT DISTINCT category_code FROM source_db.schema.table<br>MINUS<br>SELECT DISTINCT category_code FROM snowflake_db.schema.table;</pre><p>A common scenario in migration projects: pipelines joining against a reference or dimension table, a product master, region mapping, or code lookup can produce unexpected results if those tables are not aligned across environments. When a code drops out or falls through to a default, the first places to check are:</p><ul><li>Is the reference table in sync between environments?</li><li>Do the join key data types match on both sides?</li><li>Has any filtering or transformation narrowed the match set?</li></ul><h3>3. Calculation Validation- Where the Real Business Risk Lives</h3><p>Mismatched calculations are the highest-stakes category.</p><p>A pipeline that loads the right rows but computes the wrong aggregates is harder to catch than a pipeline that fails outright and is far more damaging downstream.</p><pre>SELECT product_category,<br>    SUM(transaction_amount) AS total_amount,<br>    COUNT(*) AS record_count<br>FROM snowflake_db.schema.fact_table<br>GROUP BY product_category;</pre><p>Run the equivalent on the source and compare. Calculation mismatches are rarely random, they almost always trace back to one of:</p><ul><li>A join condition behaving differently</li><li>Aggregation scope or grouping differences</li><li>Filter criteria not applied consistently</li><li>NULL handling varying between environments</li></ul><h3>4. Timestamp and Data Type Mismatches</h3><p>Timestamp discrepancies are among the quieter ones. Values look plausible, but something is off.</p><p>Two things to check specifically:</p><p><strong>Timezone handling</strong>: On-prem systems often store timestamps in local time; Snowflake defaults to UTC. A pipeline that does not account for this produces values that are systematically offset, usually by exactly the timezone difference.</p><p><strong>Snowflake timestamp type variants</strong>: Snowflake distinguishes between three types:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n399GR_-DZQ6oYv9zLtpDg.png" /></figure><p>If the target column type differs from what the source implies, the same moment in time can display differently, not wrong, but visually off enough to flag. For example, 2023-06-01 08:00:00 in the source may appear as 2023-06-01 13:00:00+05:30 in Snowflake, depending on column type and session settings.</p><pre>-- Spot-checking timestamp differences<br>SELECT<br>    src.record_id,<br>    src.created_ts AS source_timestamp,<br>    tgt.created_ts AS target_timestamp<br>FROM source_db.schema.table src<br>JOIN snowflake_db.schema.table tgt ON src.record_id = tgt.record_id<br>WHERE src.created_ts != tgt.created_ts<br>LIMIT 50;</pre><p>Beyond timestamps, give a dedicated pass to: numeric precision, string field lengths, and NULL behaviour. These rarely throw errors but quietly matter when data feeds into downstream reporting.</p><h3>5. Duplicate Detection and Knowing Which Record is the Right One</h3><p>Before identifying duplicates, answer a more fundamental question: <strong>what is the grain of this table?</strong></p><p>The grain defines what a single row is supposed to represent: one record per customer, one per transaction. Without agreeing on grain upfront, duplicate detection becomes guesswork. A row that looks like a duplicate at one grain level may be entirely legitimate at another.</p><blockquote><em>In migration projects, the grain of the new Snowflake table may be intentionally different from the source, more granular, less granular, or built around a different key. Confirm this with the business before implementing any deduplication logic.</em></blockquote><p>Once the grain is agreed, Snowflake’s QUALIFY clause makes duplicate detection clean and readable:</p><pre>-- Retaining only the most recent record per key<br>SELECT *<br>FROM snowflake_db.schema.table<br>QUALIFY ROW_NUMBER() OVER (<br>    PARTITION BY record_id<br>    ORDER BY record_start_date DESC<br>) = 1;</pre><p>The nuanced question is always- which record is actually correct? Consider:</p><ul><li>Is the most recent record always the right one, or does an active status flag take precedence?</li><li>Are there legitimate cases where multiple records per key should coexist?</li><li>Does the business define “current” by date, by status, or by some combination?</li></ul><p>These answers do not live in the data. They live with the business.</p><h3>Beyond the Query: Where Validation Becomes a Business Conversation</h3><p>The most valuable validation work rarely happens in a SQL editor. It happens in conversations with business analysts, subject matter experts, and data owners where the data engineer’s role is to bring precise, well-framed observations and ask the right questions.</p><p>This is where “<strong><em>Is it expected?</em></strong>” becomes the most useful tool in the room. For example:</p><ul><li><em>“We are seeing 12% more records for this product category. Is that expected, or should we dig into the join logic?”</em></li><li><em>“The sum of claim amounts is higher in Snowflake by approximately 3%. Is there a business rule that would account for this?”</em></li><li><em>“Around 400 records have a start date of 1900-01-01 in the source. Should those be preserved or treated as a placeholder?”</em></li></ul><p>The answers shape the validation outcome entirely.</p><p>What looks like a defect is often intentional, and what looks like a minor variance can occasionally be something the business genuinely wants investigated. The engineers who navigate these conversations well, curious, precise, genuinely invested in the data, become trusted partners in a migration, not just pipeline builders.</p><h3>Validation When the Cloud Logic Intentionally Differs from the Source</h3><p>In cloud migrations, the target system often reflects refinements to the original logic, structural changes for scalability, calculations aligned to the agreed specification, and deduplication handled more precisely. A strict source-to-target comparison will produce differences by design, and that is expected.</p><p>The validation framework needs to account for this through three practices:</p><ul><li><strong>Document intentional differences before UAT begins, </strong>list every known logic or structural change with its expected impact on the data, so the team has a reference rather than a surprise.</li><li><strong>Validate against the business rule, not the source output, </strong>where logic has changed, compare the new result to the documented expected behaviour, not the old system.</li><li><strong>Be explicit about what “correct” means per column, </strong>some fields should match the source exactly, others should reflect a known transformation. Keeping these two categories clearly separated makes UAT considerably more productive.</li></ul><h3>When the Numbers Look Different and That’s Actually a Good Thing</h3><p>Not every variance is a problem.</p><p><em>In one case, a small variance in totals led us to uncover a legacy filter that had been silently excluding valid records for years.</em></p><p>More records can mean a join condition was previously narrowing results more than intended. Fewer records can mean duplicates are now handled correctly. A different aggregate can mean a calculation is now aligned to the specification rather than a legacy implementation detail.</p><blockquote>If you catch something like this during validation, it is worth acknowledging that this is exactly what the process is meant to surface. Whether it is a data gap that had gone unnoticed or a calculation that the new logic handles more precisely, finding it before it reaches production is the right outcome.</blockquote><p>That is not a defect. That is the migration working as intended.</p><h3>A Practical Validation Checklist for Migration Projects</h3><p>Before signing off on any migrated dataset:</p><p><strong>Volume</strong></p><ul><li>Total row count: source vs target</li><li>Row counts by key dimensions (date, status, category)</li><li>Null counts for critical columns</li></ul><p><strong>Content</strong></p><ul><li>Distinct values for all code and flag columns</li><li>Reference table joins validated codes resolving correctly, no unexpected defaults</li><li>Min/max for date and numeric columns</li><li>Sum and average for key metrics by meaningful groupings</li></ul><p><strong>Structural</strong></p><ul><li>Data types match the agreed schema</li><li>Timestamp type and timezone handling reviewed</li><li>String fields verified for length and precision</li><li>NULL behaviour consistent across environments</li></ul><p><strong>Duplicates</strong></p><ul><li>Grain confirmed with the business</li><li>Duplicates identified by primary or business key</li><li>Record selection rule confirmed with stakeholders</li></ul><p><strong>Calculations</strong></p><ul><li>Aggregations compared at a summary level</li><li>Derived columns validated against the formula</li><li>Edge cases- nulls, zeros, negatives are handled consistently</li></ul><p><strong>Intentional differences</strong></p><ul><li>All known source-to-target differences are listed and signed off</li><li>Stakeholder confirmation captured for expected variances</li></ul><h3><strong>Validation, Done Right</strong></h3><p>Data validation is where technical precision and business understanding reinforce each other.</p><p>The SQL matters. Well-structured queries catch things that manual checks miss. But queries only tell you what is different. Understanding whether it matters, and why, requires business context.</p><p>The teams that do this well treat validation not as a final gate, but as a continuous, collaborative process. They involve subject matter experts early, ask “<strong><em>Is it expected?</em></strong>” before drawing conclusions, and stay genuinely curious about the data.</p><blockquote>Because the data almost always has something to say if you ask the right questions.</blockquote><p><em>👏 Found this useful? A clap goes a long way. | </em><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #DataValidation #Snowflake #CloudMigration #ETL #DataQuality #DataWarehouse</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c76f5f8dd9e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/data-validation-in-migration-projects-its-not-just-about-matching-numbers-c76f5f8dd9e1">Data Validation in Migration Projects: It’s Not Just About Matching Numbers</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PySpark to Snowpark: Real-World Patterns and Differences Before You Migrate]]></title>
            <link>https://medium.com/towards-data-engineering/pyspark-to-snowpark-real-world-patterns-and-differences-before-you-migrate-858a23166b08?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/858a23166b08</guid>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[cloud-migration]]></category>
            <category><![CDATA[snowpark]]></category>
            <category><![CDATA[etl-pipeline]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Fri, 01 May 2026 02:16:23 GMT</pubDate>
            <atom:updated>2026-05-01T04:57:26.219Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Practical lessons from production pipelines so your migration goes smoother than ours.</em></p><p>Migrating production-grade PySpark pipelines to Snowpark is one of the more rewarding investments a data engineering team can make.</p><p>The two frameworks share enough in common that the transition feels approachable and different enough in the details that real production data will surface patterns you didn’t see coming.</p><p>This article is a ground-level account of those patterns and differences gathered from pipelines running at scale.</p><p>The goal is simple: help you recognize them early, so your team can move through the migration with confidence rather than spending cycles rediscovering the same edge cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2RXQpjiXQJvQw4l9eONkg.png" /></figure><blockquote>This is a companion piece to <a href="https://medium.com/towards-data-engineering/pyspark-to-snowpark-lessons-from-a-large-scale-cloud-migration-a13a55f6a330">PySpark to Snowpark: Lessons from a Large-Scale Cloud Migration</a>. If you haven’t read that, it’s a good place to start for the broader context. This one zooms in on the specifics.</blockquote><h3>1. Explicit Typecasting: Snowpark Appreciates Precision</h3><p><strong>What you might see:</strong> Scripts producing unexpected results or type errors during concatenation and comparison operations involving mixed data types.</p><p><strong>What’s happening:</strong></p><p>PySpark handles type coercion implicitly in many situations. When concatenating a string column with a numeric one, for example, it will quietly cast the numeric value to a string for you. Snowpark takes a more deliberate approach; it expects the engineer to be explicit about type conversions.</p><p>This surfaces in two common scenarios.</p><p><strong>Concatenating mixed column types:</strong></p><pre># PySpark- implicit cast happens automatically<br>concat(df.CATEGORY_CODE, lit(&#39;;&#39;), df.AMOUNT_NBR)<br><br># Snowpark- explicit cast is needed before concatenation<br>concat(df.CATEGORY_CODE, lit(&#39;;&#39;), df.AMOUNT_NBR.cast(StringType()))</pre><p><strong>Assigning default values to non-numeric columns:</strong></p><pre># PySpark- the numeric literal is auto-cast to match the column type<br>.when(col(x).isNull(), lit(-3))<br><br># Snowpark- the literal should match the column&#39;s data type<br>.when(trim(col(x)).is_null(), lit(&#39;-3&#39;))</pre><p><strong>What helps:</strong> A pass through every <strong><em>concat</em></strong>, <strong><em>when</em></strong>, and comparison expression to check for mixed types, adding explicit <strong><em>.cast()</em></strong><em> </em>calls wherever needed. It’s methodical work upfront, but it pays off with clearer pipelines.</p><p>One thing worth noting: these mismatches tend to surface quietly rather than with an obvious error. A thorough output validation against the original PySpark results is the most reliable way to catch them early.</p><h3>2. Column Name Handling During Joins: Two Behaviours to Watch For</h3><p><strong>What you might see:</strong> <strong><em>Invalid identifier</em></strong> or<em> </em><strong><em>Ambiguous column</em> </strong>reference errors after joins occasionally appear several transformation steps after the join itself, which can make them tricky to trace.</p><p><strong>What’s happening:</strong></p><p>PySpark handles duplicate column names across joined DataFrames with quiet tolerance.</p><p>Snowpark is more explicit in how it manages this, and the behaviour depends on the join syntax used, which is where things get interesting.</p><p><strong>Scenario A: Explicit condition join with duplicate column names:</strong></p><p>When you join using an equality condition and both DataFrames share a column name, Snowpark may raise an <strong><em>Invalid identifier</em></strong> or<strong><em> Ambiguous column</em></strong> error when that column is referenced downstream.</p><pre># PySpark- works fine even when both frames share RECORD_KEY and SOURCE_CODE<br>df_left.join(df_right,<br>    (df_left.RECORD_KEY == df_right.RECORD_KEY) &amp;<br>    (df_left.SOURCE_CODE == df_right.SOURCE_CODE),<br>    &quot;inner&quot;)<br><br># Snowpark- passing shared keys as a list resolves the ambiguity cleanly<br>df_left.join(df_right, [&quot;RECORD_KEY&quot;, &quot;SOURCE_CODE&quot;], &quot;inner&quot;)</pre><p><strong>Scenario B: Snowpark auto-renames columns, silently:</strong></p><p>This is the subtler one. In certain join scenarios, rather than raising an error, Snowpark will complete the join and quietly <em>rename the duplicate columns</em> using internal naming conventions, producing column names like <strong><em>nm_001_RECORD_KEY</em></strong> and <strong><em>nm_002_RECORD_KEY</em></strong> in your resulting DataFrame.</p><p>The join succeeds. No error is raised. But any downstream transformation that references <strong><em>RECORD_KEY</em></strong> by its original name will either fail or, more dangerously, silently produce incorrect results, because the column it expects no longer exists under that name.</p><pre># What you expect in the schema after join:<br># RECORD_KEY, SOURCE_CODE, STATUS_FLAG, ...<br><br># What Snowpark may actually produce:<br># nm_001_RECORD_KEY, nm_002_RECORD_KEY, SOURCE_CODE, STATUS_FLAG, ...<br><br># A quick schema check after every join helps catch this early<br>print(df_joined.schema)</pre><p><strong>What helps:</strong></p><p>Inspecting<strong><em> .schema</em></strong> immediately after every join is a good habit to build early in the migration. It takes seconds and can save hours of downstream debugging.</p><p>For joins where both frames share column names, passing the join keys as a list is the cleanest approach. Snowpark deduplicates them automatically. For joins where column names differ but downstream references create ambiguity, <strong><em>lsuffix</em></strong> / <strong><em>rsuffix </em></strong>or a pre-join rename tend to work well:</p><pre># Option 1: suffix-based deduplication<br>df_left.join(df_right,<br>    df_left[&quot;RECORD_KEY&quot;] == df_right[&quot;RECORD_KEY&quot;],<br>    lsuffix=&quot;_left&quot;, rsuffix=&quot;_right&quot;)<br><br># Option 2: rename before joining<br>df_right = df_right.rename(col(&quot;RECORD_KEY&quot;), &quot;RIGHT_RECORD_KEY&quot;)</pre><p>The broader principle: treat every join as an opportunity to be intentional about what your output schema looks like, rather than assuming it matches what came in.</p><h3>3. Float to Integer Conversion: A Subtle Difference in Rounding</h3><p><strong>What you might see:</strong> Numeric outputs that are consistently off by a small amount, no errors raised, just values that don’t quite match the PySpark baseline.</p><p><strong>What’s happening:</strong></p><p>When a float value is written into an integer column, PySpark and Snowflake handle the conversion differently:</p><ul><li><strong>PySpark truncates</strong> toward zero: <strong>3.9</strong> becomes <strong>3</strong>, <strong>3.1</strong><em> </em>becomes <strong>3</strong></li><li><strong>Snowflake rounds</strong> using half-away-from-zero: <strong>3.9</strong> becomes <strong>4</strong>, <strong>3.4</strong> becomes <strong>3</strong>, <strong>3.5</strong> becomes <strong>4</strong></li></ul><p>In isolation, this looks minor. In a pipeline where these values flow into downstream aggregations, financial calculations, or reporting figures, it can introduce systematic discrepancies that are genuinely difficult to trace back to their root cause.</p><p><strong>What helps: </strong>Identify columns where a float is being written into an integer target, and apply explicit <strong><em>trunc()</em></strong> in Snowpark to preserve the truncation behaviour from PySpark:</p><pre>from snowflake.snowpark.functions import trunc<br><br>df = df.withColumn(&quot;TARGET_INT_COL&quot;, trunc(col(&quot;SOURCE_FLOAT_COL&quot;)).cast(IntegerType()))</pre><p>Row-level output validation between old and new pipelines is particularly valuable here, since this class of difference is invisible to row count checks.</p><h3>4. Lazy Execution and the Cost of Intermediate Actions</h3><p><strong>What you might see:</strong> Pipelines running slower than expected, or significant latency accumulating in places that feel like they should be lightweight.</p><p><strong>What’s happening:</strong></p><p>Both PySpark and Snowpark use lazy execution transformations, and both are deferred until an action is called. The difference is in what triggers an action and what that action costs.</p><p>In PySpark, habits like calling <strong><em>.count()</em></strong> mid-pipeline for a quick validation or using <strong><em>.show()</em></strong> for debugging add some overhead, but it’s generally manageable.</p><p>In Snowpark, each triggers a separate query execution in Snowflake, including warehouse spin-up time if the warehouse has been suspended.</p><pre># Each line below is a full Snowflake query execution<br>print(df.count())       # Query 1<br>df.show()               # Query 2<br>if df.count() &gt; 0:      # Query 3    </pre><p>Ten intermediate checkpoints in a pipeline means ten separate warehouse queries. The overhead compounds quickly.</p><p><strong>What helps:</strong></p><p>Keeping production pipeline code free of intermediate <strong><em>.count()</em></strong> and <strong><em>.show()</em></strong> calls makes a meaningful difference.</p><p>Snowflake’s <strong>Query Profile</strong> in the UI is a much more powerful debugging tool for understanding what’s happening at the execution level anyway. Letting the transformation DAG build fully and executing once at the end is both a more efficient and more correct pattern in Snowpark.</p><p>This change consistently produced noticeable runtime improvements across the pipelines we migrated.</p><h3>5. Memory Exhaustion: Compilation and Execution</h3><p><strong>What you might see:</strong></p><ul><li><strong><em>SQL compilation error: Compilation memory exhausted</em></strong></li><li><strong><em>SQL execution internal error: Processing aborted</em></strong></li></ul><p><strong>What’s happening:</strong></p><p>These two errors have different root causes and are worth distinguishing.</p><p><strong>Compilation memory exhaustion</strong> occurs when the SQL query generated by Snowpark becomes too complex for Snowflake’s query compiler. This tends to happen in pipelines that chain many transformations together without materialising intermediate results, often scripts that were migrated directly from PySpark without structural changes.</p><p>The SQL Snowpark generated from deeply chained DataFrame operations can be surprisingly lengthy. What reads as five clean lines of Python may compile into a heavily nested SQL statement that pushes past compilation limits.</p><p><strong>Execution memory exhaustion</strong> happens when the data volume being processed exceeds what the assigned warehouse can handle in memory, most commonly on backfill jobs processing a large historical range in one pass.</p><p><strong>What helps:</strong></p><p>For compilation exhaustion, breaking complex pipelines into stages by writing intermediate results to temporary tables tends to be the most effective approach:</p><pre># Rather than one long chain:<br>result = df_a.join(df_b, ...).join(df_c, ...).groupBy(...).agg(...)<br><br># Writing intermediate results keeps the generated SQL manageable:<br>df_ab = df_a.join(df_b, ...)<br>df_ab.write.save_as_table(&quot;TEMP_STAGE_AB&quot;, mode=&quot;overwrite&quot;)<br><br>df_final = session.table(&quot;TEMP_STAGE_AB&quot;).join(df_c, ...).groupBy(...).agg(...)<br>df_final.write.save_as_table(&quot;FINAL_OUTPUT&quot;, mode=&quot;overwrite&quot;)</pre><p>For execution memory exhaustion, scaling the warehouse up for backfill runs and processing data in date or key-range partitions rather than all at once both work well in practice.</p><h3>6. VARIANT and JSON Flattening: A Different but Powerful Model</h3><p><strong>What you might see:</strong> Incorrect or empty results when processing semi-structured or JSON columns after migration.</p><p><strong>What’s happening:</strong></p><p>PySpark handles nested JSON through <strong><em>StructType</em></strong> schema inference. You define the schema, use <strong><em>from_json()</em></strong>, and navigate nested fields with dot notation. Snowflake’s <strong><em>VARIANT </em></strong>type works quite differently, using bracket notation for field traversal and <strong><em>LATERAL FLATTEN</em></strong> for array expansion.</p><p>Migrating JSON-processing logic directly from PySpark to Snowpark, without accounting for this difference, tends to produce results that are either empty or subtly incorrect.</p><p><strong>What helps:</strong></p><p>Snowpark’s bracket notation is clean and readable once you’re comfortable with it, and SQL passthrough with <strong><em>LATERAL FLATTEN </em></strong>handles array expansion elegantly:</p><pre># Navigating a nested VARIANT column in Snowpark<br>df = df.withColumn(<br>    &quot;EXTRACTED_VALUE&quot;,<br>    col(&quot;PAYLOAD_COL&quot;)[&quot;config&quot;][&quot;status_code&quot;].cast(StringType())<br>)<br><br># For array flattening, a SQL passthrough tends to be the clearest approach<br>df = session.sql(&quot;&quot;&quot;<br>    SELECT f.value::STRING AS ITEM_CODE<br>    FROM SOURCE_TABLE,<br>    LATERAL FLATTEN(input =&gt; PAYLOAD_COL:line_items) f<br>&quot;&quot;&quot;)</pre><p>The shift in mental model is the key thing.</p><p>Rather than thinking about JSON as a typed nested struct to be parsed, Snowflake treats it as a VARIANT to be traversed. Once that model clicks, the API feels quite natural.</p><h3>7. One API Difference Worth Keeping in Mind</h3><p><strong>Multiple aggregations in Snowpark are passed as a list:</strong></p><pre># PySpark- same syntax regardless of how many aggregations<br>df.groupBy(&quot;GROUP_COL&quot;).agg(max(&quot;VALUE_COL&quot;))<br><br># Snowpark- multiple aggregations should be wrapped in a list<br>df.groupBy([&quot;GROUP_COL_A&quot;, &quot;GROUP_COL_B&quot;]).agg([<br>    max(df.METRIC_COL_A).alias(&quot;MAX_METRIC_A&quot;),<br>    max(df.METRIC_COL_B).alias(&quot;MAX_METRIC_B&quot;)<br>])</pre><p>When migrating many scripts at once, keeping a short checklist of syntax differences like this makes the review process considerably faster.</p><h3>A Word on cache_result(): A Useful Tool When Applied Thoughtfully</h3><p>One Snowpark feature that’s worth understanding early is <strong><em>cache_result()</em></strong>.</p><p>In <strong>PySpark</strong>, <strong><em>.cache() </em></strong>keeps a DataFrame in memory for reuse. In <strong>Snowpark</strong>, <strong><em>cache_result()</em></strong> takes a different approach; it materializes the DataFrame into a temporary table for the duration of the session. Subsequent operations read from that table instead of re-executing the full transformation.</p><pre># Without cache_result- if this DataFrame is referenced multiple times,<br># the entire transformation chain is re-executed each time<br>df_transformed = df_base.join(...).groupBy(...).agg(...)<br>df_cached = df_transformed.cache_result()</pre><h3>Where it helps</h3><ul><li>When the same DataFrame is reused across multiple downstream operations</li><li>When an expensive transformation feeds into multiple branches</li><li>In complex pipelines, where reducing query depth can ease compilation pressure</li></ul><h3>Where to use it carefully</h3><ul><li>If the DataFrame is used only once, the extra write/read adds unnecessary overhead</li><li>It’s an action execution that happens immediately when called</li></ul><p><strong>Rule of thumb:</strong><br>If a DataFrame is referenced more than once, <strong><em>cache_result()</em></strong> is usually worth it. If it’s part of a single linear flow, staged writes (e.g.,<strong><em> save_as_table</em></strong>) tend to be cleaner.</p><h3>What Stays With You After Migration</h3><p>Across these patterns, a common theme shows up:</p><p>Snowpark encourages engineers to be more deliberate about things PySpark often handles implicitly, such as data types, column naming, execution boundaries, and query structure. That clarity tends to translate into pipelines that are easier to reason about and more reliable in production.</p><blockquote>Migrations like this aren’t just about moving code. They’re a chance to revisit assumptions and simplify where it makes sense.</blockquote><blockquote>In our experience, teams that approach it that way end up with not just a working migration, but a cleaner and more maintainable codebase.</blockquote><p>Keep these patterns in mind early, build validation into your process, and the migration becomes far more predictable with fewer surprises along the way.</p><h3>Quick Reference</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4w5scxmmMDmTxrdsV4ZK_Q.png" /></figure><p><em>👏 Found this useful? Give it a clap, it helps others find it. | </em><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><em>Connect on LinkedIn</em></a></p><p><em>#DataEngineering #Snowflake #Snowpark #PySpark #CloudMigration #ETL #DataPipelines</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=858a23166b08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/pyspark-to-snowpark-real-world-patterns-and-differences-before-you-migrate-858a23166b08">PySpark to Snowpark: Real-World Patterns and Differences Before You Migrate</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Behind Every AI Assistant Is a Data Platform: Why Data Engineering Matters]]></title>
            <link>https://medium.com/towards-data-engineering/behind-every-ai-assistant-is-a-data-platform-why-data-engineering-matters-4269bd9285f4?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/4269bd9285f4</guid>
            <category><![CDATA[ai-assistant]]></category>
            <category><![CDATA[artifical-intellegence]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-platforms]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 05:25:35 GMT</pubDate>
            <atom:updated>2026-03-12T05:25:35.888Z</atom:updated>
            <content:encoded><![CDATA[<p>In one of my recent projects with a large US-based enterprise, I worked on a data platform that supported an AI-driven assistant. The goal was to help business users understand the financial impact of different projects, including both <strong>monetary savings</strong> (direct cost reductions) and <strong>non-monetary benefits</strong> (operational efficiencies and qualitative outcomes).</p><p>These insights were especially important for downstream <strong>proposal and reporting workflows</strong>, where teams needed fast and reliable access to project-level savings data to draft responses and evaluate performance without relying on slow, manual processes.</p><p>To users, this appeared as a chatbot that could answer questions in plain English. Behind the scenes, the system utilized <strong>Snowflake Cortex AI</strong> to translate those questions into SQL, execute them on Snowflake, and return results, all powered by a carefully designed and governed data foundation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GH1OnHtKV1L1S5VbRAiS3A.png" /><figcaption>AI-driven data pipeline process flow</figcaption></figure><h3>Starting with the business problem</h3><p>Before any pipelines or models were built, the focus was on understanding how the business actually measured value.</p><p>What qualifies as savings?<br>Which projects contribute to them?<br>How should those benefits be attributed across different teams, programs, and service categories?</p><p>These definitions mattered because the AI assistant would only be as useful as the data and logic behind it. The goal was not just to store data, but to reflect <strong>how the organization thinks about projects and their impact</strong>.</p><h3>Bringing together fragmented enterprise data</h3><p>The information needed to answer these questions was spread across many systems.</p><p>Some tables captured what projects were raised and approved.<br>Others tracked costs, benefits, and operational attributes.</p><p>Each system held part of the story, but none of them told it end-to-end. The data had to be integrated in a way that preserved business meaning while allowing it to be queried consistently.</p><blockquote>Some attributes in the source data, for example, arrived as comma-separated strings like “A, B, C, D” to represent multiple categories associated with one initiative or patient. We applied <strong>key-based normalization</strong> to split these into multiple rows while preserving the original business key, enabling accurate joins, aggregations, and downstream AI features.</blockquote><h3>Designing a Snowflake-based analytical model</h3><p>To make this data usable for both reporting and AI, we modeled it in Snowflake using a <strong>STAR schema</strong>.</p><p>At the center was a <strong>project-level fact table</strong> capturing savings and benefits. Around it were dimension tables for business unit, program, business function, service category, and savings year-month</p><p>This structure allowed:</p><ul><li>Consistent, repeatable calculations of monetary and non-monetary savings</li><li>Efficient queries for both dashboards and AI systems</li><li>A single source of truth that reflected business-approved definitions</li></ul><p>This design made it possible to analyze projects from multiple angles without complicated queries, and it ensured that both BI tools and AI systems were working from the same definitions.</p><h3>Building layered pipelines and transformations</h3><p>The data flow followed a layered approach:</p><ol><li><strong>Raw tables</strong> brought in data from source systems.</li><li><strong>Staging layers</strong> applied joins, business rules, and transformations.</li><li><strong>Curated fact and dimension tables</strong> were created for analytics and AI.</li></ol><p>Rules for distributing project-level monetary savings and deriving non-monetary benefits were applied in the transformation layer before the data was published into the final model.</p><p>This ensured that all downstream consumers’ dashboards, reports, and the AI assistant were using the <strong>same trusted calculations</strong>.</p><h3>Adding meaning through a semantic layer</h3><p>On top of the physical tables, a <strong>semantic layer</strong> was built to reflect how the business talks about its data.</p><p>Metrics such as:</p><ul><li>Total savings</li><li>Realized savings</li><li>Projected savings</li></ul><p>were defined once and reused everywhere. Whether a user queried a dashboard or asked the AI assistant a question, the answer came from the same business-approved logic.</p><h3>Powering AI with governed data</h3><p>When a user asked a question in plain English, the AI system generated the corresponding SQL, executed it against Snowflake, and returned the result.</p><p><em>Instead of writing queries themselves, business users could simply ask questions such as:</em></p><pre>Show the target savings by business unit for the year 2025<br>Show the top projects by cost savings grouped by region for 2025<br>Show projects related to a specific service category</pre><p>Because the assistant interacted only with curated and governed datasets, the generated queries remained aligned with business definitions and reporting logic.</p><p>What made this work was not just the AI but the <strong>quality of the data platform underneath</strong>. Because the tables were well-modeled, governed, and consistent, the AI could safely retrieve meaningful, accurate results.</p><h3>Ensuring trust, freshness, and governance</h3><p>Since this data was used for financial reporting and proposals, reliability mattered.</p><p>The platform included:</p><ul><li>Validation and reconciliation checks</li><li>Scheduled refreshes to keep data up to date</li><li>Access controls and masking to protect sensitive information</li></ul><p>This allowed business users and the AI assistant to operate on data that was both <strong>current and trustworthy</strong>.</p><h3>One platform, many outcomes</h3><p>The same Snowflake-based foundation now supports:</p><ul><li>Executive and operational dashboards</li><li>Proposal and reporting workflows</li><li>An AI assistant that answers business questions in natural language</li></ul><p>There are no competing datasets and no conflicting numbers, just one consistent, governed view of project performance.</p><h3>What this experience reinforced</h3><blockquote>This project made something very clear to me: modern data engineering is not just about moving data.</blockquote><p>It is about <strong>translating business reality into data structures</strong> that analytics and AI can understand.</p><p>When done well, a data platform becomes the bridge between business questions and intelligent systems, enabling better decisions, better automation, and more confident use of AI across the enterprise.</p><p>As AI adoption grows, the responsibility of data engineers is becoming even clearer, building the trusted data platforms that intelligent systems depend on.</p><p><strong><em>👏 Clap if useful | </em></strong><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><strong><em>Connect on LinkedIn</em></strong></a></p><p><em>#DataEngineering #DataPlatform #Snowflake #ArtificialIntelligence #AIAssistant</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4269bd9285f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/behind-every-ai-assistant-is-a-data-platform-why-data-engineering-matters-4269bd9285f4">Behind Every AI Assistant Is a Data Platform: Why Data Engineering Matters</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Business Questions to Data Pipelines: Designing Systems That Drive Decisions]]></title>
            <link>https://medium.com/towards-data-engineering/from-business-questions-to-data-pipelines-designing-systems-that-drive-decisions-65a21da8d1dc?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/65a21da8d1dc</guid>
            <category><![CDATA[decision-making]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[business-impact-analysis]]></category>
            <category><![CDATA[consulting]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 16:34:46 GMT</pubDate>
            <atom:updated>2026-02-19T05:49:33.771Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Hard Part of Data Engineering Isn’t the Technology</h3><p>When I first started in data, I thought the hardest part was the technology, building pipelines, writing transformations, and fixing failures. Turns out, that’s the easy part. The real challenge is deciding <strong>what the data should represent and whether it actually enables better business decisions.</strong></p><p>Over time, I’ve realized that building data systems is less about tools and more about <strong>problems, people, and decisions.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eaBRUdcoWNO-DbHfcy86lw.png" /><figcaption>Using Data Pipelines to Drive Decision Making</figcaption></figure><h3>1. Solve the Right Problem and Build Pipelines People Can Trust</h3><p>Most business requests aren’t data problems. They sound like:</p><ul><li>“We need better reporting.”</li><li>“Leadership wants more visibility.”</li><li>“We need to understand why numbers are changing.”</li></ul><p>Before writing a line of code, I ask:</p><ul><li>What decision will this data support?</li><li>Who will use it?</li><li>What happens if it’s inaccurate or delayed?</li></ul><blockquote><strong>Data Pipelines Start with Questions, Not Code.</strong></blockquote><blockquote><strong><em>Pipelines aligned with real business questions become powerful tools for faster, more informed decisions.</em></strong></blockquote><p>I think of pipelines as <strong>decision infrastructure</strong>, not just technical infrastructure. Ensuring pipelines are trusted, understandable, and aligned with stakeholder needs is as important as making them reliable and performant.</p><h3>2. Know the Data Before You Build</h3><p>Once the problem is clear, the next step is understanding the data. <strong>Real-world data is messy:</strong> multiple sources, inconsistent definitions, missing fields, and historical changes that no one documented.</p><p>This is where the real “<strong><em>analysis</em></strong>” happens: exploring raw tables, validating assumptions, and identifying edge cases.</p><blockquote>In one of the projects, the region_code column had multiple formats across systems: some sources used full names like <strong>“North America”</strong>, others used abbreviations like <strong>“NA”,</strong> and a few used numeric codes such as <strong>“001”</strong>. Reconciling these differences took a few days, but it ensured that all business reports and performance dashboards were accurate and consistent, giving teams confidence in the decisions they made.</blockquote><h3>3. Model for Decisions, Not Tables</h3><p>Data models are really <strong>business logic in disguise</strong>.</p><ul><li>What does one row represent?</li><li>At what grain are we measuring things?</li><li>Which metrics are meaningful?</li></ul><p>Small design choices like the wrong grain or over-normalization can make analysis slower and harder to interpret.</p><blockquote><strong><em>Models that reflect real business logic reduce confusion, simplify analysis, and support faster, more confident decisions.</em></strong></blockquote><h3>4. Stakeholders Are Part of the System</h3><p>One thing I underestimated early in my career was how much <strong>data systems are social systems.</strong></p><p>Stakeholders bring:</p><ul><li>different definitions</li><li>different priorities</li><li>different expectations</li><li>sometimes conflicting goals</li></ul><p>A big part of the job is alignment:</p><ul><li>aligning on metrics</li><li>aligning on interpretations</li><li>aligning on what “good” looks like</li></ul><blockquote><strong><em>The most effective data solutions come from continuous collaboration and feedback. </em>Conversations often matter as much as code.</strong></blockquote><h3>5. Enhancing Data Systems as Business Needs Grow</h3><p>A core data pipeline is rarely the end goal- it’s the foundation.</p><p>As business needs evolve, new requirements emerge:</p><ul><li>more detailed analysis</li><li>new teams needing access</li><li>automation and advanced applications</li></ul><p>The focus shifts from building to <strong><em>enhancing existing systems</em></strong>. Extending pipelines to support new questions and capabilities.</p><p>The most impactful systems aren’t rebuilt from scratch; they are <strong>strengthened and expanded on a solid core</strong>, increasing adoption and unlocking new use cases.</p><blockquote><strong><em>This is when data systems stop being just operational infrastructure and become true business platforms.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kQxTooa_R6t8EGPg10GcSQ.png" /></figure><h3>Turning Data into Decisions</h3><p>Building data systems isn’t just a technical exercise. It’s about enabling <strong>better business decisions</strong>.</p><p>The most impactful systems I’ve seen balance <strong>clarity, trust, adaptability, and stakeholder alignment</strong>:</p><ul><li>They start by solving the right business problem.</li><li>They make complex data understandable and actionable.</li><li>They evolve gracefully as needs grow, supported by engaged and aligned stakeholders.</li></ul><blockquote><strong>Data pipelines are about driving decisions, not just moving data.</strong></blockquote><p>At the end of the day, the value of a data system isn’t measured in rows processed or pipelines deployed. It’s measured in the<strong> insight, reliability, and effectiveness it gives teams to make decisions</strong>.</p><p><strong>That’s what makes the work meaningful: data that actually drives business decisions.</strong></p><p><strong><em>👏 Clap if useful | </em></strong><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><strong><em>Connect on LinkedIn</em></strong></a></p><p><em>#DataEngineering #DataPipelines #ETL #DataDriven #DecisionMaking #DataAnalytics #BusinessImpact</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65a21da8d1dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/from-business-questions-to-data-pipelines-designing-systems-that-drive-decisions-65a21da8d1dc">From Business Questions to Data Pipelines: Designing Systems That Drive Decisions</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PySpark to Snowpark: Lessons from a Large-Scale Cloud Migration]]></title>
            <link>https://medium.com/towards-data-engineering/pyspark-to-snowpark-lessons-from-a-large-scale-cloud-migration-a13a55f6a330?source=rss-c70670729515------2</link>
            <guid isPermaLink="false">https://medium.com/p/a13a55f6a330</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[cloud-migration]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[snowpark]]></category>
            <category><![CDATA[etl-pipeline]]></category>
            <dc:creator><![CDATA[Sakshi Agrawal]]></dc:creator>
            <pubDate>Tue, 20 Jan 2026 19:20:49 GMT</pubDate>
            <atom:updated>2026-02-19T05:49:35.295Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first heard that we were migrating production-grade PySpark pipelines to <strong>Snowpark</strong>, I assumed it would be a fairly mechanical rewrite. Same transformations, different syntax, how hard could it be?</p><p>I was wrong.</p><p>Over the next few months, I worked as a core developer on one of the <strong>earliest large-scale PySpark-to-Snowpark migration projects</strong> for a US-based healthcare client. We migrated <strong>50+ PySpark jobs</strong>, redesigned parts of the data model, optimized performance, and ultimately reduced execution time by <strong>~60%</strong> while significantly lowering compute costs.</p><p>This article isn’t a Snowpark tutorial. It’s a <strong>practitioner’s perspective</strong> on what <em>actually</em> changes when you move from <em>Spark to Snowpark</em> in a real production environment and what I wish I knew before starting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jjFamZHRVC33IzRIEW2eXg.png" /><figcaption><em>PySpark to Snowpark migration in a cloud data engineering architecture</em></figcaption></figure><h3>Why Move from PySpark to Snowpark?</h3><p>At a high level, the motivation was straightforward:</p><ul><li>Heavy Spark infrastructure maintenance</li><li>Growing Snowflake adoption as the central data platform</li><li>High data movement costs between Spark and Snowflake</li><li>Need for simpler, more cost-efficient pipelines</li></ul><p>Snowpark promised <strong>pushdown computation</strong>, tighter integration with Snowflake and reduced operational overhead. But the real story lies in the details.</p><h3>Lesson 1: Snowpark Is Not “Spark Inside Snowflake”</h3><p>The biggest mental shift was realizing that <strong>Snowpark is not Spark</strong> even though the APIs look familiar.</p><p>In PySpark:</p><ul><li>Transformations are executed on a Spark cluster</li><li>You control partitions, caching and execution behavior</li></ul><p>In Snowpark:</p><ul><li>Your code is translated into SQL and executed <strong>inside Snowflake </strong>(Yes SQL, shocking, I know)</li><li>You don’t manage partitions in the same way</li><li>Performance depends heavily on how Snowflake optimizes the generated SQL</li></ul><p>This meant that blindly converting PySpark code line by line often resulted in <strong>suboptimal performance</strong>.</p><p><strong>What helped:</strong><br>Thinking in terms of <strong>set-based SQL operations</strong>, not distributed Spark execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qf1PcaBalt3bwVG-3XjOrg.png" /><figcaption>PySpark Cluster vs. Snowpark SQL Pushdown</figcaption></figure><h3>Lesson 2: Fewer Actions, Bigger Wins</h3><p>In Spark, calling actions such as <strong><em>.count()</em></strong> or <strong><em>.collect()</em> </strong>is common for debugging or implementing conditional logic. In Snowpark, every action can translate to a <strong>separate query execution</strong>.</p><p>Early in the migration, we saw jobs slowing down because:</p><ul><li>Intermediate actions triggered unnecessary queries</li><li>Debug logging executed expensive operations</li></ul><p><strong>What we changed:</strong></p><ul><li>Reduced intermediate actions</li><li>Deferred execution as much as possible</li><li>Used query plans and Snowflake UI for debugging instead of runtime actions</li></ul><p>This alone led to noticeable performance improvements.</p><h3>Lesson 3: Snowpark + SQL &gt; Snowpark Alone</h3><p>One mistake we made initially was trying to write <em>everything</em> in Snowpark DataFrame code.</p><p>In practice:</p><ul><li>Some transformations are clearer and faster in <strong>plain SQL</strong></li><li>Complex joins and aggregations often perform better when explicitly written as SQL</li><li>Mixing Snowpark and SQL gave us the best balance of readability and performance</li></ul><p>Eventually, our pipelines evolved into:</p><ul><li>Snowpark for orchestration and complex logic</li><li>SQL for heavy transformations and aggregations</li></ul><p>This hybrid approach significantly improved maintainability.</p><h3>Lesson 4: Data Modeling Matters More Than Ever</h3><p>During the migration, we redesigned and validated <strong>1,200+ Snowflake tables and views</strong>, largely using star and dimensional models.</p><p>Unlike Spark-based systems, where compute can mask inefficient design, Snowflake makes poor modeling <strong>very visible in cost and performance</strong>.</p><p>Key takeaways:</p><ul><li>Consistent grain definitions are critical</li><li>Over-normalization hurts query performance</li><li>Naming conventions and data types matter at scale</li><li>Early alignment with downstream consumers saves rework</li></ul><p>Good modeling reduced not just runtime, but also <strong>debugging effort and production issues</strong>.</p><h3>Lesson 5: Cost Optimization Is an Engineering Responsibility</h3><p>One of the most rewarding outcomes of the migration was achieving:</p><ul><li><strong>~60% faster runtimes</strong></li><li><strong>~50% reduction in compute costs</strong></li></ul><p>This didn’t come from one magic optimization. It came from:</p><ul><li>Right-sizing warehouses</li><li>Removing unnecessary reprocessing</li><li>Optimizing joins and filters</li><li>Eliminating redundant pipelines inherited from legacy systems</li></ul><p>Snowflake makes it easy to spend money. It’s the engineer’s job to spend it <strong>intentionally</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ol_fw4W9FOIoKBd8NP9jig.png" /><figcaption>Cost Optimization happens before Execution</figcaption></figure><h3>Lesson 6: Migration Is as Much About People as Code</h3><p>Beyond the technical challenges, the migration required:</p><ul><li>Close collaboration with SMEs who understood legacy systems</li><li>Constant validation with business stakeholders</li><li>Bridging gaps between on-prem assumptions and cloud realities</li></ul><p>Many issues weren’t “Snowpark problems” at all they were <strong>data inconsistencies that existed for years</strong> but surfaced during migration.</p><p>Being patient, communicative, and structured mattered just as much as writing efficient code.</p><h3>Final Thoughts</h3><p>Migrating to Snowpark isn’t a simple lift &amp; shift but a well-designed refactor.</p><blockquote><strong><em>“Migration = rethink, not rewrite”</em></strong></blockquote><p>Here are the key takeaways from my experience:</p><ul><li><em>Don’t treat Snowpark like Spark.</em></li><li><em>Lean into SQL and Snowflake’s strengths.</em></li><li><em>Measure everything performance, cost and reliability.</em></li><li><em>Invest time in data modeling early.</em></li><li><em>Expect the migration to surface hidden data issues.</em></li></ul><p>For me, this project fundamentally changed my perspective on <strong>cloud-native data engineering</strong>. It reinforced that the best solutions are not the most complex ones, but rather those that align <strong>architecture, cost, and business needs</strong>.</p><p>If you’re a data engineer working with Snowflake or considering Snowpark, I hope these lessons save you some time and a few production headaches.</p><p><strong><em>👏 Clap if useful | </em></strong><a href="https://www.linkedin.com/in/agrawal-sakshi-as/"><strong><em>Connect on LinkedIn</em></strong></a></p><p><em>#DataEngineering #Snowflake #Cloud Migration #Snowpark</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a13a55f6a330" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/pyspark-to-snowpark-lessons-from-a-large-scale-cloud-migration-a13a55f6a330">PySpark to Snowpark: Lessons from a Large-Scale Cloud Migration</a> was originally published in <a href="https://medium.com/towards-data-engineering">Towards Data Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>