<?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 René Luijk on Medium]]></title>
        <description><![CDATA[Stories by René Luijk on Medium]]></description>
        <link>https://medium.com/@luijk.r?source=rss-167382922f34------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hRMtMYuLwYau_2cVd5I48Q.png</url>
            <title>Stories by René Luijk on Medium</title>
            <link>https://medium.com/@luijk.r?source=rss-167382922f34------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:00:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@luijk.r/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[A Single Data Quality Score Per Table Using dbt Tests]]></title>
            <link>https://blog.dataengineerthings.org/dbt-tests-dont-say-if-you-can-trust-a-table-caae0744a44c?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/caae0744a44c</guid>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 18:51:20 GMT</pubDate>
            <atom:updated>2026-08-09T06:35:47.938Z</atom:updated>
            <content:encoded><![CDATA[<h4>Turning individual tests into a single data quality score per table using standard dbt tests and dbt elementary</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xhq5rmipy00tNYMoMde_1A.png" /><figcaption>Image by author</figcaption></figure><h3>90% of Your dbt Tests Passed. So What?</h3><p>Suppose you have a dbt project with tests for every table, all built using best practices: uniqueness, NULL checks, relationships between tables, all straight out of the official docs.</p><p>You run dbt test and it comes back mostly green. There’s one table with 20 tests, and two of them fail. Is that bad? Depends.</p><p>What you actually want is <strong>one number that compresses those 20 result</strong>s without losing information on what kind of test failed and for <em>what kind of column</em>, instead of just how many.</p><p>That’s exactly what a pass/fail list can’t tell you: can I trust this table, and is it more or less trustworthy than yesterday?</p><p>That’s the problem this article aims to solve: creating one score per table tracked over time, built from standard dbt tests and using <a href="https://hub.getdbt.com/elementary-data/elementary/latest/">dbt elementary</a>.</p><h3>A First, Naive Approach</h3><p>The obvious first move is to calculate tests_passed / tests_total. It’s a reasonable start, but it misses something: <strong>it doesn’t know which columns actually matter.</strong></p><p>Take two tables, each with 10 tests where each have exactly one failure:</p><ul><li><strong>fct_order</strong> : column customer_id has missing values. This column is used in every downstream join.</li><li><strong>dim_products</strong> : a free-text marketing field fails an accepted_values check. It’s not used anyway.</li></ul><p>Both score 9/10, or 90%, and both numbers implicate the table is mostly fine, even though one of these failures is clearly more impactful than the other. Needless to say, it’s not a score I would trust.</p><h3>Not All Tests Are Created Equal</h3><p>The fix is to not treat every test as equal. A failing not_null on a foreign key isn’t the same as a failing accepted_values on a field nobody even looks at, so they shouldn’t both be treated equally.</p><p><strong>Give each test a weight based on its importance, then compute a weighted pass rate instead of a raw count.</strong></p><p>Coming back to our example: if the customer_id test carries a high weight and the marketing-field test carries a low one, they’ll produce different quality scores. The score for fct_order drops, while the score for dim_products barely moves, if at all. The resulting scores now agree with what you already know about your data and its importance.</p><p>That’s the whole idea in a nutshell.</p><p>Now the question is: what weight to assign to each column, and where does that weight actually live in a dbt project?</p><h3>Tagging Tests With Weights</h3><p>Specify weights in the same place everything else about a test lives: in your yaml files. Add the weight to the meta field under config (see <a href="https://docs.getdbt.com/reference/resource-configs/meta#add-meta-to-generic-and-singular-data-tests">dbt docs</a>). No need to add any new files to your already complex project.</p><pre>models:<br>  - name: fct_order<br>    columns:<br>      - name: customer_id<br>        tests:<br>          - not_null:<br>	      config:<br>                meta:<br>                  weight: 5<br>- name: dim_products<br>    columns:<br>      - name: marketing_notes<br>        tests:<br>          - accepted_values:<br>              values: [&#39;seasonal&#39;, &#39;evergreen&#39;, &#39;clearance&#39;]<br>              config:<br>               meta:<br>                 weight: 1</pre><p><strong>Quick side-note:</strong> dbt already has a severity field set to either warn or error, so doesn’t that already cover this? Not quite. Severity controls whether a failing test breaks your build, weight controls how much a failing test changes the final score. If you want a shortcut, severity could be a reasonable starting default for weight, though it’s limited.</p><p><strong>What weights do you assign to each test?</strong> This obviously is not an exact science, and your choices will be different from mine. I would initially assign weights of 1, 2, or 5, but again this is more of a gut feeling rather than something that’s set in stone. Pick something and fine-tune over time.</p><p>Either way, <strong>use some sort of weighting system.</strong> Anything you haven’t tagged yet you could default to a weight of 1 in the downstream calculation logic, so you can roll this out gradually. Tag your riskiest columns first, leave the rest alone, and the math still works. That’ll fix the problem of the initial, naive approach.</p><h3>From Weights To a Score</h3><p>Let’s work out the example with fct_order and dim_products using the weights from the above model configuration.</p><p>For fct_order we assign a weight of 3 to the failing test (very important), while the remaining nine tests get a weight of 1. Sum of all weights: 3 + 9 = 12.</p><p>For dim_products we assign a weight of 1 to the failing test (not important at all). All other tests also get a weight of 2. Sum of all weights: 1 + 18 = 19.</p><p>Calculating our weighted score <em>WS</em> using individual tests <em>i</em> is straightforward:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*jyfOW-AFIOUR19c9_oFBcw@2x.png" /></figure><p>Some quick calculations gives us the following weighted pass rate.</p><ul><li>fct_order : 9 / 12 = 0.75 (75%)</li><li>dim_products : 18 / 19 = 0.95 (95%)</li></ul><p>As expected, fct_order’s score drops to 75% from 90% previously, while dim_products even slightly improves.</p><p>We’re getting somewhere, but we can do even better.</p><h3>Adjusting a Weighted Score By Test Coverage</h3><p>Intuitively, we know a table with only 2 tests at 100% shouldn’t outscore a table with 20 tests at 95%. But the formula above makes no such distinction.</p><p>A <strong>coverage adjustment</strong> corrects the weighted score based on how many tests are actually performed (<em>test_count</em>) relative to a minimum number of tests that should be performed to be a really good gauge of data quality (<em>target_test_count</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*r1X_ARkHoSl08F2WALOm-w@2x.png" /></figure><p>Set <em>target_test_count</em> to whatever well covered means for your project. I’ve chosen 15 as a reasonable default. With that fixed default, the confidence scores are a function of <em>test_count</em>, and max out at 1 with a <em>test_count</em> of 15.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*nYLcnYN-7SdFuAm59SjjPg.png" /><figcaption>Confidence scores as a function of test count for a fixed target_test_count of 15</figcaption></figure><p>Multiply the weighted score <em>WS</em> by confidence <em>C</em> for a final coverage-adjusted data quality score. Both tables here have 10 tests, so when plugging in 10 for <em>test_count</em> and 15 for <em>target_test_count</em> both get the same confidence discount (≈0.86):</p><p><a href="https://gist.github.com/luijkr/531a7bc9cc324eebfa85d01f33682cf8.js"></a></p><p>Now we see the same 10 <em>column-level</em> test results yielding different <em>table-level</em> data quality scores depending on how we weigh each one.</p><h3>Tracking the Score Over Time With Elementary</h3><p>Any single quality score is a snapshot. Just running it once, you might get lucky, or get a bad score. What you actually want to know is how a table performs over time. That means the score needs history, not just a single dbt test run.</p><p>This is where I found the package <a href="https://hub.getdbt.com/elementary-data/elementary/latest/">dbt elementary</a> to be helpful. Add it to your project and it parses every dbt test invocation and writes results into your warehouse, including the meta field we used to define the weights. Gather the test results, and calculate the quality scores per table.</p><pre>with results as (<br>    select<br>        r.test_unique_id,<br>        r.invocation_id,<br>        r.created_at,<br>        r.status,<br>        t.model_unique_id,<br>        coalesce(t.meta[&#39;weight&#39;]::int, 1) as weight, -- Notice the default of 1 set here!<br>        iff(r.status = &#39;pass&#39;, 1, 0) as pass_int<br>    from elementary.dbt_test_results as r<br>    join elementary.dbt_tests as t<br>      on r.test_unique_id = t.unique_id<br>)<br><br>select<br>    model_unique_id,<br>    invocation_id,<br>    generated_at,<br>    sum(weight * pass_int) / sum(weight) as weighted_score<br>from results<br>group by 1, 2, 3<br>order by model_unique_id, generated_at</pre><p><em>Two things to note.</em> First, the meta[&#39;weight&#39;] and iff() function are Snowflake-specific. Check your own local SQL dialect first before copy-pasting this.</p><p>Secondly, the schema and table names dbt elementary writes the results to might be slightly different for you. In general, it should be something like elementary.dbt_tests or elementary.dbt_test_results.</p><p>Either way, run the above SQL and you get a weighted score per model per dbt test invocation. <strong>This gives you a trend over time,</strong> allowing you to interpret each score better.</p><h3>Ideas To Extend This Even Further</h3><p>If you’ve already gotten this far, here are a few ways to take this further once you’ve implemented the weighted, trended score and it has earned your trust.</p><p><strong>Rolling average.</strong> Instead of just reporting today’s score, define an average pass rate over the last 10 or 30 days. You could even weigh this, too, where recent scores get a higher weight. A table with a high, green score today feels different if it’s been all red the last few days. Today might just be a fluke.</p><p><strong>Flip flop penalty.</strong> A test that flips between high and low scores over time might be even worse than one that fails consistently. High variance over the last 30 runs means a high penalty.</p><p><strong>Blast-radius weighting.</strong> A table with no downstream tables depending on it might be less important. The manifest.json file has the full DAG, so you could count the number of downstream tables to calculate score indicating how much would actually break. Note that within dbt we only know of downstream <em>tables</em>, not dashboards or other data products.</p><p><strong>More tests.</strong> Native dbt tests are limited. If you want to test distributions, ranges, outliers, then <a href="https://hub.getdbt.com/metaplane/dbt_expectations/latest/">dbt-expectations</a> is an excellent place to start.</p><p><strong>Data quality dimensions.</strong> Add a second key like dimension: completeness alongside the weight field to represent data quality dimensions (like <a href="https://www.dataversity.net/articles/data-quality-dimensions/">DAMA</a>). This allows you to get a breakdown by test type instead of just one number. Create <a href="https://en.wikipedia.org/wiki/Radar_chart">radar charts</a> for a cool visual.</p><p>The sky is the limit here. Use your imagination.</p><h3>Where to Start</h3><p>Don’t try to immediately implement this for all of your models. Pick one, or a few, of your riskiest models. Define weights for their columns, and let dbt elementary automatically store the results. Let it run for a while to see if this approach works for you.</p><p>Go beyond this only once the initial approach has proven its worth, and you’re actually looking at these scores first instead of going straight to the individual column-level tests.</p><p><strong>Happy testing!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caae0744a44c" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/dbt-tests-dont-say-if-you-can-trust-a-table-caae0744a44c">A Single Data Quality Score Per Table Using dbt Tests</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dbt Incremental Models vs. Snowflake Dynamic Tables]]></title>
            <link>https://blog.dataengineerthings.org/dbt-incremental-models-vs-snowflake-dynamic-tables-f13eb6062d68?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/f13eb6062d68</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 14:11:44 GMT</pubDate>
            <atom:updated>2026-10-15T11:51:16.092Z</atom:updated>
            <content:encoded><![CDATA[<h4>Catching late-arriving data, data freshness, orchestration, and more</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwdCWsirHPT4KGxJDoMxDA.png" /></figure><p>Consider a high-volume user events pipeline consisting of clickstream data (page views, clicks, scrolls, etc.) joined against a mutable user profile dimension (email address, age, interests). This joined table is materialized incrementally in dbt, refreshed every 20 minutes.</p><p>Sounds like simple stuff, until you’re hit with late-arriving events, in-place dimension updates (<em>e.g.</em>, an updated email address), and hard deletes as a result from upstream <a href="https://gdpr-info.eu/art-17-gdpr/">GDPR Right To Be Forgotten requests</a>.</p><p>In this post I want to lay out how the standard dbt incremental pattern breaks under those conditions, and compare it to a tool built to solve exactly this problem: Snowflake’s <a href="https://docs.snowflake.com/en/user-guide/dynamic-tables/overview">Dynamic Tables</a>.</p><p><strong>By the end, you’ll know:</strong></p><ul><li>Where dbt’s incremental model fails</li><li>What Dynamic Tables are and when they’re useful</li><li>How to best incorporate Dynamic Tables into your dbt project</li><li>Production-grade considerations when using Dynamic Tables and dbt</li></ul><h3>The Scenario: User Profiles Meet Event Tracking</h3><p>Our pipeline consists of two tables:</p><ul><li><strong>stg_events</strong>, containing millions of rows a day of device clickstream data. Events arrive late constantly (see image below): spotty connections cause clients to batch and flush all events on reconnect. That means a session that took place in the morning might not reach the data warehouse until the evening.</li><li><strong>stg_users</strong>, a mutable dimension table. Users change contact information, update account metrics, and trigger GDPR Right to Be Forgotten requests. These requests require hard deletes from the source table.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snzfScV-cb0axbbky3DD4g.png" /><figcaption>Catching late-arriving data requires a lookback window, but might not capture all late events.</figcaption></figure><p>Any pipeline joining these two tables has to get three things right: <strong>1)</strong> late-arriving events, <strong>2)</strong> in-place, retroactive dimension updates, and <strong>3)</strong> upstream deletes (also reflected in past events).</p><h3>Two Approaches to Incremental Models</h3><p>Let’s assume we use our two source tables to create a fact table fct_user_events.</p><h4>Approach 1: dbt’s Standard Incremental Model</h4><p>Here’s the standard incremental model using a lookback window to also cover late-arriving events.</p><pre>{{<br>  config(<br>    materialized=&#39;incremental&#39;,<br>    unique_key=&#39;event_id&#39;,<br>    incremental_strategy=&#39;merge&#39;<br>  )<br>}}<br><br>with raw_events as (<br>    select * from {{ ref(&#39;stg_events&#39;) }}<br><br>    -- Problem 1: The arbitrary lookback window<br>    {% if is_incremental() %}<br>     where event_timestamp &gt;= (<br>      select max(event_timestamp) from {{ this }}<br>     ) - interval &#39;3 days&#39;<br>    {% endif %}<br>),<br><br>user_profiles as (<br>    select * from {{ ref(&#39;stg_users&#39;) }}<br><br>    {% if is_incremental() %}<br>    -- Problem 2: Reading historical events to catch retroactive dimension updates<br>    where updated_at &gt;= (select max(event_timestamp) from {{ this }}) - interval &#39;3 days&#39;<br>    {% endif %}<br>)<br><br>select<br>    e.event_id,<br>    e.user_id,<br>    u.user_email,<br>    e.event_name,<br>    e.event_timestamp<br>from raw_events as e<br>left join user_profilesas as u<br> on e.user_id = u.user_id<br><br>-- Problem 3: Upstream DELETES are completely ignored.<br>-- Fixing this requires sepaarate, complex post-hook scripts.</pre><p>Three things are wrong with this code, none of which are edge cases. That means they will occur in your pipeline, too.</p><p><strong>Problem 1:</strong> The lookback window is arbitrary.</p><p>Using interval ‘3 days’ is picked based on a notion of how late data <em>usually</em> arrives, and not on how late data actually <em>can and will</em> arrive. Pick a small enough interval and late events are missed without errors or test failure. Expand the lookback window and every run re-scans days worth of data every 20 minutes. Have fun looking at your credit consumption exploding.</p><p><strong>Problem 2:</strong> The dimension-refresh window is a second guess stacked on the first.</p><p>The stg_users table gets filtered based on updated_at, but only a few days before the max(event_timestamp) from the <em>target</em> table. An email address update will not be reflected in old events, just newer ones.</p><p><strong>Problem 3:</strong> Deleteing GDPR compliancy.</p><p>In dbt, a merge statement inserts and updates, it does not delete. When a GDPR request hard-deletes a row from stg_users, old events in fct_user_events never find out. Old rows keep the stale user_email, or keep a join to a user_id that legally shouldn’t exist anymore. There’s no clean SQL fix inside the incremental model itself. That’s your compliancy out the window, and you need more separate code and logic to fix it.</p><h4>Approach 2: Snowflake’s Dynamic Tables</h4><p>Now contrast the above dbt implementation with the below one using a Dynamic Table.</p><pre>{{<br>  config(<br>    materialized=&#39;dynamic_table&#39;,<br>    target_lag=&#39;20 minutes&#39;, -- Optional, see details below<br>    snowflake_warehouse=&#39;transform_wh&#39;<br>  )<br>}}<br><br>select<br>    e.event_id,<br>    e.user_id,<br>    u.user_email,<br>    e.event_name,<br>    e.event_timestamp<br>from {{ ref(&#39;stg_events&#39;) }} as e<br>left join {{ ref(&#39;stg_users&#39;) }} as u<br> on e.user_id = u.user_id</pre><p>That’s the entire model. No is_incremental() macro, no unique_key, no lookback logic, no merge strategy.</p><p><em>Late-arriving events, in-place updates, and hard deletes on the source tables are all handled natively.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q-RfxpWEBsQSyh-Cvb9NIg.png" /><figcaption>Regardless of how late an event arrives, Snowflake’s Dynamic Table will catch it.</figcaption></figure><p>Snowflake does the heavy lifting: it tracks the change stream on both source tables and incrementally maintains the output to stay within target_lag, deletes included. And also retroactively.</p><p>Every pain point in dbt’s default incremental model is a manual compensation for something Snowflake now does for you. Unfortunately, there’s no free lunch.</p><p>But first let’s go over how it actually works before getting into the trade-offs.</p><h3>Snowflake Dynamic Tables 101</h3><h4>Imperative vs. Declarative</h4><p>In programming, there’s a distinction between imperative programming and declarative programming. <strong>Imperative</strong> means you define <em>how</em> something gets done. <strong>Declarative</strong> means you specify <em>what the end result</em> should be.</p><p>A dbt incremental model is <strong>imperative</strong>: you tell the warehouse <em>how</em> to move data. Which rows to select, how to merge them, when the merge runs. You own it all.</p><p>A Dynamic Table is <strong>declarative</strong>: you tell Snowflake <em>what the final table should look like</em>, and it works backward to keep it correct and current. That’s what the query engine solves for you.</p><h4>Keeping Track of Changes</h4><p>Anyone familiar with Snowflake’s native tables (or Iceberg, Delta), is probably familiar with their <a href="https://docs.snowflake.com/en/user-guide/data-time-travel">time travel</a> features. This feature keeps track of any changes made to a table since its previous version.</p><p>Dynamic Tables do the same thing. This is what Snowflake uses to identify the latest records in the source table, and saves you from having to deal with event timestamps and the the dbt’s verbose incremental logic.</p><h4>target_lag Is a Freshness Objective, Not a Cron Schedule</h4><p>The configuration target_lag = &#39;20 minutes&#39; <strong>does not mean</strong> the refresh runs every 20 minutes. Instead, it means the data should never be more than 20 minutes old relative to its sources.</p><p><em>Snowflake decides</em> the actual refresh cadence, based on how fast upstream tables are changing, how expensive the transformation is, etc. Lower frequency upstream changes means fewer refreshes, frequent upstream changes means more refreshes.</p><h4>Side Note: Dynamic Tables ≠ Materialized Views</h4><p>At first glance, Dynamic Tables look similar to Materialized Views. There are a few key differences though. Materialized Views are deliberately constrained in a way Dynamic Tables aren’t: single source table, no joins, limited aggregate support. Materialized Views are built for simple projections over one table.</p><p><em>Dynamic Tables have no such restrictions.</em> You can use multi-table joins, CTEs, window functions, complex aggregations, as long as it can be expressed in a select statement.</p><p>Now that we’ve had this crash course on Dynamic Tables, <em>let’s get into some of the details</em>.</p><h3>Orchestration: Who Controls the Data Refresh?</h3><p>Normally, dbt executes statements that either create tables or updates them with new data (<em>i.e.</em>, inserts, updates). For Dynamic Tables, the only command that’s ever run is a simple create or alter dynamic table statement, which doesn’t actually move any data. The real refresh happens asynchronously, on Snowflake’s schedule, based on the target_lag parameter. Here’s where things get interesting.</p><p><strong>The </strong><strong>target_lag parameter is optional.</strong></p><p>If you don’t set it, Snowflake will not update the table for you. The downside is that <em>you</em> have to update it. The advantage of that is you control <em>exactly when</em> that happens. But since dbt only creates a Dynamic Table, it does require a small workaround. Just add a post-hook to your model that will trigger a refresh.</p><pre>{{<br>  config(<br>    materialized=&#39;dynamic_table&#39;,<br>    snowflake_warehouse=&#39;transform_wh&#39;,<br>    post_hook=&quot;ALTER DYNAMIC TABLE {{ this }} REFRESH&quot;<br>  )<br>}}</pre><p>Now you get the best of both worlds: the ease of use from declarative SQL, while still maintaining full control over when the data is refreshed. Win-win.</p><h3>Testing in a Declarative, Asynchronous World</h3><p>You can still run dbt test. Dynamic Tables are real, queryable objects, so your not_null, unique, and relationships tests all run.</p><p>However, for testing purposes, refreshing your table before running tests is a must. Otherwise a table might not have refreshed yet, causing you to test against an empty table or a table with stale data.</p><p><strong>That means that the tests would pass or fail based on timing, not correctness.</strong></p><p>To force a refresh before running your tests, use the above post-hook, or as an explicit orchestrator step between dbt run and dbt test.</p><p>Treat this as a hard rule for any CI/CD pipeline that deploys and immediately validates Dynamic Tables. The async gap isn’t an edge case, it’s the default behavior.</p><h3>Cost Tracking</h3><h4>Aggressive Lag Keeps Warehouses Hot</h4><p>A target_lag of 1 minute keeps the warehouse effectively always-on, continuously evaluating whether upstream changes warrant a refresh. That burns <strong>compute credits</strong> (more active time) and <strong>Cloud Services credits</strong> (more DAG evaluation cycles), a cost that’s easy to miss until it’s already large.</p><p><strong>Pick a target lag to match the actual SLA.</strong></p><p>A dashboard that’s refreshed hourly doesn’t need minute-level data freshness.</p><h4>Run Dynamic Tables on Dedicated Warehouses</h4><p>Don’t let Dynamic Table refreshes share a warehouse with other warehouses. A dedicated, named warehouse (<em>e.g.,</em> dynamic_table_wh) gives clean cost attribution and workload isolation.</p><h4>Cost Audit</h4><p>Be aware of disproportionately high Cloud Service costs relative to regular compute costs. A spike in the former might signal that your target_lag is too aggressive, and that the actual frequency with which your source tables update doesn’t warrant that short lag.</p><p>Check costs using the below query first, before thinking this is a warehouse size problem.</p><pre>SELECT<br>    warehouse_name,<br>    ROUND(SUM(credits_used), 2) AS total_credits,<br>    ROUND(SUM(credits_used_compute), 2) AS compute_credits,<br>    ROUND(SUM(credits_used_cloud_services), 2) AS cloud_services_credits<br>FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY<br>WHERE start_time &gt;= DATEADD(&#39;day&#39;, -7, CURRENT_TIMESTAMP())<br>GROUP BY warehouse_name<br>ORDER BY total_credits DESC;</pre><h3>Pipeline Failures, Resiliency &amp; Alerting</h3><h4>The 5-Strike Rule</h4><p>If a Dynamic Table fails its refresh five consecutive times, Snowflake automatically transitions it to SUSPENDED_DUE_TO_ERRORS. This safety valve stops a broken transformation from burning credits indefinitely. It’s a sensible default, but it also means a failure can go from just one (or five) bad refresh to a table seizing to update entirely. If you’re not looking for such errors, this will go unnoticed.</p><h4>The Cascading Freeze</h4><p>It’s possible to chain Dynamic Tables. If an upstream table gets suspended, every downstream table depending on it stops refreshing too. Not because they failed individually, but because their input never updated.</p><p><strong>A single failing Dynamic Table can leave an entire chain of tables suspended or stale.</strong></p><p>Fixing the root cause doesn’t automatically resume anything:</p><pre>ALTER DYNAMIC TABLE fct_user_events_dynamic RESUME;</pre><p>A chain of five suspended tables means five manual RESUME statements. In the right order, of course.</p><h4>Failure &amp; Suspension</h4><p>Looking for suspended tables is straightforward, but what do you do with the result?</p><pre>SELECT<br> name,<br> scheduling_state:state::STRING AS state,<br> scheduling_state:reason_code::STRING AS reason_code,<br> scheduling_state:reason_message::STRING AS reason_message<br>FROM TABLE(INFORMATION_SCHEMA.DYNAMIC_TABLE_GRAPH_HISTORY())<br>WHERE state = &#39;SUSPENDED&#39;<br>ORDER BY valid_from DESC;</pre><p>One option is to <strong>turn this query into a scheduled task</strong> with a threshold alert. The columns reason_code and reason_message tell you <em>why</em> a table suspended, without having to dig through the query history.</p><h3>When To Pick Which Option</h3><p>My point here isn’t to pick a winner either way. Both have their use cases.</p><h4>Where dbt Incremental Models Still Win</h4><ul><li><strong>Vendor portability.</strong> Dynamic Tables are Snowflake-native. Multi-warehouse pipelines, or anyone who wants the option to migrate away from Snowflake is best to stay away. Unless you want to rewrite your code, it might be better to stick to standard incremental models.</li><li><strong>Explicit, simple execution control.</strong> Incremental models run exactly when you call dbt run. The power of Dynamic Tables is to hand scheduling to Snowflake&#39;s engine, but makes it difficult to sync a refresh with an external event. Alternatively, you could <strong>leave out the </strong><strong>target_lag configuration and instead use a post-hook</strong> to let dbt run alter dynamic table ... refresh;.</li><li><strong>Non-deterministic functions and custom logic.</strong> Dynamic Tables require a single query defining a state. Python UDFs, external function calls, procedural branching are not supported. Obviously dbt does.</li></ul><h4>Where Dynamic Tables Win</h4><ul><li><strong>Native change tracking.</strong> Updates to stg_users propagate downstream without any window logic.</li><li><strong>Processing deletes.</strong> Hard deletes on a source table are reflected downstream automatically. No extra code or logic needed.</li><li><strong>No lookback window.</strong> No interval to get wrong, no window to tune. Any and all changes are always caught.</li></ul><p><strong>The tradeoff in a single sentence:</strong> Incremental models trade more code for more control and portability, whereas Dynamic Tables trade Snowflake lock-in and potential lack of execution control for no manual failures.</p><h3>Avoid Dogmatism, Pick a Hybrid Approach</h3><p>I’m not gonna tell you to migrate everything from dbt incremental to Dynamic Tables, or leave everything as is. My recommendation would be to mix and match.</p><ul><li><strong>Dynamic Tables for staging and intermediate transformation.</strong> This is high-volume, mutation-heavy join work, where native delete handling and mutation tracking do the most work and the single select constraint isn&#39;t a limitation.</li><li><strong>dbt incremental models for the final presentation layer.</strong> These are your heavily aggregated marts, anything needing non-deterministic functions or custom logic, or when execution timing is tied to downstream SLAs. Or just use the post-hook described earlier for more execution control.</li></ul><h3>The Ultimate Decision Guide</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a55438f1bb0e6bc1bad56a11546b04a/href">https://medium.com/media/7a55438f1bb0e6bc1bad56a11546b04a/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f13eb6062d68" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/dbt-incremental-models-vs-snowflake-dynamic-tables-f13eb6062d68">dbt Incremental Models vs. Snowflake Dynamic Tables</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dbt Materializations: What Actually Happens to Your Data]]></title>
            <link>https://blog.dataengineerthings.org/dbt-materializations-what-actually-happens-to-your-data-a71082625c29?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/a71082625c29</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Mon, 29 Jun 2026 13:55:33 GMT</pubDate>
            <atom:updated>2026-06-29T13:55:33.273Z</atom:updated>
            <content:encoded><![CDATA[<h4>The visualization I wish I got when starting out with dbt</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*qbrFgqNgpnRqkJt3HY_x4Q.png" /><figcaption>Overview of the most common materializations (image by author)</figcaption></figure><p>In dbt, SQL defines <em>what the data looks like</em>, but the type of materialization decides <em>how it physically moves</em> into your data warehouse.</p><p>The same model, same logic might have a completely different cost and performance profile depending on one config line.</p><p><em>But how to pick the right materializations?</em></p><p>It can be confusing, but once you start thinking about materializations as <em>“where does this data physically sit, and when does the compute run to put it there,”</em> the choice stops being a guessing game.</p><p>This is the overview of dbt materializations I wish I had before starting out with dbt. Hopefully it’ll save you from making the same mistakes as I have.</p><h3>View: Zero Storage, Compute on Every Query</h3><p>A view is a saved query, not a copy of data. dbt run doesn’t move a single row, it just deploys (or replaces) the SQL definition in the database. Nothing gets computed until someone or something queries it, and which point your data warehouse runs the full underlying logic, every time the view is called.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pBnprnBagUOsRFC0c-nRYA.png" /><figcaption>A view itself doesn’t move any data</figcaption></figure><ul><li><strong>Use by default</strong> for staging models, light renaming/casting, or anything cheap that downstream models only reference once or twice.</li><li><strong>Use when</strong> freshness matters more than query speed. Source changes show up instantly, with no scheduled run to wait on.</li><li><strong>Avoid stacking</strong> views on top of views, especially if your dashboards reference these repeatedly. After all, every refresh recomputes the full chain against raw sources.</li></ul><h3>Table: Compute Once, Read Fast Forever</h3><p>A table is physically written to disk. Every dbt run, dbt first drops the old table and then runs CREATE TABLE AS from scratch. That’s a full rebuild of the table, every time, regardless of how much source data actually changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sd7tM3dHOR4VFxyl0m0lxQ.png" /><figcaption>Tables are first dropped and then fully recreated every dbt run</figcaption></figure><ul><li><strong>The trade-off:</strong> you pay compute once during the run so every read afterward is instant.</li><li><strong>Use for</strong> final BI-facing marts where read speed matters more than build cost.</li><li><strong>Use for</strong> anything with joins or aggregations too heavy to run live as a view.</li><li><strong>Watch out:</strong> full rebuilds on large tables are usually the first thing that blows up your nightly run window as data volume grows. You’re recomputing 100% of the rows even when only a fraction actually changed.</li></ul><h3>Incremental: The One That Actually Scales</h3><p>This is where most production pipelines eventually land, because full rebuilds stop being viable once you’re dealing with anything growing by millions of rows a day, such as event streams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aTk4qkQe64y8RKtOBnN7dQ.png" /><figcaption>Incremental models only move the latest data, indicated here in black and dark green</figcaption></figure><p>Incremental models don’t touch existing data. The is_incremental() macro filters the run down to only new or changed rows, and dbt merges or appends just that delta into the existing table.</p><pre>select *<br>from {{ source(&#39;my_source&#39;, &#39;my_table&#39;) }}<br>{% if is_incremental() %}<br>where load_timestamp &gt; (select max(load_timestamp) from {{ this }})<br>{% endif %}</pre><ul><li><strong>Use once</strong> full-table rebuilds start eating your run window or warehouse credits.</li><li><strong>Always define</strong> a clear unique_key and a tested full-refresh path.</li><li><strong>Don’t use this</strong> on small tables. The added complexity isn’t worth it under a few million rows.</li><li><strong>Watch out:</strong> late-arriving data, out-of-order events, or a bad unique_key might silently leave gaps that a full rebuild would have caught. A fix is to use a timestamp indicating when data was loaded in the source table.</li></ul><h3>Ephemeral: Code Reuse, Not a Database Object</h3><p>Ephemeral models don’t show up in your warehouse schema at all. At compile time, dbt literally pastes your SQL into whatever model references it, as a Common Table Expression. Your warehouse never sees the ephemeral model exist, it only sees one larger compiled query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouwn70qBAODLVPyJapr4mA.png" /><figcaption>Nothing gets created in your database, and the model itself doesn’t create anything. It’s just SQL inserted into another model.</figcaption></figure><p>That makes this purely an organizational tool. It’s how you break a 500-line query into readable, testable pieces without cluttering your database.</p><ul><li><strong>Use for</strong> internal logic you want to keep <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> across multiple downstream models.</li><li><strong>Don’t use it</strong> for anything a colleague needs to query directly. They literally can’t, the ephemeral model doesn’t exist as an object in your database.</li><li><strong>Watch out:</strong> don’t chain too many of these together. It’ll turn your compiled SQL into a nested CTE nightmare, making it impossible to debug. Cap it at two, max three layers deep before forcing something into an actual table.</li></ul><h3>Materialized View: Letting the Warehouse Take Over</h3><p>This one’s confusing, especially on a data warehouse like Snowflake. First, dbt deploys the materialized view, just once. Then the warehouse’s<em> </em>own background refresh process keeps the data up to date, <em>independent of your dbt run schedule</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*237CV9JxNTVmi11GOxkhUQ.png" /><figcaption>Your data warehouse refreshes data itself after the initial dbt run</figcaption></figure><ul><li><strong>Use when</strong> downstream consumers need near-real-time freshness without waiting on a scheduled dbt run.</li><li><strong>Check SQL restrictions first:</strong> Snowflake’s native materialized views don’t support common SQL operations like JOIN, ORDER BY, LIMIT, UDFs, or most aggregate functions. That rules out a lot of transformation logic.</li><li><strong>Snowflake specific: consider </strong><a href="https://docs.snowflake.com/en/user-guide/dynamic-tables/dbt"><strong>Dynamic Tables</strong></a><strong> instead</strong> when you hit those restrictions. They give the same warehouse-managed refresh behavior with full SQL support, including joins, and a configurable target lag.</li><li><strong>Know the trade-off:</strong> you’re delegating refresh and refresh visibility to the warehouse. Make sure to <em>check your warehouse, not the dbt logs,</em> when data looks off or stale.</li></ul><h3>The Decision Framework I Actually Use</h3><p>Here’s the simplest decision flow for your next materialization:</p><ul><li>When in doubt, start a new model as a <strong>View</strong>.</li><li>Upgrade to <strong>Table</strong> when read latency becomes the bottleneck.</li><li>Move to <strong>Incremental</strong> when rebuild time or compute cost becomes the bottleneck.</li><li>Extract logic into <strong>Ephemeral</strong> purely for code hygiene.</li><li>Choose <strong>Materialized Views</strong> (or Dynamic Tables if you’re on Snowflake) only when the business genuinely needs freshness outside your dbt schedule, not as a default “fast” option.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xU2SDUMbgUar0duNp1V9uQ.png" /><figcaption>Simplest decision flow chart ever</figcaption></figure><p>Finally, remember this: the materialization config is the cheapest tool you have to control cost and speed. Get it wrong and you find out from your warehouse bill, not your code review.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a71082625c29" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/dbt-materializations-what-actually-happens-to-your-data-a71082625c29">dbt Materializations: What Actually Happens to Your Data</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Three Lessons Learned Building Data Platforms From Scratch]]></title>
            <link>https://blog.dataengineerthings.org/three-lessons-learned-building-data-platforms-from-scratch-2ea26567c850?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ea26567c850</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 02:59:15 GMT</pubDate>
            <atom:updated>2026-06-15T02:59:15.934Z</atom:updated>
            <content:encoded><![CDATA[<h4>The case for boring tools, smaller ambitions, and building for the team you have</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*_mMZDj9wBgOJd7lvVP3qRA@2x.jpeg" /><figcaption>Image generated using AI</figcaption></figure><h3>Why Greenfield Projects Are Uniquely Hard</h3><p>Building a data platform from scratch is a dangerous endeavor. Not because it’s technically hard (though not easy either), but because it gives you the freedom to make every mistake yourself.</p><p>Over the years I’ve seen the same patterns repeat:</p><ul><li>Teams that built for elegance before they even understood their consumers.</li><li>Architectures designed around one brilliant engineer rather than the team as a whole.</li><li>Platforms assembled from best-in-class tools that turned out to be nearly impossible to operate together.</li></ul><p><em>Here’s what I’d do differently.</em></p><h3>Start With the Data Consumers, Not the Architecture</h3><p>When any engineer starts greenfield project, their instinct is to immediately start designing. I’m guilty as charged, too. The problem is that you can build something extremely well that nobody needs.</p><p>The most humbling version of this is that your end users may just want to export data to Excel. It already fits their workflow, they know how to use it, and it solves their problem. Your platform, however elegant, does not. That’s not their fault.</p><p>Before you write a single line of infrastructure code, understand exactly how your consumers work. What decisions does the data need to support? Who is making them? Where does data fit into their current workflow? The answers might be uncomfortable, but they’re real.</p><p><em>Build for that reality, not the one you assumed.</em></p><h3>Pick Boring Tools for the Foundation</h3><p>The data tooling landscape is exciting, and evaluating new tools feels like progress. Teams build comparison matrices and land on the best tool for each individual job. Each decision, made in isolation, is defensible. Collectively, they produce an architecture that’s nearly impossible to maintain, let alone extend.</p><p><em>That’s the integration tax.</em></p><p>Every tool you add multiplies the complexity of everything around it, such as authentication, monitoring, but also onboarding. In a startup that’s painful, but you’ll manage. In an enterprise, however, this becomes crippling: security reviews, procurement overhead, and institutional knowledge that walks out the door with every engineer that leaves.</p><p><em>This best of breed is contrasted to best of suite.</em></p><p>A single platform doing many things at 80% quality almost always beats ten “best” tools each doing one thing at 100%.</p><p>Snowflake is a good example. Its Spark environment isn’t the best. Its data quality features aren’t as powerful as Soda. Its orchestration isn’t Dagster. And yet, consolidating around Snowflake in an enterprise context might be exactly the right call. Not because it wins every battle, but because the cost of stitching together the tools that do is enormous and compounds over time.</p><p>Here’s a simple rule: if removing a tool would require rewriting a significant portion of your platform, it deserves some serious looking into. If you could swap it out in a sprint, the no harm done.</p><p><em>Boring foundational infrastructure is a feature, not a limitation.</em></p><h3>Design for the Team You Have, Not the Team You Imagine</h3><p>The architect who designs a system understands every trade-off that went into it. The rest of the team inherits the outcome, often without that context. The knowledge gap that this creates is often much wider than the designer realizes.</p><p>The most common symptom of this is tooling choices that outmatch the team’s familiarity with them. A senior engineer proposes something they know well, makes a compelling case, implements it, and inadvertently becomes the only person who can maintain it.</p><p>Terraform is a good example. Legitimate, widely adopted, genuinely useful. But if nobody on the team has prior IaC experience, you haven’t just added a tool. You’ve created a single point of failure, and decreased the team’s buy-in.</p><p><em>If I left tomorrow, could this team operate and extend what I built?</em></p><h3>The Checklist: What to Validate Before You Commit</h3><p><strong>On your consumers</strong></p><ul><li>Have you spoken to end users about their actual daily workflow? This should go beyond a requirements meeting where everyone agrees the platform sounds great.</li><li>Are you building for the consumers you have, or the ones you imagine you’ll have? Saves you from over-engineering.</li></ul><p><strong>On your tooling</strong></p><ul><li>Does each tool solve a problem your current stack genuinely cannot solve? <em>“It solves it less elegantly”</em> is not enough.</li><li>How many tools does an engineer need to understand to debug a failure end to end?</li><li>Could you consolidate two or more tools into something you already own? Fewer moving parts to deal with.</li></ul><p><strong>On your team</strong></p><ul><li>If you left tomorrow, could your team operate and extend what you built?</li><li>Was the team involved in tooling decisions, or presented with the outcome? Involvement builds ownership, which leads to adoption and support.</li></ul><h3>Good Platforms Are Designed, Great Platforms Are Grown</h3><p>The most humbling question I can ask at the start of any project isn’t <em>“what’s the best architecture for this?” </em>Rather, it’s <em>“does anyone actually want what I’m about to build?”</em></p><p>The best platform builders are the ones who check their plans and ambitions against reality early and often. And they’re willing to build something smaller and simpler than they are capable of, because that’s what the situation calls for. Extend it when there’s a real need.</p><p><em>The engineer who understands this will build something that lasts far longer than the one who got the architecture perfect on paper.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ea26567c850" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/three-lessons-learned-building-data-platforms-from-scratch-2ea26567c850">Three Lessons Learned Building Data Platforms From Scratch</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why No One Understands Your Data Platform But You]]></title>
            <link>https://blog.dataengineerthings.org/why-no-one-understands-your-data-platform-but-you-2e67d5571423?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e67d5571423</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Fri, 29 May 2026 19:29:07 GMT</pubDate>
            <atom:updated>2026-05-29T19:29:07.895Z</atom:updated>
            <content:encoded><![CDATA[<h4>A structured approach to documenting architecture for every audience</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v5diDAEVE93H1VHj" /><figcaption>Photo by <a href="https://unsplash.com/@charlesdeluvio?utm_source=medium&amp;utm_medium=referral">charlesdeluvio</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ask any data engineer to explain their data platform and you’ll likely see a diagram with forty boxes, five colors, and arrows going everywhere. The problem isn’t necessarily the diagram, it’s that they tried to serve every audience with this one diagram.</p><p>The problem is, different stakeholders need different levels of abstraction. A CEO needs to understand how the data platform fits within the business. An engineer debugging a stale dbt model needs something completely different. A single diagram can’t do both.</p><h3>The C4 Model</h3><p><a href="https://c4model.com/">The C4 model</a> is a framework for communicating software architecture at four levels of abstraction. One diagram per level, each with a defined audience and scope.</p><p>• <strong>Level 1: Context.</strong> The big picture. It shows your data platform as a single box, surrounded by the systems it connects to.</p><p>• <strong>Level 2: Container.</strong> The major building blocks. Think data lake, warehouse, BI layer, and how data flows between them.</p><p>•	<strong>Level 3: Component.</strong> The internals of one container: dbt model layers, DAGs, schemas.</p><p>•	<strong>Level 4: Code.</strong> The implementation detail of a single component, such as a specific dbt model or Airflow DAG.</p><p>C4 isn’t a tool or notation standard. It’s a thinking framework. Use whatever diagramming tool you already have.</p><h3>Why Data Platforms Specifically Need This</h3><p>Most architecture frameworks are for software architecture. Data platforms are different as they bridge two worlds: the business world of customers and contracts, and the technical world of DAGs and data warehouses.</p><p>Business stakeholders can’t interpret a diagram full of Snowflake datasets and dbt dependencies. Engineers, on the other hand, can’t act on one that just says <em>“data flows from sources to dashboards.”</em> C4 lets you address both without maintaining two separate sets of docs that drift out of sync the moment something changes.</p><h3>The Four Levels in Practice</h3><p>The examples below a fictional (and incomplete) data platform for an energy supplier tracking contract health, churn risk, and regulatory obligations.</p><h4>Level 1: Context</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXh6mrAZToKZ5vEjwfsOlg.png" /><figcaption>Level 1: data sources, data platform, targets</figcaption></figure><p><strong>Audience:</strong> Executives, business stakeholders, new colleagues.</p><p>The data platform is a single box. External systems feed it; business teams consume from it. It shows no tools, no pipelines, no databases.</p><p><strong>Get this right:</strong> Resist adding <em>“just one more detail.”</em> A Snowflake logo or an extra box breaks the abstraction. Details come at the next level.</p><h4>Level 2: Container</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KMQpLXBGQUmvhVZvj4AKCw.png" /><figcaption>Level 2: building blocks inside the data platform</figcaption></figure><p><strong>Audience:</strong> Team leads and platform architects.</p><p>Now we reveal the building blocks inside our data platform: AWS, Airflow, Snowflake, dbt, PowerBI. We also show how data flows between them. Note that Airflow connects to both ingestion and dbt orchestration. Snowflake has two outbound arrows because PowerBI and the regulatory export are different consumers with different requirements.</p><p><strong>Get this right: </strong>Every line needs a direction. Bidirectional arrows say nothing. Each line should answer: <em>who depends on whom?</em></p><h4>Level 3: Component</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0a9y6X12rY6g8Nh1Ta8Mg.png" /><figcaption>Level 3: dbt container showing individual dbt models and tests</figcaption></figure><p><strong>Audience: </strong>Engineers building and maintaining the platform.</p><p>Zoom into one container. In this case, (part of) the dbt project. We see source definitions, staging models, marts, and tests. Two things become clear that weren’t visible at Level 2: mart_contracts pulls from both stg_contracts and stg_consumption, and mart_regulatory serves a different downstream consumer, indicated by using a different color.</p><p><strong>Get this right:</strong> Draw one container, not all of them. Pick the one that causes the most confusion or has led to the most incidents.</p><h4>Level 4: Code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy3xdPhyegYKm6ElJwhZvg.png" /><figcaption>Level 4: code logic for a single dbt model</figcaption></figure><p><strong>Audience: </strong>The engineer about to modify a specific component.</p><p>For mart_contracts, this means showing the source tables and columns used, the JOIN logic, and the churn_risk_flag filter. Note that this filter is flagged as a critical business rule, not just a technical SQL condition. The output contract is made explicit: one row per contract.</p><p><strong>Get this right: </strong>Don’t draw Level 4 diagrams for everything. Create them on demand, for components that are complex enough to need explanation or risky enough that mistakes are costly. A reliable signal: someone asks you to walk them through the code.</p><h3>Four Practical Rules For C4</h3><p><strong>Start with Level 1.</strong> It’s often enough for stakeholder alignment. Go deeper only when needed.</p><p><strong>Don’t document everything. </strong>Create diagrams when there’s a real need for them. Saves you precious time.</p><p><strong>Keep diagrams alive.</strong> Difficult to do, so update whenever you’re showing them, or add a step to your PR checklist.</p><p><strong>Check with your audience. </strong>Show the Level 1 diagram first. If it’s too abstract, go one level deeper.</p><p>If you can’t explain your platform at all four levels, you don’t yet understand it well enough to maintain it. Start with Level 1.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e67d5571423" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/why-no-one-understands-your-data-platform-but-you-2e67d5571423">Why No One Understands Your Data Platform But You</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up Snowflake + AWS Storage Integration]]></title>
            <link>https://medium.com/towards-data-engineering/setting-up-snowflake-aws-storage-integration-5820a3f9b08b?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/5820a3f9b08b</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Thu, 14 May 2026 05:45:50 GMT</pubDate>
            <atom:updated>2026-05-14T05:45:50.779Z</atom:updated>
            <content:encoded><![CDATA[<h4>How I Broke the Circular Dependency</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRcw3sG0xzNSB4A5l9CwGQ.png" /><figcaption>AI-generated depiction of a storage integration</figcaption></figure><p>If you’ve worked with Snowflake and S3, you’ve probably hit this wall: loading data from an S3 bucket into your data warehouse, or dumping a table back into cloud storage. It’s a common pattern, but the initial setup has a subtle trap.</p><p>In Snowflake, a <a href="https://docs.snowflake.com/en/sql-reference/sql/create-storage-integration">storage integration</a> manages authentication to external cloud storage. External stages use it to make S3 buckets first-class citizens in Snowflake’s SQL interface, letting you read and write data using plain SQL, no credentials embedded anywhere.</p><p>But creating a storage integration requires an IAM role in AWS. And setting up that IAM role correctly requires information that only exists <em>after</em> the storage integration is created.</p><p>You can’t finalize the AWS side without Snowflake, and you can’t complete the Snowflake setup without AWS. Classic chicken-and-egg.</p><h3>Understanding the Moving Parts</h3><p>A storage integration is an account-level Snowflake object that handles authentication with your external cloud provider. Instead of embedding AWS credentials in every stage definition, you create one integration and reference it wherever needed. Revoking access later is equally simple, one object to modify.</p><p>Authentication requires a few key pieces on each side.</p><p>In Snowflake, you create the storage integration, which external stages reference. In AWS, you create an IAM role with read/write permissions on your S3 bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KTj_j6ctldqdFiGh_nuayg.png" /><figcaption>Basic resources to be created in Snowflake and AWS.</figcaption></figure><p>Here’s where it gets circular. After creating a storage integration, Snowflake generates two values that AWS needs to configure the trust relationship:</p><ul><li>STORAGE_AWS_IAM_USER_ARN : Snowflake&#39;s internal IAM user. Your AWS role must allow this user to assume it.</li><li>STORAGE_AWS_EXTERNAL_ID : a token unique to your integration. The AWS trust policy requires it.</li></ul><p>The storage integration generates values needed by the AWS role, while the storage integration itself needs the AWS role ARN to be created in the first place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BrTcTDgP7t54UpeKueOLHQ.png" /><figcaption>Cyclical dependencies between storage integration and IAM role.</figcaption></figure><h3>Solving It with a Three-Step Deployment</h3><p>The solution is to treat this as a sequential process rather than trying to provision everything at once.</p><p><strong>Step 1:</strong> Deploy an IAM role with a placeholder principal. This gives you a stable role ARN to work with.</p><p><strong>Step 2:</strong> Create the Snowflake storage integration using that ARN. Snowflake will generate the IAM user ARN and external ID.</p><p><strong>Step 3:</strong> Update the IAM role’s trust policy with the real values from Snowflake, then redeploy.</p><p>This isn’t a workaround, it’s the <a href="https://docs.snowflake.com/en/user-guide/data-load-s3-config-storage-integration">documented, intended workflow</a>. Thinking of it as intentional phases makes it much easier to automate and reason about.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rg8be6iBq3dYWE0ZYB15tg.png" /></figure><h3>A Practical Example: SQL and the AWS CDK</h3><h4><strong>Step 1: Bootstrap the AWS Side with a Placeholder</strong></h4><p>The CDK requires a non-empty assumed_by principal at synthesis time, so pass a dummy IAM user ARN. Your account&#39;s root user or any placeholder will do. The stack deploys successfully, and you get a stable role ARN in the form arn:aws:iam::&lt;account-id&gt;:role/&lt;role-name&gt;. That&#39;s all you need to move forward.</p><pre># User with placeholder user_arn<br>snowflake_user = aws_iam.User.from_user_arn(<br>    self,<br>    &quot;SnowflakeUserLookup&quot;,<br>    user_arn=&quot;arn:aws:iam::123456789000:user/7r240000-s&quot;,  # placeholder value<br>)<br><br># We need the ARN for this role<br>snowflake_storage_integration_role = aws_iam.Role(<br>    self,<br>    &quot;SnowflakeIntegrationRole&quot;,<br>    assumed_by=snowflake_user,<br>    role_name=&quot;snowflake-integration-role&quot;,<br>)<br><br># Grant the integration role read and write permissions to our S3 bucket<br>s3_bucket.grant_read_write(snowflake_storage_integration_role)</pre><h4>Step 2: Create the Snowflake Storage Integration</h4><pre>CREATE OR REPLACE STORAGE INTEGRATION my_s3_integration<br>    TYPE = EXTERNAL_STAGE<br>    STORAGE_PROVIDER = &#39;S3&#39;<br>    ENABLED = TRUE<br>    STORAGE_AWS_ROLE_ARN = &#39;arn:aws:iam::&lt;account-id&gt;:role/&lt;role-name&gt;&#39;<br>    STORAGE_ALLOWED_LOCATIONS = (&#39;s3://&lt;bucket&gt;/&lt;prefix&gt;&#39;)</pre><p>Then retrieve the generated values:</p><pre>DESC INTEGRATION my_s3_integration</pre><p>Copy STORAGE_AWS_IAM_USER_ARN and STORAGE_AWS_EXTERNAL_ID. You’ll need both in the next step.</p><h4><strong>Step 3: Update the AWS Role with Real Values</strong></h4><p>Replace the placeholder ARN with STORAGE_AWS_IAM_USER_ARN and add the external ID to the trust policy, then redeploy your stack. Only the trust policy changes. The role ARN, S3 grants, and Snowflake integration all remain intact.</p><pre># This is now the real Snowflake user<br>snowflake_user = aws_iam.User.from_user_arn(<br>    self,<br>    &quot;SnowflakeUserLookup&quot;,<br>    user_arn=&quot;arn:aws:iam::123456789000:user/7r240000-s&quot;,  # real value from STORAGE_AWS_IAM_USER_ARN<br>)<br><br># Note the external_ids are added in this step to the IAM role<br>snowflake_storage_integration_role = aws_iam.Role(<br>    self,<br>    &quot;SnowflakeIntegrationRole&quot;,<br>    assumed_by=snowflake_user,<br>    role_name=resource_name(self, &quot;snowflake-integration-role&quot;),<br>    external_ids=[&quot;TL12345_SFCRole=1_2345ABCDE&quot;],  # STORAGE_AWS_EXTERNAL_ID fetched from Snowflake storage integration<br>)<br><br># S3 permissions remain unchanged<br>s3_bucket.grant_read_write(snowflake_storage_integration_role)</pre><p><strong>A note on the external ID:</strong> without it, any Snowflake customer who discovers your role ARN could create their own storage integration pointing at it — and AWS would let Snowflake’s shared IAM user assume it. This is the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html">confused deputy problem</a>. The external ID is unique to your integration, so the trust policy only accepts assumption requests carrying that specific token.</p><h3>Putting It All Together</h3><p>Three steps, one working integration:</p><ol><li>Deploy the IAM role with a placeholder principal to get the AWS role ARN.</li><li>Create the Snowflake storage integration to get the IAM user ARN and external ID.</li><li>Update the IAM role with the real values and redeploy.</li></ol><p>Once it’s live, you can create as many external stages as you need without touching IAM again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5820a3f9b08b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/setting-up-snowflake-aws-storage-integration-5820a3f9b08b">Setting Up Snowflake + AWS Storage Integration</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[Automated Alerting In AWS Using EventBridge and Lambda]]></title>
            <link>https://aws.plainenglish.io/automated-alerting-in-aws-using-eventbridge-and-lambda-05a4aeceee56?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/05a4aeceee56</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 18:43:22 GMT</pubDate>
            <atom:updated>2026-01-19T13:34:40.308Z</atom:updated>
            <content:encoded><![CDATA[<h4>A practical pattern to catch any failures so you sleep better at night</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovpl49tqGwndQ18TpT0l0w@2x.jpeg" /><figcaption>Photo by <a href="https://www.mufid.web.id/">Mufid Majnun</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>At a startup, missing data rarely fails loudly. It fails when a dashboard stops updating, and even worse, when someone asks why the numbers don’t make sense.</p><p>Early in my career, my data pipelines were failing, but I didn’t know it.</p><p><em>By the time someone noticed something was off, the damage was already done.</em></p><p>I built my pipelines using AWS Step Functions, which define so-called state machines. They are a solid choice for orchestration; no complaints there. However, when they fail, they do not send alerts. Unless someone checks logs or the AWS console, failures go unnoticed.</p><p><em>I needed to send notifications when a pipeline failed, both for current and future pipelines.</em></p><h3>What The Solution Must Do</h3><p>Before selecting specific tools, I established a few requirements.</p><ul><li><strong>Separation of concerns.</strong> Pipeline logic should focus solely on data processing, while alerting should be handled separately.</li><li><strong>Catch all failures.</strong> This includes both anticipated and unanticipated failures.</li><li><strong>Near real-time feedback.</strong> Alerts should appear on my screen within seconds of a pipeline failure, not hours.</li><li><strong>Actionable alerts.</strong> At a minimum, the alert should specify which pipeline failed.</li></ul><p>The practical benefit of these principles is straightforward. New pipelines can be added without modifying the alerting code. As long as a state machine adheres to a naming convention, it is monitored automatically.</p><p><em>With these goals in mind, I chose EventBridge, Lambda, and Slack.</em></p><p>To this day, I still use this approach.</p><blockquote><em>💡 </em>AWS provides execution metrics and logs, and you can build CloudWatch alarms on top of them. However, I found these options either too coarse or too tightly coupled to individual pipelines to meet my objectives.</blockquote><h3>Event-Driven Notifications Using EventBridge and Lambda</h3><p><em>The goal is simple.</em></p><p>Automatically detect failures, translate them into understandable messages, and deliver them to the team’s existing platforms.</p><p>To achieve this, I use three AWS services plus Slack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*Te8628PRWBIfxV2-rI2DKA.png" /><figcaption>High-level architecture design</figcaption></figure><p><strong>EventBridge is the sensor.</strong></p><p>AWS services emit events by default, and EventBridge allows you to respond to them. Step Functions emit execution status change events when an execution starts and when it reaches a terminal state, whether it succeeds or fails.</p><p>By filtering for FAILED and TIMED_OUT, alerts trigger only when human attention is needed.</p><blockquote><em>💡 </em>These events are emitted when the execution ends, not when an individual state fails inside the execution. This means alerts trigger after the entire state machine execution fails or times out, not after any individual state failure.</blockquote><p><strong>Lambda is the translator.</strong></p><p>It converts raw JSON events into readable and useful information. It is effective because it reacts immediately to an event, with a short startup time that keeps alerts prompt.</p><p><strong>Slack is the messenger.</strong></p><p>It works well since it is already open on my screen all day. However, any tool your team actively uses will suffice.</p><p>Overall, this design scales nicely. As the number of state machines increases, alerting remains consistent. Additionally, changing the communication tool or message formats does not require adjustments to existing workflows.</p><h3>Building the Monitoring System</h3><p>We’ll create a reusable alerting pattern for Step Functions and discuss extending it to other AWS services at the end.</p><p>Assuming our state machines in Step Functions follow a predictable naming pattern, such as &lt;team-name&gt;-&lt;environment&gt;-&lt;project-name&gt;, we&#39;ll use this pattern to filter events in EventBridge.</p><h4>Filtering Events Using An EventBridge Rule</h4><p><em>First, reduce noise.</em></p><p>We filter the stream of AWS events to focus only on those we care about.</p><p>The event must meet these three conditions:</p><ul><li>It indicates a change in execution status.</li><li>The state machine ARN matches our naming pattern.</li><li>The execution status is either FAILED or TIMED_OUT.</li></ul><p>The event pattern looks like this.</p><pre>{<br>  &quot;detail-type&quot;: [&quot;Step Functions Execution Status Change&quot;],<br>  &quot;detail&quot;: {<br>    &quot;stateMachineArn&quot;: [{<br>      &quot;prefix&quot;: &quot;arn:aws:states:&lt;region&gt;:&lt;account-id&gt;:stateMachine:&lt;team-name&gt;-&lt;environment&gt;&quot;<br>    }],<br>    &quot;status&quot;: [&quot;FAILED&quot;, &quot;TIMED_OUT&quot;]<br>  },<br>  &quot;source&quot;: [&quot;aws.states&quot;]<br>}</pre><p>Of course, the &lt;region&gt;, &lt;account_id&gt;, &lt;team-name&gt;, and &lt;environment&gt; in the prefix field need to be substituted with actual values. Furthermore, you’ll need to define the Lambda function as the target of this rule.</p><h4>Parsing Incoming Events Using A Lambda Function</h4><p><em>Next, make the alert useful for human intervention.</em></p><p>The input for the Lambda function is the raw EventBridge event, which includes the execution ARN, execution status, timestamps, and failure details.</p><p>Extract the fields that matter to us, such as the state machine name and execution start and end timestamps. You could also generate a direct link to the execution in the AWS Console. You’ll thank yourself later.</p><p>Here’s a simplified Python example.</p><pre>detail = event.get(&quot;detail&quot;, {})<br>state_machine_arn = detail.get(&quot;stateMachineArn&quot;, &quot;Unknown&quot;)<br>execution_arn = detail.get(&quot;executionArn&quot;, &quot;Unknown&quot;)<br>state_machine_name = (<br>    state_machine_arn.split(&quot;:&quot;)[-1]<br>    if state_machine_arn != &quot;Unknown&quot;<br>    else &quot;Unknown&quot;<br>)<br><br>start_date = detail.get(&quot;startDate&quot;, 0.0) / 1000<br>stop_date = detail.get(&quot;stopDate&quot;, 0.0) / 1000<br>start_date = datetime.fromtimestamp(start_date).isoformat()<br>stop_date = datetime.fromtimestamp(stop_date).isoformat()<br><br>execution_name = (<br>    execution_arn.split(&quot;:&quot;)[-1] if execution_arn != &quot;Unknown&quot; else &quot;Unknown&quot;<br>)<br>region = (<br>    state_machine_arn.split(&quot;:&quot;)[3] if &quot;:&quot; in state_machine_arn else &quot;us-east-1&quot;<br>)<br>console_url = f&quot;&lt;https://console.aws.amazon.com/states/home?region={region}#/executions/details/{execution_arn}&gt;&quot;</pre><p>Lastly, send the message to your preferred destination.</p><p>In real events, some fields may be missing depending on the execution failure. Defensive defaults ensure the alert remains useful even when AWS provides partial data.</p><p>It’s also important to handle failures within this Lambda. This way, alerts do not silently fail as well. How ironic that would be, given our stated goal of automating alerting.</p><h3>Extending This Pattern To Other Services</h3><p><em>The real strength of this setup is that the core pattern remains consistent.</em></p><p>An AWS service emits events, which EventBridge rules filter based on your needs. A small Lambda function transforms them into alerts with a consistent structure and context.</p><p>This flow works well beyond Step Functions. Glue job failures, EMR step failures, and many other services already emit events. Integrate them into the same pattern, and you gain alerting with minimal effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*JQSTjaDIldFdisabqVYE4Q.png" /><figcaption>Different AWS services, each with separate alerting rules and Lambda handlers</figcaption></figure><p>Me personally, I prefer using separate EventBridge rules and Lambda functions for each service. This keeps each alert handler small and easy to write and maintain.</p><p>While it does add some extra infrastructure, the simplicity pays off when issues arise. You may prefer a single handler with shared logic; both approaches are valid.</p><p>Alerts can be directed to one shared Slack channel or divided by service. Either way, the message format remains familiar, making failures easier to triage.</p><h3>Final Thoughts Before You Go</h3><p>After implementing this system, missing data nearly stopped. Technical failures still occur occasionally, but alerts now appear within seconds, with direct links to the exact execution. Failures are immediately visible and ready for action.</p><p>The real benefit isn’t just faster alerts; it’s trust. Trust from the business and trust in our systems. Now we can focus on building new pipelines instead of worrying about broken ones.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05a4aeceee56" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/automated-alerting-in-aws-using-eventbridge-and-lambda-05a4aeceee56">Automated Alerting In AWS Using EventBridge and Lambda</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science, the AI Boom, and the Sexiest Job of the 21st Century]]></title>
            <link>https://blog.dataengineerthings.org/data-science-the-ai-boom-and-the-sexiest-job-of-the-21st-century-1e414c0e218d?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e414c0e218d</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Thu, 29 May 2025 20:55:21 GMT</pubDate>
            <atom:updated>2025-05-29T20:55:21.722Z</atom:updated>
            <content:encoded><![CDATA[<h4>And why I do the dirty job that quietly enables it all</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Kvecd2iXZyRJXfMRa8mHhw@2x.jpeg" /><figcaption>Image generated using AI</figcaption></figure><h3>The Sexiest Job of the 21st Century</h3><p>Back in 2012, <em>Harvard Business Review</em> famously called Data Scientist <a href="https://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century">the <em>sexiest job of the 21st century</em></a>. Every company wanted to hire a data science team. Job boards exploded. Online coding bootcamps popped up everywhere, ready to produce new data scientists to meet the demand of this new digital gold rush.</p><p><em>I was one of them.</em></p><p>I was fully convinced I was going to change the world with fancy models, and generating insights that were going to alter the very course of the entire company.</p><p><em>Spoiler: that’s not how it went.</em></p><h3>When the Data Science Hype Ran Out</h3><p>Turns out, a lot of companies had no idea what to actually <em>do</em> with data science, let alone how to set up the right infrastructure to support it. They hired people like me because they felt like they had to or because their competitors did. But nobody stopped to ask the obvious: <em>do we even have the right data?</em> And if so, is it any good?</p><p><em>No, we didn’t. And no, it wasn’t.</em></p><p>This wasn’t just my own story. Research referenced in <a href="https://www.routledge.com/Why-Data-Science-Projects-Fail-The-Harsh-Realities-of-Implementing-AI-and-Analytics-without-the-Hype/Gray-Shellshear/p/book/9781032660301"><em>Why Data Science Projects Fail</em></a> found that around <a href="https://www.qut.edu.au/insights/business/understanding-the-looming-ai-crisis-why-do-so-many-data-science-projects-fail">80% of data science projects flop</a>. Why? The absence of reliable data pipelines to support the models, messy and inconsistent data quality, and unrealistic expectations for quick fixes and magical insights.</p><p><em>I lived this reality.</em></p><p>Most of my days weren’t spent fine-tuning models or revolutionizing the business. Instead, I was chasing down missing customer IDs, begging other teams for database access, or trying to make sense of datasets with nested fields, four layers deep.</p><p>I quickly realized that without reliable, well-structured data, the promise of data science remained out of reach. The work was less about algorithms and more about solving the data chaos just to get to a workable starting point.</p><p>Without clean, reliable data, all the data science hype was just that: hype.</p><p>So I did what many frustrated data scientists at the time did. I pivoted.</p><p>I ditched my background in statistics and switched over to data engineering. I grappled with new concepts like the difference between ETL and ELT, different types of databases, data infrastructure, and software engineering principles. It was by no means glamorous, but it <em>did</em> make a difference.</p><p><em>And strangely enough, it was rewarding.</em></p><p>In data engineering, I finally felt like I was solving the problems that had always frustrated me as a data scientist. I helped build pipelines that actually worked, and gave teams reliable data to work with.</p><p><em>As a bonus: being quietly indispensable is pretty nice.</em></p><h3>Today’s AI Boom</h3><p>Fast forward to today, and now AI holds the title of the <em>sexiest job,</em> although I’m still waiting on the Harvard Business Review to make an official declaration. Every company CEO wants an AI strategy, every LinkedIn tech influencer is debating whether AI will replace all developers in the next 5 years. This excitement surrounding artificial intelligence, particularly generative AI, extends well beyond the tech industry and into the mainstream.</p><p><em>Even my mom knows about GenAI.</em></p><p>But once again, plenty of companies are scrambling to hire AI engineers and ML specialists without stopping to ask: <em>do we actually have clean enough data for our use cases?</em></p><p><em>No, plenty of ‘em don’t.</em></p><p>If there’s anything we should’ve learned from the data science era, it’s this: garbage in will always lead to garbage out. Even the most sophisticated of models cannot save you from bad data. It doesn’t matter how flashy the AI demo is you’ve seen online, if your data infrastructure and data are not good enough, your AI use case will fail.</p><h3>AI is the Future (And So is Data Engineering)</h3><p>Don’t get me wrong; I do believe AI is the future. The technology is advancing rapidly, and it continues to reshape industries in ways we could not have predicted. But this future is only possible if we finally learn the lesson we ignored the first time around: without a solid foundation, AI will also not live up to its hype.</p><p>The best AI systems won’t just be the ones with the fanciest models. They’ll be the ones sitting on top of solid data pipelines and data infrastructure. So while AI takes the spotlight, the rest of us will be quietly holding it all together behind the scenes.</p><p><em>And honestly? I don’t mind being data’s plumber. Even if it’s a dirty job.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e414c0e218d" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/data-science-the-ai-boom-and-the-sexiest-job-of-the-21st-century-1e414c0e218d">Data Science, the AI Boom, and the Sexiest Job of the 21st Century</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide To Data Anonymization With PySpark]]></title>
            <link>https://medium.com/towards-data-engineering/a-practical-guide-to-data-anonymization-with-pyspark-8e78ec26ca85?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e78ec26ca85</guid>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[anonymization]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-management]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Thu, 01 May 2025 09:46:42 GMT</pubDate>
            <atom:updated>2025-05-01T15:29:38.749Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Differential privacy for smarter data anonymization</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8A9JuMvrSt7okWx1" /><figcaption>Photo by <a href="https://unsplash.com/@chrisyangchrisfilm?utm_source=medium&amp;utm_medium=referral">Chris Yang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Need for Privacy</h3><p>Organizations across various sectors gather and store significant amounts of personal and sensitive information. With regulations like GDPR imposing strict requirements on data privacy, <strong>anonymizing sensitive data is not optional; it is a necessity</strong>. For instance, under GDPR, <strong>fines can reach up to €20 million</strong> or 4% of annual global revenue, whichever amount is greater.</p><h3>The Risks of Improper Data Anonymization</h3><p>Improper data anonymization can have significant consequences for a business. Broadly, incorrect anonymization can occur in two ways:</p><p><strong>Over-anonymization renders data unusable.</strong> While stringent anonymization reduces privacy risks, it can also make the data meaningless for analytics and machine learning.</p><ul><li><strong>Complete data masking</strong> eliminates all statistical properties of the data. For example, replacing all values withREDACTED.</li></ul><p><strong>Insufficient anonymization can lead to re-identification.</strong> Even if data is anonymized, using poor techniques can still enable re-identification.</p><ul><li><strong>Poor hashing is reversible.</strong> Using a weak hashing method like MD5 without a salt is risky. Attackers can exploit large, precomputed hash tables (also known <a href="https://en.m.wikipedia.org/wiki/Rainbow_table">as <em>rainbow tables</em></a>) to reverse-engineer the input.</li><li><strong>Partial masking.</strong> This technique involves replacing part of the input with a default value. While it can be useful, it still poses risks. For instance, partial masking of an email address that leaves the complete username or domain visible.</li><li><strong>Linking unique outliers to external datasets.</strong> If a dataset contains only one individual earning 12 million dollars, cross-referencing public salary records could lead to their identification.</li></ul><h3>Differential Privacy and Other Anonymization Techniques in PySpark</h3><p>Many methods exist to anonymize data. One approach that seeks to balance over-anonymization and insufficient anonymization is <strong>differential privacy</strong>. This statistical framework adds controlled noise to a set of values while preserving their statistical properties, ensuring that the distribution of the data remains relatively unchanged. This is important for analytical purposes.</p><p>To demonstrate the various anonymization techniques we’ll discuss below, we’ll <strong>first generate some data</strong>. We will create a few columns that we can then apply different anonymization techniques to.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f2cfb48ef11c0704e5daa07434e706f/href">https://medium.com/media/6f2cfb48ef11c0704e5daa07434e706f/href</a></iframe><h4>Hashing For Unique and Usable Values</h4><p>In certain situations, <strong>sensitive data must remain unique and usable</strong> after anonymization, especially when you need to join different tables using a common identifier.</p><pre>df.withColumn(&quot;name_anon&quot;, F.sha2(F.col(&quot;name&quot;), 256))</pre><p>In this example, we use the <a href="https://en.wikipedia.org/wiki/SHA-2">SHA256 hash</a>, which offers strong security and a minimal risk of <a href="https://en.wikipedia.org/wiki/Hash_collision">collisions</a>. A collision occurs when two distinct inputs produce the same hash.</p><p>Although SHA256 is inherently secure, we can enhance security further by adding <a href="https://en.wikipedia.org/wiki/Salt_(cryptography)">salt</a> before hashing the input value. Salt is a random string added to the input, making it harder to crack the hash function by eliminating predictable hashes. Since the hash itself should be kept confidential, consider storing it in a secure location, such as <a href="https://azure.microsoft.com/en-us/products/key-vault">Azure Key Vault</a>.</p><pre>df<br>.withColumn(<br>    &quot;name_anon&quot;,<br>    F.sha2(F.concat_ws(F.col(&quot;name&quot;), &quot;&lt;my-secret-hash&gt;&quot;), 256)<br>)<br>.select(&quot;name&quot;, &quot;name_anonymized&quot;)</pre><h4>Partially Masking Direct Identifiers</h4><p>Masking typically means completely hiding or replacing original values with something like REDACTED. In contrast, partial masking involves <strong>obscuring only a portion of the original value</strong>.</p><p>When partially masking direct identifiers (<em>e.g.</em>, email addresses, names, social security numbers), be careful to avoid unintentionally revealing too much information. It’s safer to err on the side of caution. For example, with email addresses, you might display only the first three characters of both the username and the domain name. So instead of johndoe@example.com we would only show joh***@exa***.</p><pre>df<br>.withColumn(&quot;prefix&quot;, F.col(&quot;email&quot;).substr(1, 3))<br>.withColumn(&quot;domain&quot;, F.regexp_extract(F.col(&quot;email&quot;), r&quot;(@\\w{3})&quot;, 1))<br>.withColumn(<br>    &quot;email_anonymized&quot;,<br>    F.concat(<br>        F.col(&quot;prefix&quot;), F.lit(&quot;***&quot;),<br>        F.col(&quot;domain&quot;), F.lit(&quot;***&quot;)<br>    )<br>)<br>.select(&quot;email&quot;, &quot;email_anonymized&quot;)</pre><h4>Bucketing</h4><p><strong>Categorizing values into buckets</strong> is an effective method for preventing data re-identification while preserving usability, as long as the buckets are not overly broad. For instance, when dealing with dates of birth, we can convert them into age groups through bucketing.</p><pre>df<br>.withColumn(&quot;age_group&quot;,<br>    F.when(df.date_of_birth &lt; &quot;1990-01-01&quot;, &quot;30-40&quot;)<br>    .when(df.date_of_birth &lt; &quot;2000-01-01&quot;, &quot;20-30&quot;)<br>    .otherwise(&quot;Under 20&quot;))<br>)<br>.select(&quot;date_of_birth&quot;, &quot;age_group&quot;)</pre><p>However, a drawback of this approach is that the resulting age_group is not the same data type as the original dob column. One is a string while the other is a date. An alternative solution is to truncate the dob column by year or year-month, which helps maintain the correct data type.</p><pre>df<br>.withColumn(&quot;dob_year_month&quot;, F.to_date(F.date_format(F.col(&quot;date_of_birth&quot;), &quot;yyyy-MM&quot;)))<br>.withColumn(&quot;dob_year&quot;, F.to_date(F.year(&quot;date_of_birth&quot;)))<br>.select(&quot;date_of_birth&quot;, &quot;dob_year_month&quot;, &quot;dob_year&quot;)</pre><h4>Adding Laplacian Noise</h4><p>A common application of differential privacy is the <strong>addition of noise to numeric data</strong>, which often follows a Laplace distribution. The example below demonstrates this by adding noise to the salary column. By adjusting the parameters of the Laplace distribution, we can precisely control the extent to which the data is modified.</p><pre>sensitivity = 1000.0<br>epsilon = 1.0<br>b = sensitivity / epsilon<br><br>(<br>    df<br>    .withColumn(<br>        &quot;laplace_noise&quot;,<br>        -b * F.when(F.rand() &lt; 0.5, -1).otherwise(1) * F.log(1 - 2 * F.abs(F.rand() - 0.5))<br>    )<br>    .withColumn(&quot;salary_dp&quot;, (F.col(&quot;salary&quot;) + F.col(&quot;laplace_noise&quot;)).cast(&quot;decimal(10, 2)&quot;))<br>    .select(&quot;salary&quot;, &quot;salary_dp&quot;)<br>)</pre><p>Note that adding noise could also be applied to other data types, as long as they’re ordered. For example, dates could be shifted by adding a random number of days, though in that case the Laplace distribution wouldn’t be appropriate.</p><h4>K-Anonymity</h4><p>In categorical data, rare categories can accidentally expose sensitive information. To address this issue, we can <strong>group infrequently occurring categories into a single category</strong>, such as Other. For example, whenever fewer than K persons fall in a certain category. Hence the name K-anonymity.</p><pre>K = 2<br>job_counts = df.groupBy(&quot;job_title&quot;).count()<br><br>(<br>    df<br>    .join(job_counts, &quot;job_title&quot;)<br>    .withColumn(<br>        &quot;k_anonymized_job_title&quot;,<br>        F.when(<br>            F.col(&quot;count&quot;) &lt;= K, F.lit(&quot;Other&quot;)<br>        ).otherwise(F.col(&quot;job_title&quot;))<br>    )<br>    .select(&quot;job_title&quot;, &quot;k_anonymized_job_title&quot;)<br>)</pre><h4>Flipping a Boolean Indicator</h4><p>Boolean columns are a bit of a strange data type to anonymize, given the binary nature of the data. Techniques like partial masking, bucketing, and hashing are not applicable.</p><p>A common method to introduce noise into a boolean data column is to <strong>flip its values with a certain probability</strong>. This means changing a value from TRUE to FALSE (or vice versa) for a subset of the entries. In the example below, we flip the is_active boolean value in 10% of the cases.</p><pre>flip_probability = 0.1<br><br>(<br>    df<br>    .withColumn(&quot;flip_probability&quot;, F.rand())<br>    .withColumn(<br>        &quot;is_active_with_noise&quot;,<br>        F.when(F.rand() &lt; flip_probability, ~F.col(&quot;is_active&quot;))<br>        .otherwise(F.col(&quot;is_active&quot;))<br>    )<br>    .select(&quot;is_active&quot;, &quot;is_active_with_noise&quot;)<br>)</pre><h3>Summary and Closing Thoughts</h3><p>Data anonymization requires a careful balance between safeguarding individual privacy and maintaining data utility. In this article, we explored various anonymization techniques, including hashing and the addition of Laplacian noise.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ee334174923feca9ba9a3704abc1905/href">https://medium.com/media/0ee334174923feca9ba9a3704abc1905/href</a></iframe><p>Although there are best practices and general guidelines to follow, it is important to select the most appropriate approach for your specific context. This involves considering both the type of data and the level of risk you are prepared to accept to ensure the usability of the anonymized data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e78ec26ca85" width="1" height="1" alt=""><hr><p><a href="https://medium.com/towards-data-engineering/a-practical-guide-to-data-anonymization-with-pyspark-8e78ec26ca85">A Practical Guide To Data Anonymization With PySpark</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[Unit Testing PySpark Using Databricks Connect]]></title>
            <link>https://blog.revodata.nl/unit-testing-pyspark-using-databricks-connect-96353ac0ddc9?source=rss-167382922f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/96353ac0ddc9</guid>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[databricks-asset-bundles]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[René Luijk]]></dc:creator>
            <pubDate>Tue, 01 Apr 2025 15:15:31 GMT</pubDate>
            <atom:updated>2025-06-17T16:39:59.154Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Databricks Connect and serverless for automated unit testing</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lz9kVR6OkBIuMy_e" /><figcaption>Photo by <a href="https://unsplash.com/@testalizeme?utm_source=medium&amp;utm_medium=referral">Testalize.me</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Databricks notebooks often receive criticism (or are <a href="https://dataengineeringcentral.substack.com/p/the-rise-of-the-notebook-engineer">outright bashed</a>), though there are also some <a href="https://medium.com/dbsql-sme-engineering/using-databricks-notebooks-for-production-data-pipelines-3092e5dde2c0">constructive perspectives</a> on this topic. One of the most common critiques is that they enable and encourage poor software development practices. A notable example of this is the lack of <a href="https://en.wikipedia.org/wiki/Unit_testing">unit tests</a> for Python or PySpark code, which is essential for creating reliable and maintainable software.</p><p>This issue is compounded by confusion among Databricks users regarding how and where to run unit tests, as well as how unit tests integrate into a CI/CD pipeline.</p><p>In this post, we will outline one effective approach to unit testing. This method allows users to develop code in their preferred IDE while leveraging Databricks to execute their unit tests — both during development and within their CI/CD pipeline. To implement this, we will utilize a combination of:</p><ul><li><a href="https://docs.databricks.com/aws/en/dev-tools/bundles">Databricks Asset Bundles</a> for project management,</li><li><a href="https://docs.databricks.com/aws/en/dev-tools/databricks-connect/python">Databricks Connect</a> to connect to compute. This can be <a href="https://docs.databricks.com/en/compute/serverless/index.html">serverless</a> or <a href="https://docs.databricks.com/aws/en/compute/use-compute">job compute</a>.</li><li>The testing framework pytest for the execution of unit tests,</li><li>and <a href="https://github.com/features/actions">GitHub Actions</a> for managing the CI/CD pipeline.</li></ul><p><em>All code used in this post is available in this </em><a href="https://github.com/revodatanl/revodata-blogs-unit-testing-pyspark"><em>GitHub repository</em></a><em>. To get started, follow the </em>README<em> in the repos to set up the right environment locally and run the unit tests.</em></p><h3><strong>Setting Up A Development Environment Using Databricks Connect</strong></h3><p>Although the Databricks web UI has seen significant improvements recently, we still prefer using <a href="https://code.visualstudio.com/">VSCode</a> for local development. With the recent enablement of serverless computing for Databricks Connect, the development experience has become much smoother, which is why we’re proposing this approach.</p><p>To configure Databricks for Databricks Connect, we first need to install and set up the Databricks CLI. A tutorial on how to do this can be found <a href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/cli/tutorial">here</a>.</p><p>In the .databrickscfg file, we have configured a default connection that automatically utilizes serverless compute by setting the serverless_compute_id field to auto.</p><pre>[DEFAULT]<br>host = &lt;my-host&gt;<br>token = &lt;my-token&gt;<br>serverless_compute_id = auto</pre><p>Next, we will define a simple function that filters a DataFrame using PySpark.</p><pre>def filter_active_users(df: DataFrame) -&gt; DataFrame:<br>    return df.filter(col(&quot;status&quot;) == &quot;active&quot;)</pre><p>To test this function with the pytest framework, we will create a separate file in the tests folder. This file will use Databricks Connect to create a Spark session and to create a small DataFrame to test the function.</p><pre>import pytest<br>from databricks.connect import DatabricksSession<br>from pyspark.sql import SparkSession<br>from unit_testing_pyspark.transformations import filter_active_users<br><br># Fixture to create a Spark session using Databricks Connect<br>@pytest.fixture(scope=&quot;session&quot;)<br>def spark() -&gt; SparkSession:<br>    return DatabricksSession.builder.getOrCreate()<br><br># Test function to verify the filter_active_users function<br>def test_filter_active_users(spark):<br>    user_data = [(1, &quot;active&quot;), (2, &quot;deactivated&quot;)]<br>    df = spark.createDataFrame(user_data, [&quot;id&quot;, &quot;status&quot;])<br>    result = filter_active_users(df).collect()<br>    assert len(result) == 1<br>    assert result[0][&quot;id&quot;] == 1</pre><h3><strong>Project Structure Using Databricks Asset Bundles</strong></h3><p>To structure the project and facilitate easy deployments, we use <a href="https://docs.databricks.com/aws/en/dev-tools/bundles/">Databricks Asset Bundles</a> (DABs). We specifically use a DAB template that includes additional boilerplate code, developed by RevoData (find us on <a href="https://www.linkedin.com/company/revodata/">LinkedIn</a> — we’re hiring 😉). It is freely available for you to use — check it out <a href="https://github.com/revodatanl/revo-asset-bundle-templates">here</a>.</p><p>This DAB provides us with the following directory structure (excluding a few irrelevant folders for clarity):</p><pre>unit-testing-pyspark/<br>├── src/<br>│   └── unit_testing_pyspark/<br>│       └── transformations.py<br>...<br>│<br>├── tests/<br>│   └── test_transformations.py<br>├── notebooks/<br>│   └── run_unit_tests.py<br>├── resources/<br>│   └── unit_tests_job.yml<br>├── databricks.yml<br>└── Makefile</pre><p>The project contains several key folders:</p><ul><li>src: contains the PySpark code.</li><li>tests: contains unit tests for the code in `src`.</li><li>notebooks: houses a notebook that invokes pytest to run the unit tests — used in an optional job.</li><li>resources: defines the job that will run the unit tests on Databricks.</li><li>databricks.yml: specifies the environments used; this project will only utilize a development workspace.</li><li>Makefile: contains simple commands for common tasks, such as deploying to the development environment and running unit tests. For more information on Makefiles, see <a href="https://opensource.com/article/18/8/what-how-makefile">this overview</a>.</li></ul><p>With the code in place, we can execute the unit tests by running a specific command on our local machine. This method is particularly useful during development, as it allows us to quickly and repeatedly check the code. To run the tests, we invoke pytest. Keep in mind that although we execute this command locally, we will still utilize a serverless cluster on Databricks, as configured under the DEFAULT profile in the .databrickscfg file.</p><p>Additionally, the Makefile included in this DAB template provides a more convenient command for running the tests: make test. Executing this command should produce the following report:</p><pre>tests/test_transformations.py .                            [100%]<br>------- coverage: platform darwin, python 3.11.11-final-0 -------<br>Name                                          Stmts   Miss  Cover<br>-----------------------------------------------------------------<br>src/unit_testing_pyspark/__init__.py              0      0   100%<br>src/unit_testing_pyspark/transformations.py       4      0   100%<br>-----------------------------------------------------------------<br>TOTAL                                             4      0   100%</pre><h3><strong>Automated Unit Testing In CI/CD Pipelines</strong></h3><p>While having the ability to run tests locally is useful, it is even more powerful when integrated into a CI/CD pipeline. This ensures that every change to the codebase is automatically tested, helping to catch issues early and maintain code quality. Essentially, this approach is similar to the local testing method. We will set up a CI/CD pipeline to automate the execution of unit tests triggered by events on GitHub, such as creating a pull request. To do this, we will utilize GitHub Actions to define a simple pipeline (see run_unit_tests.yml).</p><p>However, on GitHub, we do not have access to the `.databrickscfg` file, which contains essential settings like the Databricks host and token. Therefore, we need to establish an environment within the pipeline.</p><p>The example below uses a <a href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/pat">Personal Access Token</a> (PAT), which is acceptable for the current purpose. However, for production purposes it is highly advisable to use a service principal with OAuth. Please refer to the <a href="https://learn.microsoft.com/en-us/azure/databricks/dev-tools/auth/oauth-m2m">official documentation</a> for how to set this up.</p><pre>env:<br>    DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}<br>    DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}<br>    DATABRICKS_SERVERLESS_COMPUTE_ID: auto</pre><p>Please note that we access secrets that <a href="https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions">we have stored in the GitHub repository</a>, which we reference here to populate the env section of the CI/CD pipeline. This is done using the ${{ secrets.MY_SECRET }} notation. Now, when we create a pull request, the unit tests run successfully using a serverless cluster on Databricks!</p><h3><strong>Resources</strong></h3><ul><li><a href="https://docs.databricks.com/en/notebooks/best-practices.html">Software engineering best practices for notebooks</a></li><li><a href="https://docs.databricks.com/en/notebooks/testing.html">Unit testing for notebooks</a></li><li><a href="https://docs.databricks.com/en/dev-tools/ci-cd/ci-cd-github.html">Continuous integration and delivery using GitHub Actions</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96353ac0ddc9" width="1" height="1" alt=""><hr><p><a href="https://blog.revodata.nl/unit-testing-pyspark-using-databricks-connect-96353ac0ddc9">Unit Testing PySpark Using Databricks Connect</a> was originally published in <a href="https://blog.revodata.nl/">revodata</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>