<?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 Sandesh Kumar on Medium]]></title>
        <description><![CDATA[Stories by Sandesh Kumar on Medium]]></description>
        <link>https://medium.com/@sandesh.kumar?source=rss-990d67c50d20------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cB0FAJt5QMVWrbJ8_WDurA.jpeg</url>
            <title>Stories by Sandesh Kumar on Medium</title>
            <link>https://medium.com/@sandesh.kumar?source=rss-990d67c50d20------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:45:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandesh.kumar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Data Build Tool (DBT): SQL on Steroids]]></title>
            <link>https://tech.bolt.com/data-build-tool-dbt-sql-on-steroids-f4e4622e3ce8?source=rss-990d67c50d20------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4e4622e3ce8</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[dbt]]></category>
            <dc:creator><![CDATA[Sandesh Kumar]]></dc:creator>
            <pubDate>Wed, 02 Mar 2022 21:02:15 GMT</pubDate>
            <atom:updated>2022-03-02T21:02:15.397Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pre-DBT World</h3><p>Since the inception of analytics at Bolt, our tech stack has consisted of <a href="https://aws.amazon.com/quicksight/">AWS Quicksight</a> for our dashboards and <a href="https://aws.amazon.com/pm/redshift/?trk=9afe6d50-880f-4406-b73d-581c81995108&amp;sc_channel=ps&amp;sc_campaign=acquisition&amp;sc_medium=ACQ-P%7CPS-GO%7CBrand%7CDesktop%7CSU%7CAnalytics%7CRedshift%7CCA%7CEN%7CText%7Cxx%7CSEM&amp;s_kwcid=AL!4422!3!525873052690!e!!g!!aws%20redshift&amp;ef_id=Cj0KCQiAjc2QBhDgARIsAMc3SqR4d2qHgfZ6RmdCGAF-HlJRHaI1354499h0MVSWTuavsW90A3dQwaQaAusCEALw_wcB:G:s&amp;s_kwcid=AL!4422!3!525873052690!e!!g!!aws%20redshift">AWS Redshift</a> for our data warehouse and datasets.</p><blockquote>In late 2020, we started building our first analytics dashboards for our merchants so they could gain insight into shopper behaviors and benchmark their performance.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1x311PUaZCa09ix8T-2fw.png" /><figcaption>Sample Dashboard for our merchant: Ergonomics #1</figcaption></figure><p>Initially, we built these dashboards in Quicksight, powered by complex SQL queries built on top of our Redshift data warehouse. We only had a couple of dashboards and although this approach was painful, it worked. We remained focused on building analytical insights and decided to put off refinement for later.</p><p>Bolt’s merchants kept on growing and so did their demand for richer analytical insights. This meant we needed to support a lot more dashboards and analysis all based on top of some really gnarly looking custom SQLs.</p><blockquote>It was getting pretty difficult to maintain, audit, and debug the dashboards.</blockquote><p>Moving these queries to source control allowed us to audit any changes made to our base datasets and make sure changes were approved by multiple domain owners before implementing them. We extracted out some standardized wide row views and made them our “core” models on top of which we based most of our other “reporting” models. As you can imagine, we had to build out the entire deployment pipeline for these models and ensure the data was always fresh.</p><figure><img alt="Different model layers" src="https://cdn-images-1.medium.com/max/1024/1*mTdsrZmRpyF0MGA6ewohSQ.png" /><figcaption>Different model layers</figcaption></figure><p>But, we soon realized that even this solution was not scalable because:</p><ul><li>Only a few engineers knew about the models and the end-to-end data pipeline so deployment was always bottlenecked on them</li><li>There wasn’t great documentation and our models kept changing</li><li>The interdependencies between models started to become even more convoluted and it became a challenge to keep track of everything</li></ul><figure><img alt="Sample manual lineage" src="https://cdn-images-1.medium.com/max/1024/1*TwLfSaxmXadKiBQqNrl5_A.png" /><figcaption>Manually maintained sample lineage mapping</figcaption></figure><p>We started looking into potential options and found: <a href="https://www.stephenlevin.co/data-modeling-layer-startup-analytics-dbt-vs-matillion-vs-lookml/">LookerML, Matillion, DBT, and more</a>. And like many others before us, after carefully considering the pros and cons based on our needs, we decided to go with <a href="https://www.getdbt.com/">DBT</a> to help solve these issues.</p><h3>Enter DBT</h3><h4>What is DBT?</h4><p>For those of you who like me (at least till Aug ’21) haven’t heard of DBT, here’s a quick primer:</p><p>According to their <a href="https://blog.getdbt.com/what-exactly-is-dbt/">docs</a>:</p><blockquote>dbt does the T in ELT (Extract, Load, Transform) processes — it doesn’t extract or load data, but it’s extremely good at transforming data that’s already loaded into your warehouse.</blockquote><figure><img alt="DBT Architecture" src="https://cdn-images-1.medium.com/max/1024/1*ZbCvqe8egCx4i39sd_ETDg.png" /><figcaption>DBT Architecture [Source: <a href="https://github.com/fishtown-analytics/dbt">GitHub/dbt-labs</a>]</figcaption></figure><p>In layman&#39;s terms, DBT enables data analysts and engineers to write data transformation queries in a modular manner without having to maintain the execution order manually. It compiles all code into raw SQL queries that run against your data warehouse to use existing computing resources.</p><p>It also understands dependencies within your queries and runs them in the correct order. DBT code is a combination of SQL and <a href="https://jinja.palletsprojects.com/en/3.0.x/">Jinja</a>; therefore, you can express logic such as conditional statements, loops, filters, and macros in your queries.</p><h4>Impact at Bolt</h4><p>At Bolt, we started using DBT in early Oct ’21 to build out some models in our staging environment. And we haven’t looked back since. Let me give you a brief highlight of some of the noteworthy features of DBT we are currently using.</p><p><strong>1. Modularization<br></strong>– Separate models with a consistent dataset mapping<br>– Split big queries into smaller reusable <em>intermediate</em> queries across layer 2 models<br>– Use <em>Jinja</em> to make SQL feel like a normal programming language</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2c1414cf9ab87a790280de8ffdcf32a/href">https://medium.com/media/f2c1414cf9ab87a790280de8ffdcf32a/href</a></iframe><blockquote>Macros are like functions — you can abstract commonly used snippets of SQL which can be reused anywhere.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/640e0c059b6dfd824fc1155f80272bd1/href">https://medium.com/media/640e0c059b6dfd824fc1155f80272bd1/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a151df1118d430be0bc2e7f3166785d/href">https://medium.com/media/2a151df1118d430be0bc2e7f3166785d/href</a></iframe><p><strong>2. Testing</strong><br>– Monitor source data<em> freshness </em>or<em> liveness</em><br>– Detect data quality issues<br>– Unit test specific table columns<br>– Show relative percentage of missing null or non-null values (helps while backfilling)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29cd7321a01626f30aa009803c74603b/href">https://medium.com/media/29cd7321a01626f30aa009803c74603b/href</a></iframe><p><strong>3. Documentation<br></strong>– Auto-generate docs hosted as a static website based on simple YAML annotations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*EHtcdo7-yh-F_2SSGHUTQA.gif" /><figcaption>Generate docs: dbt docs generate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DVFYnmaAeAiXlG65x8gTyw.gif" /><figcaption>Serve docs: dbt docs serve</figcaption></figure><p>– Provide clear visualization of dependencies from the source all the way to the reporting models through a lineage graph<br><strong><em>Pro tip</em></strong>: DBT even integrates with the table descriptions in your actual DB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*yzhIdlKcpolFpvO-gHbg4A.gif" /><figcaption>Create models: dbt run</figcaption></figure><p>– Unify our vocabulary through a single source of truth</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*FglOkxsalrmKRoEcYMo5Ow.png" /><figcaption>Data Analysts + SWE ❤ DBT</figcaption></figure><p><strong>4. Automate CI/CD<br></strong>– Handle dependency management right off the bat, making deployments a piece of 🍰<br>– Run DBT as a docker container in our CI and upon passing tests and checks, changes get automatically deployed from staging all the way to production (including updated documentation)<br>– Slim CI (only deploy new/modified models) — reducing build times ⌛, saving money 🤑</p><h3>Rollout</h3><h4><strong>Production</strong></h4><p>We wanted to release this before our holiday code freeze, and this required us to be extra careful with our production rollout. Some of our success criteria were:</p><ul><li>Design continuity</li><li>Data consistency</li><li>Security &amp; permission consistency</li><li>Zero downtime</li><li>Usage continuity</li></ul><figure><img alt="Production rollout steps" src="https://cdn-images-1.medium.com/max/1024/1*jjwm30u6cSdB2lxvDrBIGw.png" /><figcaption>Production rollout steps</figcaption></figure><p>Previously, we didn’t support multi environments as it was pretty tedious and manual. But, with DBT we were able to create and maintain multiple environments. We have a pre-prod environment for our datasets where we test and validate our changes to make sure there are no data quality issues.</p><p>And, once we are happy with the results we just switch the production dashboards to use our new pre-prod datasets. This allows us to add an extra level of abstraction and safety to our deployments all the while being a smooth zero downtime operation.</p><h4><strong>Developer</strong></h4><p>When we started this effort we wanted to ensure we enhanced developer productivity. Although there is a bit of a learning curve from plain old SQL, we created comprehensive onboarding docs ready to be used by anyone across the company. Today, all our analytic views, internal and external facing, are stored as part of DBT.</p><figure><img alt="Development deployment pipeline" src="https://cdn-images-1.medium.com/max/1024/1*YXVwB9BBEZuLK_HsMiHRGA.png" /><figcaption>Development workflow</figcaption></figure><h3>Final Thoughts</h3><p>We have been using DBT now for the past quarter or so in production and couldn’t be happier.</p><ul><li><strong>DBT allowed us to migrate data warehouses seamlessly <br></strong>If you have been paying attention you might have noticed this in the figures throughout this post; we recently migrated over from Redshift to Bigquery as our choice of Data warehouse and DBT helped us with the transition.</li><li><strong>DBT helps us have full confidence in our analytics data models<br></strong>If we have an issue with a component of our data pipeline, we are able to redeploy all our models and are confident that nothing will break.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*IR98p89aCkR5Ysou4vQlYQ.png" /><figcaption>Redeploy all models with our eyes closed</figcaption></figure><p>We have also been working on some advanced DBT features which I will save for the next post. If you liked this and would like to be notified as soon as we publish, hit that follow button!</p><p>This effort was a result of collaboration between many amazing folks on the data platforms team and if you like working with data and solving these kinds of fun data challenges. We are hiring on the data platforms team, so DM me on <a href="https://ca.linkedin.com/in/imsandeshkumar">LinkedIn</a> or you can check out our <a href="https://www.bolt.com/careers/">careers page</a> for more amazing opportunities across multiple teams! 🚀</p><blockquote>And in the end, all I want to leave you with is just one thing — If you aren’t using DBT for SQL, then my friend…</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*XhvXEofWqxyhWQbecWzp0w.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4e4622e3ce8" width="1" height="1" alt=""><hr><p><a href="https://tech.bolt.com/data-build-tool-dbt-sql-on-steroids-f4e4622e3ce8">Data Build Tool (DBT): SQL on Steroids</a> was originally published in <a href="https://tech.bolt.com/">Tech @ Bolt</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>