<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Andrea Leonel - Data Analysis & Analytics Engineering: Mastering dbt]]></title><description><![CDATA[Finding the encouragement to study for a certification on your own can be tricky. Seeing the lack of a comprehensive study guide for the dbt certification, I decided to create my own.]]></description><link>https://andrealeonel.substack.com/s/dbt-analytics-engineering-study-guide</link><image><url>https://substackcdn.com/image/fetch/$s_!TwlV!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png</url><title>Andrea Leonel - Data Analysis &amp; Analytics Engineering: Mastering dbt</title><link>https://andrealeonel.substack.com/s/dbt-analytics-engineering-study-guide</link></image><generator>Substack</generator><lastBuildDate>Fri, 17 Apr 2026 05:25:08 GMT</lastBuildDate><atom:link href="https://andrealeonel.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Andrea Leonel]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[andrealeonel@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[andrealeonel@substack.com]]></itunes:email><itunes:name><![CDATA[Andrea Leonel]]></itunes:name></itunes:owner><itunes:author><![CDATA[Andrea Leonel]]></itunes:author><googleplay:owner><![CDATA[andrealeonel@substack.com]]></googleplay:owner><googleplay:email><![CDATA[andrealeonel@substack.com]]></googleplay:email><googleplay:author><![CDATA[Andrea Leonel]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Leveraging the state method]]></title><description><![CDATA[Understanding how to use the state method and customise it to your project's needs]]></description><link>https://andrealeonel.substack.com/p/leveraging-the-state-method</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/leveraging-the-state-method</guid><pubDate>Mon, 13 Apr 2026 00:21:28 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/147e568b-2d16-4754-824f-44810a92f145_994x232.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">Mastering dbt</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/reference/node-selection/methods?version=1.10#state">state method</a> documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>As dbt projects scale, running the entire DAG for every change quickly becomes inefficient&#8212;both in time and compute cost. To solve this, dbt offers state-based selection, which enables you to compare your current project against a previous state and run only the resources that have changed.</p><p>In order to attain this, it uses the manifest.json file and the <em>--state </em>method. Learn exactly how this works and how to customise state-based selection to your needs. </p><div><hr></div><h3>The manifest file</h3><p>After executing a dbt command, a manifest.json file is created in the project&#8217;s target directory. Even if you&#8217;re only running specific nodes of the project, this file will contain a full description of your project&#8217;s resources and configurations. </p><p>The manifest file is used for analysing the project&#8217;s health, compiling the docs site, and allowing state comparison.</p><p>It&#8217;s important to remember that with every parsing, dbt overwrites the manifest file in the target directory. Therefore, you should never compare a project&#8217;s state to the target manifest, as it leads to incorrect or unreliable results (e.g., no changes detected or warnings about a missing manifest).</p><p>Instead, you can store artifacts from a previous run in a separate folder and use that path for state comparison.</p><div><hr></div><h3>State comparison</h3><p>The state method enables you to select nodes according to a comparison with previous versions of the project.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!23k0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!23k0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 424w, https://substackcdn.com/image/fetch/$s_!23k0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 848w, https://substackcdn.com/image/fetch/$s_!23k0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 1272w, https://substackcdn.com/image/fetch/$s_!23k0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!23k0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png" width="1006" height="229" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:229,&quot;width&quot;:1006,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50127,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/194016103?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!23k0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 424w, https://substackcdn.com/image/fetch/$s_!23k0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 848w, https://substackcdn.com/image/fetch/$s_!23k0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 1272w, https://substackcdn.com/image/fetch/$s_!23k0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02aee65d-41c8-4040-b053-fb8067b23a5b_1006x229.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Usage of the state method. Source: <a href="https://docs.getdbt.com/reference/node-selection/methods?version=1.10#state">state node selector method</a></figcaption></figure></div><p>The commands above are using <em>state:new </em>and <em>state:modified</em>, and dbt offers another two states.</p><ul><li><p><em>state:new </em>will only select new nodes, that is, nodes whose unique_id are not already included in the comparison manifest. Bear in mind that a test is a resource, so new tests in existing models will also be selected.</p></li><li><p><em>state:old </em>is the opposite of new, that is, it will select nodes that already exist in the manifest.</p></li><li><p><em>state:modified</em> selects existing models that have been modified.</p></li><li><p><em>state: unmodified</em> is the opposite of modified and runs all nodes that had no changes.</p></li></ul><div><hr></div><h3>Deep-dive into state:modified</h3><p>Due to the complexity and diversity of dbt projects, there are aspects to consider when using <em>state:modified </em>to ensure it meets your specific needs.</p><h4>Additional subselectors:</h4><p>You can specify which aspect of the node needs to be compared against the manifest using the following subselectors:</p><ul><li><p>state:modified.body &#8594; changes to the node&#8217;s body like in a SQL model or seed values.</p></li><li><p>state:modified.configs &#8594; selects resources whose configs have changed since the last manifest. These changes don&#8217;t include database, schema, and alias.</p></li><li><p>state:modified.relation &#8594; changes to database, schema, and alias.</p></li><li><p>state:modified.persisted_descriptions &#8594; changes to descriptions, but must have <em>persist_docs </em>enabled at each level.</p></li><li><p>state:modified.macros &#8594; changes to upstream macros called directly or indirectly.</p></li><li><p>state:modified.contract &#8594; resources whose contract has changed. In the case of breaking changes, an error will be thrown.</p></li></ul><p>If no subselectors are used, dbt will enforce all of the above, plus other resource-specific criteria such as freshness, quoting, and maturity.</p><h4>Impact of group changes:</h4><p>While running on <em>state:modified,</em> dbt will track node-level config changes, including group definitions, access permissions, deprecation dates, and latest_version.</p><p>If a <em>group </em>definition changes, the models affected will be caught under the <em>state:modified </em>selection. However, as the <em>group</em> configuration can be used to control resource access, this may cause breakage downstream.</p><p>Even if you update the group everywhere, dbt still flags these nodes as modified, and any resulting access or reference issues are detected during parsing or execution.</p><p><strong>Attention to partial parsing:</strong> with partial parsing enabled, dbt may not immediately detect downstream reference issues during parsing, but they will surface during execution (especially if downstream nodes are included in the run).</p><h4>The &#8220;nothing to do&#8221; error and selecting downstream resources:</h4><p>This error is thrown when dbt flags a node as modified, but nothing needs to be run (for instance, in the case of metadata-only changes).</p><p>The run will be successful, but things may still break downstream. That is why it is recommended to include downstream models using <em>state:modified+.</em></p><h4>Seed files behaviour:</h4><p>State comparison differs for seed files according to their size:</p><ul><li><p>Small seeds (&lt; 1 Mib): included only when the contents change,</p></li><li><p>Large seeds (&gt;= 1 Mib): included only when the seed file path changes.</p></li></ul>]]></content:encoded></item><item><title><![CDATA[Test command and handling dependencies]]></title><description><![CDATA[Building your tests and defining which dependencies will also be tested.]]></description><link>https://andrealeonel.substack.com/p/test-command-and-handling-dependencies</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/test-command-and-handling-dependencies</guid><pubDate>Sat, 21 Mar 2026 19:53:33 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!RMU-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">Mastering dbt</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/reference/commands/test?version=1.10">test command </a>and <a href="https://docs.getdbt.com/reference/node-selection/test-selection-examples?version=1.10">test selection </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>In our last post dedicated to data tests, we are going to cover the test command and how to define how dbt handles tests in dependencies.</p><div><hr></div><h3>The dbt test command</h3><p>Once tests were declared and configured, you need to run <em>dbt test </em>to apply them and identify potentially failing records.</p><p>You can use the <em>--select</em> flag to run specific tests according to their type (data, unit, generic, or singular) and/or the model name.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LszK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LszK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 424w, https://substackcdn.com/image/fetch/$s_!LszK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 848w, https://substackcdn.com/image/fetch/$s_!LszK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 1272w, https://substackcdn.com/image/fetch/$s_!LszK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LszK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png" width="918" height="805" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:805,&quot;width&quot;:918,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:115484,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/191696934?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LszK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 424w, https://substackcdn.com/image/fetch/$s_!LszK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 848w, https://substackcdn.com/image/fetch/$s_!LszK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 1272w, https://substackcdn.com/image/fetch/$s_!LszK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F194ee66a-b887-4e86-9870-ce71265e2dd9_918x805.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/commands/test?version=1.10">test command</a></figcaption></figure></div><div><hr></div><h3>Defining how dbt tests dependencies</h3><p>Unlike other resources, tests upstream or downstream can be selected indirectly. You can use modes to choose how dbt handles tests in other models.</p><h4>Eager mode (default)</h4><p>This is the most inclusive option and the default mode. Which tests will be built?</p><ul><li><p>Tests referencing the selected nodes as well as those of their upstream AND downstream models, even if they don&#8217;t directly reference the selected nodes.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RMU-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RMU-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 424w, https://substackcdn.com/image/fetch/$s_!RMU-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 848w, https://substackcdn.com/image/fetch/$s_!RMU-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 1272w, https://substackcdn.com/image/fetch/$s_!RMU-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RMU-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png" width="745" height="487" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:487,&quot;width&quot;:745,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52446,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/191696934?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RMU-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 424w, https://substackcdn.com/image/fetch/$s_!RMU-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 848w, https://substackcdn.com/image/fetch/$s_!RMU-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 1272w, https://substackcdn.com/image/fetch/$s_!RMU-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a2b3b1e-e036-4be7-ac98-4a020231bfd1_745x487.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source:<a href="https://docs.getdbt.com/reference/node-selection/test-selection-examples?version=1.10#indirect-selection-examples"> indirect selection examples</a></figcaption></figure></div><h4>Cautious mode</h4><p>This is the most exclusive option. The tests that are built are:</p><ul><li><p>Only the tests that exclusively reference the selected nodes.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TRY2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TRY2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 424w, https://substackcdn.com/image/fetch/$s_!TRY2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 848w, https://substackcdn.com/image/fetch/$s_!TRY2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 1272w, https://substackcdn.com/image/fetch/$s_!TRY2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TRY2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png" width="747" height="484" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/adda84da-a532-4dfd-90da-fc50acde413d_747x484.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:484,&quot;width&quot;:747,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52831,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/191696934?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TRY2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 424w, https://substackcdn.com/image/fetch/$s_!TRY2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 848w, https://substackcdn.com/image/fetch/$s_!TRY2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 1272w, https://substackcdn.com/image/fetch/$s_!TRY2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fadda84da-a532-4dfd-90da-fc50acde413d_747x484.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source:<a href="https://docs.getdbt.com/reference/node-selection/test-selection-examples?version=1.10#indirect-selection-examples"> indirect selection</a></figcaption></figure></div><h4>Buildable mode</h4><p>This is a middle ground between Eager and Caution. Useful if you want to build a subset of your DAG without running into failures caused by unbuilt nodes in Eager mode. Includes the following:</p><ul><li><p>Tests that reference the current node as well as those of its ancestors, even if they don&#8217;t reference the selected nodes.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Nzc3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nzc3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 424w, https://substackcdn.com/image/fetch/$s_!Nzc3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 848w, https://substackcdn.com/image/fetch/$s_!Nzc3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 1272w, https://substackcdn.com/image/fetch/$s_!Nzc3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Nzc3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png" width="750" height="487" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:487,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:51705,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/191696934?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Nzc3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 424w, https://substackcdn.com/image/fetch/$s_!Nzc3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 848w, https://substackcdn.com/image/fetch/$s_!Nzc3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 1272w, https://substackcdn.com/image/fetch/$s_!Nzc3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F63f1d811-8310-44f5-a6f8-521f4ebe2da0_750x487.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/node-selection/test-selection-examples?version=1.10#indirect-selection-examples">indirect selection</a></figcaption></figure></div><h4>Empty mode</h4><p>Ignores all tests.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QhxK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QhxK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 424w, https://substackcdn.com/image/fetch/$s_!QhxK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 848w, https://substackcdn.com/image/fetch/$s_!QhxK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 1272w, https://substackcdn.com/image/fetch/$s_!QhxK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QhxK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png" width="748" height="486" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8faca2e2-b098-417d-b923-8395d7927368_748x486.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:486,&quot;width&quot;:748,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49858,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/191696934?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QhxK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 424w, https://substackcdn.com/image/fetch/$s_!QhxK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 848w, https://substackcdn.com/image/fetch/$s_!QhxK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 1272w, https://substackcdn.com/image/fetch/$s_!QhxK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8faca2e2-b098-417d-b923-8395d7927368_748x486.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/node-selection/test-selection-examples?version=1.10&amp;indirect-selection-mode=empty#indirect-selection-examples">indirect selection</a></figcaption></figure></div>]]></content:encoded></item><item><title><![CDATA[Data Test Configurations]]></title><description><![CDATA[Configuring your data tests and customising their behaviour.]]></description><link>https://andrealeonel.substack.com/p/data-test-configurations</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/data-test-configurations</guid><pubDate>Mon, 09 Mar 2026 13:43:31 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!dBr_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">Mastering dbt</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/reference/data-test-configs">Data test configurations</a><a href="https://docs.getdbt.com/reference/resource-properties/data-tests"> </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Let&#8217;s cover the possibilities around configuring your tests and deep-dive into customisation options to handle large datasets and set default paths for stored failures.</p><div><hr></div><h3>Where to define data test configurations</h3><p>Data tests can be configured in:</p><ol><li><p>under the <em>config:</em> method nested inside properties - this is for generic tests only.</p></li><li><p>inside a <em>config() </em>block within the test&#8217;s SQL definition.</p></li><li><p>in the dbt_project.yml file.</p></li></ol><p>The config inside the dbt_project.yml file is always the last precedence, however the hierarchy differs for singular and generic tests:</p><ul><li><p>Generic tests: (1) takes precedence over (2)</p></li><li><p>Singular test: (2) takes precedence over (1)</p></li></ul><div><hr></div><h3>Resource-specific configurations</h3><p>The following configs are available specifically for data tests:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dBr_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dBr_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 424w, https://substackcdn.com/image/fetch/$s_!dBr_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 848w, https://substackcdn.com/image/fetch/$s_!dBr_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 1272w, https://substackcdn.com/image/fetch/$s_!dBr_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dBr_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png" width="894" height="339" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:339,&quot;width&quot;:894,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54084,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dBr_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 424w, https://substackcdn.com/image/fetch/$s_!dBr_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 848w, https://substackcdn.com/image/fetch/$s_!dBr_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 1272w, https://substackcdn.com/image/fetch/$s_!dBr_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ae97463-ece8-4255-a546-4c3b4d3b385b_894x339.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Data tests configs set up under properties in a .yml file. Source: <a href="https://docs.getdbt.com/reference/data-test-configs">Data Tests Configurations</a></figcaption></figure></div><p>Let&#8217;s define each one of these configs:</p><h4>fail_calc:</h4><p>All tests return the set of records that fail the assertion. By default, dbt returns the count(*) of records.</p><p>This config allows you to change this calculation. For instance, for a test that checks for duplicate records, you can set <em>fail_calc</em> to "case when count(*) &gt; 0 then sum(n_records) else 0 end".</p><p>If this calculation returns an error, like a data type error, the test won&#8217;t pass or fail, but it will return an error.</p><h4>limit:</h4><p>Limit the number of failures returned, specifically useful for large datasets and when failures are being stored in the database.</p><p>Example: &#8220;limit: 1000&#8221;</p><h4>severity, error_if, warn_if:</h4><p>By default, when even a single record fails the assertion, the tests will produce errors and prevent the model from running. This config allows you to add some leniency to your tests.</p><p>When you set up the <em>severity: </em>config to <em>error,</em> dbt will look for the <em>error_if</em> and <em>warn_if</em> configs, which will set up the conditions to bring an error or a warning:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xF9y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xF9y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 424w, https://substackcdn.com/image/fetch/$s_!xF9y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 848w, https://substackcdn.com/image/fetch/$s_!xF9y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 1272w, https://substackcdn.com/image/fetch/$s_!xF9y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xF9y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png" width="901" height="294" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:294,&quot;width&quot;:901,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19513,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xF9y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 424w, https://substackcdn.com/image/fetch/$s_!xF9y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 848w, https://substackcdn.com/image/fetch/$s_!xF9y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 1272w, https://substackcdn.com/image/fetch/$s_!xF9y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F66efcd7c-c1c8-4db0-8975-a96b9a985922_901x294.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">This config tells dbt to warn if the number of failed records is between 11 and 999 and to error if it&#8217;s above 1000. Source: <a href="https://docs.getdbt.com/reference/resource-configs/severity">Severity</a></figcaption></figure></div><p>If <em>severity: </em>is set to <em>warn, </em>then dbt skips the <em>error_if </em>config and only considers <em>warn_if. </em>As with warnings of any nature, dbt will not fail the run, but you can promote warnings to errors using the <em>--warn-error</em> flag when running the models.</p><h4>store_failures:</h4><p>Optionally set a test to always or never store failures in the database. By default, the failed results will be stored in a schema named _<em>dbt_test__audit</em>, but this can be customised.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nPBS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nPBS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 424w, https://substackcdn.com/image/fetch/$s_!nPBS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 848w, https://substackcdn.com/image/fetch/$s_!nPBS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 1272w, https://substackcdn.com/image/fetch/$s_!nPBS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nPBS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png" width="928" height="127" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:127,&quot;width&quot;:928,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14304,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nPBS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 424w, https://substackcdn.com/image/fetch/$s_!nPBS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 848w, https://substackcdn.com/image/fetch/$s_!nPBS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 1272w, https://substackcdn.com/image/fetch/$s_!nPBS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0e3ee2f-de1e-4251-a8ad-517bda597d99_928x127.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Enabling store_failures under a custom schema. Source: <a href="https://docs.getdbt.com/reference/resource-configs/schema#tests">Schema - Data Tests</a></figcaption></figure></div><p>Ensure you have the correct permissions to create schemas in the database. </p><h4>where:</h4><p>Allows you to limit the records being tested. For instance, you can tell dbt to only test the assertion on records for which column A is not null. </p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7Wuz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7Wuz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 424w, https://substackcdn.com/image/fetch/$s_!7Wuz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 848w, https://substackcdn.com/image/fetch/$s_!7Wuz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 1272w, https://substackcdn.com/image/fetch/$s_!7Wuz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7Wuz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png" width="892" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:892,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:15328,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7Wuz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 424w, https://substackcdn.com/image/fetch/$s_!7Wuz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 848w, https://substackcdn.com/image/fetch/$s_!7Wuz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 1272w, https://substackcdn.com/image/fetch/$s_!7Wuz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80a129d2-0590-4be5-a04c-ad1ad20a3823_892x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">&#8220;Where&#8221; config applied for a generic test. Source: <a href="https://docs.getdbt.com/reference/resource-configs/where">Where</a></figcaption></figure></div><p>This configuration generates a macro called <em>get_where_subquery</em> that will replace the source reference with a subquery:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M_xB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M_xB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 424w, https://substackcdn.com/image/fetch/$s_!M_xB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 848w, https://substackcdn.com/image/fetch/$s_!M_xB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 1272w, https://substackcdn.com/image/fetch/$s_!M_xB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M_xB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png" width="931" height="90" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:90,&quot;width&quot;:931,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10481,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!M_xB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 424w, https://substackcdn.com/image/fetch/$s_!M_xB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 848w, https://substackcdn.com/image/fetch/$s_!M_xB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 1272w, https://substackcdn.com/image/fetch/$s_!M_xB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cc5471d-4197-46b1-93f0-4def67beaa32_931x90.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Testing only records for the current date. Source: <a href="https://docs.getdbt.com/reference/resource-configs/where">Where</a></figcaption></figure></div><p>For this config, you have access to {{ var( ) }} and {{ env_var( ) }} but not custom macros. This is because configs are evaluated before custom macros are compiled.</p><p>To use custom macros in the <em>where: </em>config, you can override the default <em>get_where_subquery</em>. </p><p>For instance, say you want to test only the latest partition:</p><p>Create the custom macro <em>latest_partition.sql</em> that identifies records of the latest partition:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oGqv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oGqv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 424w, https://substackcdn.com/image/fetch/$s_!oGqv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 848w, https://substackcdn.com/image/fetch/$s_!oGqv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 1272w, https://substackcdn.com/image/fetch/$s_!oGqv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oGqv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png" width="703" height="199" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2a79427f-6a14-4279-9cbd-76817140feba_703x199.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:199,&quot;width&quot;:703,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10164,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oGqv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 424w, https://substackcdn.com/image/fetch/$s_!oGqv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 848w, https://substackcdn.com/image/fetch/$s_!oGqv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 1272w, https://substackcdn.com/image/fetch/$s_!oGqv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a79427f-6a14-4279-9cbd-76817140feba_703x199.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: ChatGPT</figcaption></figure></div><p>Now, create a macro named <em>get_where_subquery to</em> override the default macro and call the custom macro you just created. Don&#8217;t forget to specify the test name this should refer to if you don&#8217;t want the <em>get_where_subquery </em>to be modified for all tests.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gqLV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gqLV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 424w, https://substackcdn.com/image/fetch/$s_!gqLV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 848w, https://substackcdn.com/image/fetch/$s_!gqLV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 1272w, https://substackcdn.com/image/fetch/$s_!gqLV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gqLV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png" width="667" height="700" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:700,&quot;width&quot;:667,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30559,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/190379410?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gqLV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 424w, https://substackcdn.com/image/fetch/$s_!gqLV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 848w, https://substackcdn.com/image/fetch/$s_!gqLV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 1272w, https://substackcdn.com/image/fetch/$s_!gqLV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8d4ea893-f1b2-4b9e-a07a-94c07d507778_667x700.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: ChatGPT</figcaption></figure></div><div><hr></div><h3>General configurations</h3><ul><li><p>enabled: if set to False, dbt does not consider this resource part of the project.</p></li><li><p>tags: add common tags to resources to apply commands to all in one go using the &#8220;tag:&#8221; method.</p></li><li><p>meta: adds custom metadata for the resource to the manifest.json file and documentation.</p></li><li><p>database, schema, alias: relevant for store_failures only to set a custom path for failed records.</p></li></ul><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Data Test Properties]]></title><description><![CDATA[Setting up tests with Properties and the adjusting naming conventions for logs, artifacts and database objects.]]></description><link>https://andrealeonel.substack.com/p/data-test-properties</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/data-test-properties</guid><pubDate>Fri, 23 Jan 2026 23:48:20 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!uGOk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">About data tests property </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>We&#8217;ve learned <a href="https://andrealeonel.substack.com/p/adding-data-tests-to-your-dag">what data tests are and how to implement them logically in your DAG</a>. Now, we are going to understand how to declare the properties for data tests. </p><p>These properties allow you to correctly set up your tests and apply them to multiple columns.</p><p>dbt also offers some options in terms of naming these tests, which can make logs, artifacts, and database table names more logical.</p><div><hr></div><h3>Description</h3><p>Use the data_tests property to define assertions about a column, table, or view. It can be used to define generic data tests, including the 4 built-in tests.</p><p>It can also be optionally used for singular data tests for documentation purposes using the &#8220;description&#8221; parameter.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uGOk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uGOk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 424w, https://substackcdn.com/image/fetch/$s_!uGOk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 848w, https://substackcdn.com/image/fetch/$s_!uGOk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 1272w, https://substackcdn.com/image/fetch/$s_!uGOk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uGOk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png" width="898" height="481" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:481,&quot;width&quot;:898,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48498,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uGOk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 424w, https://substackcdn.com/image/fetch/$s_!uGOk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 848w, https://substackcdn.com/image/fetch/$s_!uGOk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 1272w, https://substackcdn.com/image/fetch/$s_!uGOk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83f76bad-a76c-4ffe-b843-634ce359ced4_898x481.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Syntax for the data_tests property (<a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a>).</figcaption></figure></div><div><hr></div><h3>Test-specific properties</h3><p>Out-of-the-box generic tests require specific arguments for the column it&#8217;s being applied to. It&#8217;s also possible to test using expressions involving multiple columns. </p><h4>Built-in generic tests:</h4><p>These tests have to be applied at column level.</p><p><strong>Not_null</strong></p><p>This test only requires the data_tests property to declare the test and no further arguments are needed.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oXP2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oXP2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 424w, https://substackcdn.com/image/fetch/$s_!oXP2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 848w, https://substackcdn.com/image/fetch/$s_!oXP2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 1272w, https://substackcdn.com/image/fetch/$s_!oXP2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oXP2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png" width="936" height="216" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:216,&quot;width&quot;:936,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11054,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oXP2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 424w, https://substackcdn.com/image/fetch/$s_!oXP2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 848w, https://substackcdn.com/image/fetch/$s_!oXP2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 1272w, https://substackcdn.com/image/fetch/$s_!oXP2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e2c0250-3e13-4a7e-bf93-7544f7300926_936x216.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Declaring not_null tests. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a>.</figcaption></figure></div><p><strong>Unique</strong></p><p>Similar to not_null, unique only has to be declared. However, it takes an optional &#8220;where&#8221; config to filter the rows this is applied to.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xO5k!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xO5k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 424w, https://substackcdn.com/image/fetch/$s_!xO5k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 848w, https://substackcdn.com/image/fetch/$s_!xO5k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 1272w, https://substackcdn.com/image/fetch/$s_!xO5k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xO5k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png" width="931" height="252" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:252,&quot;width&quot;:931,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14411,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xO5k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 424w, https://substackcdn.com/image/fetch/$s_!xO5k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 848w, https://substackcdn.com/image/fetch/$s_!xO5k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 1272w, https://substackcdn.com/image/fetch/$s_!xO5k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6c437797-8b9a-406d-8f4b-018d0835eb07_931x252.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The config &#8220;where&#8221; can be used to filter rows for this test. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div><p><strong>Accepted_values</strong></p><p>This test requires no further configuration for strings. However, if you want your accepted values to be non-string values (like integers or booleans), you need an additional &#8220;quote&#8221; argument to be set to false.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q1ZP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q1ZP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 424w, https://substackcdn.com/image/fetch/$s_!q1ZP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 848w, https://substackcdn.com/image/fetch/$s_!q1ZP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 1272w, https://substackcdn.com/image/fetch/$s_!q1ZP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q1ZP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png" width="934" height="414" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:414,&quot;width&quot;:934,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38855,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q1ZP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 424w, https://substackcdn.com/image/fetch/$s_!q1ZP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 848w, https://substackcdn.com/image/fetch/$s_!q1ZP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 1272w, https://substackcdn.com/image/fetch/$s_!q1ZP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd78a2dbf-201b-4260-80b5-ee43dc8506ec_934x414.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Examples of string and non-string values within the accepted_values test. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div><p><strong>Relationships</strong></p><p>This test takes an argument &#8220;to&#8221; and a &#8220;field&#8221; that define which child table it should look for corresponding values from the parent table.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-umw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-umw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 424w, https://substackcdn.com/image/fetch/$s_!-umw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 848w, https://substackcdn.com/image/fetch/$s_!-umw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 1272w, https://substackcdn.com/image/fetch/$s_!-umw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-umw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png" width="934" height="289" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:289,&quot;width&quot;:934,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26613,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-umw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 424w, https://substackcdn.com/image/fetch/$s_!-umw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 848w, https://substackcdn.com/image/fetch/$s_!-umw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 1272w, https://substackcdn.com/image/fetch/$s_!-umw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9908dd9a-739d-4848-aaed-e4026d1250f3_934x289.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Setting up the relationships test. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div><p>Please note that this test excludes null values from validation. If you want nulls to cause failures, use the not_null test.</p><h4>Testing an expression:</h4><p>When a data test involves multiple columns, it doesn&#8217;t make sense to place it under the &#8220;columns&#8221; key. In these cases, you apply the test to the model.</p><p>For instance, when using the dbt_utils.expression_is_true:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9yrP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9yrP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 424w, https://substackcdn.com/image/fetch/$s_!9yrP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 848w, https://substackcdn.com/image/fetch/$s_!9yrP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 1272w, https://substackcdn.com/image/fetch/$s_!9yrP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9yrP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png" width="931" height="354" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:354,&quot;width&quot;:931,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48465,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9yrP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 424w, https://substackcdn.com/image/fetch/$s_!9yrP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 848w, https://substackcdn.com/image/fetch/$s_!9yrP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 1272w, https://substackcdn.com/image/fetch/$s_!9yrP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd3bde177-476f-4d6b-b86e-a5f444514f03_931x354.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Data test applied to the model and using an &#8220;expression&#8221; argument. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div><div><hr></div><h3>Custom test names: the &#8220;name&#8221; property</h3><p>dbt will define the test names in the artifacts by concatenating the test name, the resource name and, if relevant, column name and arguments.</p><p>You may want to define a custom name for your tests to obtain a more recognisable name in the artifacts. For that, you can use the &#8220;name&#8221; property. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sl_W!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sl_W!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 424w, https://substackcdn.com/image/fetch/$s_!sl_W!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 848w, https://substackcdn.com/image/fetch/$s_!sl_W!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 1272w, https://substackcdn.com/image/fetch/$s_!sl_W!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sl_W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png" width="931" height="334" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:334,&quot;width&quot;:931,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36910,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sl_W!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 424w, https://substackcdn.com/image/fetch/$s_!sl_W!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 848w, https://substackcdn.com/image/fetch/$s_!sl_W!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 1272w, https://substackcdn.com/image/fetch/$s_!sl_W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ef0137f-2f91-4b8f-b757-cc2d17ffb7c4_931x334.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Applying the alias &#8220;unexpected_order_status_today&#8221; to a data test. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div><p>Besides showing in artifacts and logs, this custom name can be used by the &#8220;select&#8221; method to run only a specific data test. </p><p>You cannot have duplicate custom names for the same column. However, you can repeat them across different columns or models. In this case, the &#8220;select&#8221; method will run all tests under the same custom name.</p><p>You can also use custom names when you need to apply the same data test type to one column. By giving them custom names, dbt will know how to differentiate them.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8gU0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8gU0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 424w, https://substackcdn.com/image/fetch/$s_!8gU0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 848w, https://substackcdn.com/image/fetch/$s_!8gU0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 1272w, https://substackcdn.com/image/fetch/$s_!8gU0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8gU0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png" width="937" height="462" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:462,&quot;width&quot;:937,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56738,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8gU0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 424w, https://substackcdn.com/image/fetch/$s_!8gU0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 848w, https://substackcdn.com/image/fetch/$s_!8gU0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 1272w, https://substackcdn.com/image/fetch/$s_!8gU0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82235f03-0ea4-444e-a854-dc2a38a0edcb_937x462.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Two accepted_values tests applied to a single column, but testing different sets of rows. Custom names help dbt to differentiate them. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div><h4>Alias for &#8220;store_failures&#8221; database table</h4><p>When switching &#8220;store_failures&#8221; on, dbt will store test results in a database object. By default, it takes the name of the test, or the custom name if defined, as the name of the database table.</p><p>If you&#8217;d like the database table to have a different name, you can set an alias for the test.</p><div><hr></div><h3>Using &#8220;test_name&#8221; to flatten config</h3><p>dbt offers the option to define test properties using the &#8220;test_name&#8221; property to make your file easier to read. The result is the same.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ctvl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ctvl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 424w, https://substackcdn.com/image/fetch/$s_!ctvl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 848w, https://substackcdn.com/image/fetch/$s_!ctvl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 1272w, https://substackcdn.com/image/fetch/$s_!ctvl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ctvl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png" width="939" height="417" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:417,&quot;width&quot;:939,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:43891,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/185587693?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ctvl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 424w, https://substackcdn.com/image/fetch/$s_!ctvl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 848w, https://substackcdn.com/image/fetch/$s_!ctvl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 1272w, https://substackcdn.com/image/fetch/$s_!ctvl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fab7c18ed-cbb1-4c2e-9bc8-3c30e08fabb7_939x417.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Using test_name instead of the -accepted_values to make the file more streamlined. <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">Source</a></figcaption></figure></div>]]></content:encoded></item><item><title><![CDATA[Adding data tests to your DAG]]></title><description><![CDATA[Why you should test your data and how to implement data testing in a healthy way to your DAG]]></description><link>https://andrealeonel.substack.com/p/adding-data-tests-to-your-dag</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/adding-data-tests-to-your-dag</guid><pubDate>Sat, 17 Jan 2026 00:11:15 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!f2xS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://www.getdbt.com/blog/data-testing">Why is data testing necessary?</a> and <a href="https://docs.getdbt.com/docs/build/data-tests">Add data tests to your DAG</a> documentation</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Data tests are assumptions we make about resources in our project. For instance, we can configure a model to fail or issue a warning when certain preset requirements are not met. </p><p>dbt offers a few out-of-the-box solutions, but it is also possible to create custom tests to reflect specific business logic. </p><p>In this post, we will cover the reasons why you should add tests to your project and suggest a gradual implementation of data testing. Finally, we&#8217;ll go into the nitty-gritty of adding data tests to your DAG.</p><p>In the next posts, we will cover data test properties, configurations, and the dbt test command.</p><div><hr></div><h3>The importance of data testing</h3><p>Whether you deal with internal or external stakeholders, trust in the data is fundamental to getting buy-in and support. Therefore, data professionals cannot afford the risk of sharing incorrect data.</p><p>When we are engineering a complex project, we could end up running countless models successfully without ever noticing that something is off.</p><p>Data testing helps us ensure that certain assumptions are met before models are built successfully - or at least throw a warning for less critical issues.</p><p>The built-in data testing tools in dbt enable you to check if:</p><ul><li><p>The SQL code is doing what it&#8217;s meant to do</p></li><li><p>Assumptions about your source data are correct</p></li><li><p>Anything changed in your source data that is impacting your assumptions</p></li></ul><h3>Introducing data tests gradually and sustainably</h3><p>You don&#8217;t need to set up every data test under the sun just because they are available. dbt&#8217;s general rule of thumb goes for data testing too: don&#8217;t make your project unnecessarily complex.</p><p>dbt suggests the gradual introduction of tests following the phases below:</p><h4>1) Simple test use cases</h4><p>Initially, you might not be testing your data.</p><p>However, if you&#8217;re consistently running into data quality issues or you&#8217;re preparing to enhance your project&#8217;s complexity, it&#8217;s time to consider adding tests.</p><ul><li><p><strong>Primary Keys: </strong>Unique &amp; not_null tests help you identify values that mess with filters, joins, or aggregate calculations.</p></li><li><p><strong>Accepted values or relationship tests: </strong>for columns with predictable values, this test flags any new values that appear in the source data.</p></li></ul><h4>2) Preempting issues</h4><p>As your project grows, you might want to start preparing for outliers or lack of freshness.</p><p>Here you can go beyond dbt&#8217;s out-of-the-box tests and into custom testing to spot and treat these corner cases in your data.</p><p>You can also consider configuring freshness so dbt alerts you when a source is stale. <a href="https://andrealeonel.substack.com/p/setting-up-and-using-source-freshness">Source freshness was addressed in Checkpoint 2</a>.</p><h4>3) Tackle workflow testing</h4><p>Once you&#8217;ve safeguarded your project, it&#8217;s time to expand testing into the pull requests with CI/CD jobs. These will be discussed further in this Checkpoint.</p><p>dbt also recommends creating a testing culture within the team with data tests consistently being added to new code and processes in place to debug test failures. I&#8217;d also add the usage of a good PR template to ensure data quality, another aspect that will be discussed later in this Checkpoint.</p><h4>4) Avoid over-testing</h4><p>At this stage, you could potentially find yourself drowning in warnings and errors generated by data tests.</p><p>Consider removing those warnings that you are consistently ignoring so your project only flags those that really deserve your attention. A periodic audit for deprecated fields or tests can be a good tactic.</p><p>You can also evaluate switching errors to warnings if you find that your project is delayed over failures that are not that severe.</p><p>Finally, consider the value for money of your tests: data testing may incur computing and development costs.</p><div><hr></div><h3>Adding tests to your DAG</h3><h4>What are data tests in dbt?</h4><p>Firstly, it&#8217;s important to understand that, like most things in dbt, data tests are SQL queries. Their statement will pull a list of records that fail the test you set up.</p><p>There are two types of data tests in dbt:</p><h4>Singular data tests</h4><p>Singular tests are a custom SQL query that returns failing rows saved in a .sql file in your test directory. These are useful to test assumptions that involve specific business logic.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!v8oY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v8oY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 424w, https://substackcdn.com/image/fetch/$s_!v8oY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 848w, https://substackcdn.com/image/fetch/$s_!v8oY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 1272w, https://substackcdn.com/image/fetch/$s_!v8oY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!v8oY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png" width="1005" height="387" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:387,&quot;width&quot;:1005,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52110,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/184821948?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!v8oY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 424w, https://substackcdn.com/image/fetch/$s_!v8oY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 848w, https://substackcdn.com/image/fetch/$s_!v8oY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 1272w, https://substackcdn.com/image/fetch/$s_!v8oY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F84157012-6ba1-454c-ab20-b11a2f7b694f_1005x387.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><strong>Example singular test. Source: <a href="https://docs.getdbt.com/docs/build/data-tests">Add data tests to your DAG</a></strong></figcaption></figure></div><p>The SQL query should return the list of failing records and their relevant attributes. Remember to omit semicolons at the end of the statement.</p><p>You can use Jinja in singular testing, as shown in the ref( ) function above. The name of the file becomes the test name.</p><p>Any singular tests included in the test directory will automatically be summoned by the dbt test command. </p><p>They don&#8217;t need to be referenced or configured in .yml files. However, you may want to document them under the data_test block with a description:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FX-u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FX-u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 424w, https://substackcdn.com/image/fetch/$s_!FX-u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 848w, https://substackcdn.com/image/fetch/$s_!FX-u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 1272w, https://substackcdn.com/image/fetch/$s_!FX-u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FX-u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png" width="1005" height="351" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:351,&quot;width&quot;:1005,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36708,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/184821948?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FX-u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 424w, https://substackcdn.com/image/fetch/$s_!FX-u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 848w, https://substackcdn.com/image/fetch/$s_!FX-u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 1272w, https://substackcdn.com/image/fetch/$s_!FX-u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a9432bc-dec7-49b9-b519-53644b46eec5_1005x351.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Adding singular tests to yml files for documentation purposes. Source: <a href="https://docs.getdbt.com/docs/build/data-tests#singular-data-tests">Add data tests to your DAG</a></figcaption></figure></div><h4>Generic data tests</h4><p>These are parameterised queries defined by a test block, like a macro, that can be referenced throughout your project. dbt comes with four generic tests out of the box.</p><p>Once defined and saved in the tests directory, this test has to be defined as a property of a given resource in their respective yml file.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Y7d6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Y7d6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 424w, https://substackcdn.com/image/fetch/$s_!Y7d6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 848w, https://substackcdn.com/image/fetch/$s_!Y7d6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 1272w, https://substackcdn.com/image/fetch/$s_!Y7d6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Y7d6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png" width="996" height="259" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:259,&quot;width&quot;:996,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22490,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/184821948?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Y7d6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 424w, https://substackcdn.com/image/fetch/$s_!Y7d6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 848w, https://substackcdn.com/image/fetch/$s_!Y7d6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 1272w, https://substackcdn.com/image/fetch/$s_!Y7d6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e6d252a-9795-4ad3-b5a9-483c755e6c1a_996x259.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Example of generic test saved as macro that can be reused throughout the project. Source: <a href="https://docs.getdbt.com/docs/build/data-tests#generic-data-tests">Add data tests to your DAG</a></figcaption></figure></div><p>The example above is simply checking a column for nulls. However, dbt already includes this type of testing and three others as a native feature.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!f2xS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f2xS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 424w, https://substackcdn.com/image/fetch/$s_!f2xS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 848w, https://substackcdn.com/image/fetch/$s_!f2xS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 1272w, https://substackcdn.com/image/fetch/$s_!f2xS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f2xS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png" width="1008" height="664" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:664,&quot;width&quot;:1008,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:71032,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/184821948?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f2xS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 424w, https://substackcdn.com/image/fetch/$s_!f2xS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 848w, https://substackcdn.com/image/fetch/$s_!f2xS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 1272w, https://substackcdn.com/image/fetch/$s_!f2xS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa9ff8f10-02f7-42a6-80e4-92fbda78e854_1008x664.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Configuration for the four out-of-the-box generic tests in dbt. Source: <a href="https://docs.getdbt.com/docs/build/data-tests#generic-data-tests">Add tests to your DAG</a></figcaption></figure></div><p>The out-of-the-box generic tests assert that: </p><ul><li><p>unique: a column (or combination of columns) contains no duplicate values.</p></li><li><p>not_null: a column contains no null values.</p></li><li><p>accepted_values: all values in a column are in a set of possible values.</p></li><li><p>relationships: each value in a given column exists in another table.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Nhjz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nhjz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 424w, https://substackcdn.com/image/fetch/$s_!Nhjz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 848w, https://substackcdn.com/image/fetch/$s_!Nhjz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 1272w, https://substackcdn.com/image/fetch/$s_!Nhjz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Nhjz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png" width="889" height="367" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:367,&quot;width&quot;:889,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33638,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/184821948?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Nhjz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 424w, https://substackcdn.com/image/fetch/$s_!Nhjz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 848w, https://substackcdn.com/image/fetch/$s_!Nhjz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 1272w, https://substackcdn.com/image/fetch/$s_!Nhjz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8818b736-6f65-4072-b5d2-7f06f2cf0b76_889x367.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">It is possible to write expressions to test two columns together for uniqueness. Source: <a href="https://docs.getdbt.com/docs/build/data-tests#faqs">Add data tests to your DAG</a></figcaption></figure></div><p>There are additional configurations available for tests, which will be covered later in this Checkpoint.</p><p>Besides the native data tests, dbt also offers the ability to write <a href="https://docs.getdbt.com/best-practices/writing-custom-generic-tests">custom generic tests</a> and import them from Packages. The former is not part of the Certified Developer Exam, so it won&#8217;t be covered in more detail here. But we&#8217;ve explored key open-source packages in the <a href="https://andrealeonel.substack.com/p/understanding-project-dependencies">Packages post</a> that include testing macros.</p><div><hr></div>]]></content:encoded></item><item><title><![CDATA[Practice Project: Checkpoint 4 - Part 5]]></title><description><![CDATA[Adding our final resources (Python model and Exposure) and generating documentation.]]></description><link>https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-8cb</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-8cb</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Sun, 14 Dec 2025 22:40:11 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!QeIY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QeIY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QeIY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 424w, https://substackcdn.com/image/fetch/$s_!QeIY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 848w, https://substackcdn.com/image/fetch/$s_!QeIY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 1272w, https://substackcdn.com/image/fetch/$s_!QeIY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QeIY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png" width="1177" height="385" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:385,&quot;width&quot;:1177,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:570916,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QeIY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 424w, https://substackcdn.com/image/fetch/$s_!QeIY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 848w, https://substackcdn.com/image/fetch/$s_!QeIY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 1272w, https://substackcdn.com/image/fetch/$s_!QeIY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30821aab-91cd-40d9-a6d8-089b56b61b5f_1177x385.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We&#8217;ve arrived at the final part of our Practice Project - Checkpoint 4. This was definitely a heavy checkpoint, but at the end of this post you&#8217;ll see how mature our project looks now.</p><p>The next Checkpoint will cover data tests and deployment - lighter in content but no less important! </p><div><hr></div><h3>Python Models</h3><p>Let&#8217;s create a simple <a href="https://andrealeonel.substack.com/p/python-models">Python model</a> that calculates the lifetime value of each employee.</p><p>In real life, you wouldn&#8217;t use Python for such a banal calculation. SQL is always preferred on dbt. However, my Python skills are a bit rusty, so I&#8217;ll keep it simple.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DERH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DERH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 424w, https://substackcdn.com/image/fetch/$s_!DERH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 848w, https://substackcdn.com/image/fetch/$s_!DERH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 1272w, https://substackcdn.com/image/fetch/$s_!DERH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DERH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png" width="1302" height="451" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:451,&quot;width&quot;:1302,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54949,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DERH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 424w, https://substackcdn.com/image/fetch/$s_!DERH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 848w, https://substackcdn.com/image/fetch/$s_!DERH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 1272w, https://substackcdn.com/image/fetch/$s_!DERH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23b86bd4-9956-4b7f-991f-540dab1ca47f_1302x451.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">This simple aggregation is summing the order_value by emp_id.</figcaption></figure></div><p>The next step is to configure the newly created model. We are going to materialise it as a table.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Zw93!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Zw93!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 424w, https://substackcdn.com/image/fetch/$s_!Zw93!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 848w, https://substackcdn.com/image/fetch/$s_!Zw93!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 1272w, https://substackcdn.com/image/fetch/$s_!Zw93!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Zw93!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png" width="1309" height="292" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:292,&quot;width&quot;:1309,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32967,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Zw93!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 424w, https://substackcdn.com/image/fetch/$s_!Zw93!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 848w, https://substackcdn.com/image/fetch/$s_!Zw93!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 1272w, https://substackcdn.com/image/fetch/$s_!Zw93!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcf7da7e0-0a4e-493f-a309-1330967fa202_1309x292.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Simple configuration on dbt_project.yml.</figcaption></figure></div><p>Now, we are going to run the model. As usual, because I have billing disabled in BigQuery, I&#8217;m not able to run it successfully. There would be ways to run this locally, but it would involve more advanced features.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aVqv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aVqv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 424w, https://substackcdn.com/image/fetch/$s_!aVqv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 848w, https://substackcdn.com/image/fetch/$s_!aVqv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 1272w, https://substackcdn.com/image/fetch/$s_!aVqv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aVqv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png" width="951" height="502" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:502,&quot;width&quot;:951,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93506,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aVqv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 424w, https://substackcdn.com/image/fetch/$s_!aVqv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 848w, https://substackcdn.com/image/fetch/$s_!aVqv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 1272w, https://substackcdn.com/image/fetch/$s_!aVqv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf4d874e-f58b-4d9c-a31d-1a62018bec98_951x502.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">I&#8217;d need a GCP Bucket and a compute_region setting to run this</figcaption></figure></div><p>The important thing is that we understand the minimal requirements of Python model configuration, how to use the &#8220;model&#8221; function, and test the ability to reference sql models.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XHkk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XHkk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 424w, https://substackcdn.com/image/fetch/$s_!XHkk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 848w, https://substackcdn.com/image/fetch/$s_!XHkk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 1272w, https://substackcdn.com/image/fetch/$s_!XHkk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XHkk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png" width="1321" height="577" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:577,&quot;width&quot;:1321,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97195,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XHkk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 424w, https://substackcdn.com/image/fetch/$s_!XHkk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 848w, https://substackcdn.com/image/fetch/$s_!XHkk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 1272w, https://substackcdn.com/image/fetch/$s_!XHkk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ab609fd-a7b9-457c-9b5a-ccc68918fc23_1321x577.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The Compiled Code shows how dbt logic works behind the scenes.</figcaption></figure></div><div><hr></div><h3>Exposures</h3><p>We&#8217;re modeling all this data for our B2B company so that the end-users can access clean, consistent data via a visualisation tool such as Power BI or Tableau.</p><p>Creating the actual dashboard is out of scope here, but we can practice configuring a dashboard as an <a href="https://andrealeonel.substack.com/p/all-you-need-to-know-about-dbts-exposures">Exposure</a>.</p><p>The first step is to configure our Exposure in an exposure.yml file:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aqiG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aqiG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 424w, https://substackcdn.com/image/fetch/$s_!aqiG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 848w, https://substackcdn.com/image/fetch/$s_!aqiG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 1272w, https://substackcdn.com/image/fetch/$s_!aqiG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aqiG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png" width="1339" height="511" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:511,&quot;width&quot;:1339,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65693,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aqiG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 424w, https://substackcdn.com/image/fetch/$s_!aqiG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 848w, https://substackcdn.com/image/fetch/$s_!aqiG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 1272w, https://substackcdn.com/image/fetch/$s_!aqiG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64023d13-4a92-40ab-91d5-6bc0c57a8ffb_1339x511.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Exposures require a separate properties file stored in the models folder.</figcaption></figure></div><p>Not all these configs are required and you can make it as robust or simple as you&#8217;d like.</p><p>Finally, we are going to run our new Exposure so it becomes a node in the DAG.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GKNB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GKNB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 424w, https://substackcdn.com/image/fetch/$s_!GKNB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 848w, https://substackcdn.com/image/fetch/$s_!GKNB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 1272w, https://substackcdn.com/image/fetch/$s_!GKNB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GKNB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png" width="945" height="504" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:504,&quot;width&quot;:945,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:77620,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GKNB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 424w, https://substackcdn.com/image/fetch/$s_!GKNB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 848w, https://substackcdn.com/image/fetch/$s_!GKNB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 1272w, https://substackcdn.com/image/fetch/$s_!GKNB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F56689785-09fa-48a6-ad37-20e2c8162e66_945x504.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Running the exposure config we just created.</figcaption></figure></div><p>Please note I have a deprecation flag on, as dbt recently started requiring the docs config to be under a &#8220;config:&#8221; block. </p><p>After a successful run, you should now see the Exposure as part of your DAG. I&#8217;ll add a small detail: fact tables should be in a single layer, as per dbt&#8217;s best practices, so do what I say and not what I do!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WtY9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WtY9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 424w, https://substackcdn.com/image/fetch/$s_!WtY9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 848w, https://substackcdn.com/image/fetch/$s_!WtY9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 1272w, https://substackcdn.com/image/fetch/$s_!WtY9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WtY9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png" width="1456" height="481" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:481,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:137626,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WtY9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 424w, https://substackcdn.com/image/fetch/$s_!WtY9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 848w, https://substackcdn.com/image/fetch/$s_!WtY9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 1272w, https://substackcdn.com/image/fetch/$s_!WtY9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcaa6ff3-e441-4391-a728-457b7e5661e1_1464x484.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Look at our DAG looking so grown up!</figcaption></figure></div><div><hr></div><h3>Documentation</h3><p>The last step of this very long Checkpoint is to <a href="https://andrealeonel.substack.com/p/generating-documentation-with-dbt">add and configure documentation</a> in our project.</p><p>Throughout our project, we&#8217;ve been adding descriptions to sources and other resources:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZxbC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZxbC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 424w, https://substackcdn.com/image/fetch/$s_!ZxbC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 848w, https://substackcdn.com/image/fetch/$s_!ZxbC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 1272w, https://substackcdn.com/image/fetch/$s_!ZxbC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZxbC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png" width="1336" height="778" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:778,&quot;width&quot;:1336,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:101022,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZxbC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 424w, https://substackcdn.com/image/fetch/$s_!ZxbC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 848w, https://substackcdn.com/image/fetch/$s_!ZxbC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 1272w, https://substackcdn.com/image/fetch/$s_!ZxbC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdc54069d-d9cf-4367-8ef2-f4ea48e58fa4_1336x778.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The description property used in Sources.yml</figcaption></figure></div><p>However, our fct_orders model is quite an important one and includes complex discount and VAT logic. Therefore, for that model, we&#8217;re going to include a doc block for a more thorough description.</p><p>For that, we need to create a docs.md (optionally in a docs folder within models), where we can store all doc blocks we may need.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NjG7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NjG7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 424w, https://substackcdn.com/image/fetch/$s_!NjG7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 848w, https://substackcdn.com/image/fetch/$s_!NjG7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 1272w, https://substackcdn.com/image/fetch/$s_!NjG7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NjG7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png" width="1335" height="831" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:831,&quot;width&quot;:1335,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114092,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NjG7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 424w, https://substackcdn.com/image/fetch/$s_!NjG7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 848w, https://substackcdn.com/image/fetch/$s_!NjG7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 1272w, https://substackcdn.com/image/fetch/$s_!NjG7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2182427-2b8e-4571-a77f-bf58874cab74_1335x831.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A thorough explanation of the logic behind the fct_orders model in a doc block.</figcaption></figure></div><p>In the fct_orders model, let&#8217;s replace the standard description we had in the properties.yml file with our doc bloc.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nrTi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nrTi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 424w, https://substackcdn.com/image/fetch/$s_!nrTi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 848w, https://substackcdn.com/image/fetch/$s_!nrTi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 1272w, https://substackcdn.com/image/fetch/$s_!nrTi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nrTi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png" width="1311" height="433" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:433,&quot;width&quot;:1311,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50743,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nrTi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 424w, https://substackcdn.com/image/fetch/$s_!nrTi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 848w, https://substackcdn.com/image/fetch/$s_!nrTi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 1272w, https://substackcdn.com/image/fetch/$s_!nrTi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F443ba3f9-f3f4-4919-a8ee-00b3d9b41216_1311x433.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Linking a model description to a doc block.</figcaption></figure></div><p>Finally, we can generate the docs (compile all the descriptions, metadata, and doc blocks) and then serve them to a bespoke webpage.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MPKw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MPKw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 424w, https://substackcdn.com/image/fetch/$s_!MPKw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 848w, https://substackcdn.com/image/fetch/$s_!MPKw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 1272w, https://substackcdn.com/image/fetch/$s_!MPKw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MPKw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png" width="952" height="358" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:358,&quot;width&quot;:952,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39784,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MPKw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 424w, https://substackcdn.com/image/fetch/$s_!MPKw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 848w, https://substackcdn.com/image/fetch/$s_!MPKw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 1272w, https://substackcdn.com/image/fetch/$s_!MPKw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8b7d695-2ba0-44d1-b6d5-028cca0d84db_952x358.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Our docs were generated successfully.</figcaption></figure></div><p>I&#8217;m using the IDE, so I don&#8217;t need to serve the docs. The next step is to click the docs button to see our docs website:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Y-Rv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 424w, https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 848w, https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 1272w, https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png" width="943" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:943,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60934,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 424w, https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 848w, https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 1272w, https://substackcdn.com/image/fetch/$s_!Y-Rv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f7c1ee7-efd1-4d4f-8e95-7f462e6101a2_943x337.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The docs button is easy to miss for those not used to dbt&#8217;s IDE.</figcaption></figure></div><p>And there we have our brand new docs page. There are other ways to customise it, by creating an overview.md doc block to replace the text in the homepage, but we&#8217;ll keep it simple for now.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TpMp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TpMp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 424w, https://substackcdn.com/image/fetch/$s_!TpMp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 848w, https://substackcdn.com/image/fetch/$s_!TpMp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 1272w, https://substackcdn.com/image/fetch/$s_!TpMp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TpMp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png" width="1456" height="715" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/de745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:715,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:156005,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TpMp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 424w, https://substackcdn.com/image/fetch/$s_!TpMp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 848w, https://substackcdn.com/image/fetch/$s_!TpMp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 1272w, https://substackcdn.com/image/fetch/$s_!TpMp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde745d27-62bd-45bd-b0a9-8de98157307a_1888x927.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Our dbt-generated documentation page.</figcaption></figure></div><p>We can also see our doc block for fct_orders in action:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4b8s!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4b8s!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 424w, https://substackcdn.com/image/fetch/$s_!4b8s!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 848w, https://substackcdn.com/image/fetch/$s_!4b8s!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 1272w, https://substackcdn.com/image/fetch/$s_!4b8s!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4b8s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png" width="1456" height="647" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:647,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:147326,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4b8s!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 424w, https://substackcdn.com/image/fetch/$s_!4b8s!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 848w, https://substackcdn.com/image/fetch/$s_!4b8s!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 1272w, https://substackcdn.com/image/fetch/$s_!4b8s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91f7fe31-f9c6-4573-9876-9ae52f3fa587_1846x820.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Our thorough description for the fct_orders model.</figcaption></figure></div><p>And finally, a complete visualisation of our DAG with colour-coded nodes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2F1V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2F1V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 424w, https://substackcdn.com/image/fetch/$s_!2F1V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 848w, https://substackcdn.com/image/fetch/$s_!2F1V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 1272w, https://substackcdn.com/image/fetch/$s_!2F1V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2F1V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png" width="1456" height="593" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/df7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:593,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:178849,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/181617995?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2F1V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 424w, https://substackcdn.com/image/fetch/$s_!2F1V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 848w, https://substackcdn.com/image/fetch/$s_!2F1V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 1272w, https://substackcdn.com/image/fetch/$s_!2F1V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf7931c9-1bb0-4230-8cb4-b6a139001b6d_1816x739.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Practice Project: Checkpoint 4 - Part 4]]></title><description><![CDATA[Playing with Grants and adding Snapshots to our Practice Project.]]></description><link>https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-d2f</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-d2f</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Sun, 07 Dec 2025 23:49:03 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!4uL0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4uL0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4uL0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 424w, https://substackcdn.com/image/fetch/$s_!4uL0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 848w, https://substackcdn.com/image/fetch/$s_!4uL0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 1272w, https://substackcdn.com/image/fetch/$s_!4uL0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4uL0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png" width="1176" height="376" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:376,&quot;width&quot;:1176,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:556867,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4uL0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 424w, https://substackcdn.com/image/fetch/$s_!4uL0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 848w, https://substackcdn.com/image/fetch/$s_!4uL0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 1272w, https://substackcdn.com/image/fetch/$s_!4uL0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3dff95c2-a1e8-4990-b37b-fa8353548e47_1176x376.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Yes, yet another part of the Practice Project Checkpoint 4! And it&#8217;s not the last one.</p><p>I just started a new job and the time I have available for this Study Guide has drastically shrunk. So, forgive me for the multiple parts. I&#8217;m just glad I&#8217;ve been able to stay consistent.</p><p>In Part 4, we&#8217;ll tackle Grants and Snapshots. Next part, hopefully the last one, we&#8217;ll add Exposures, Python models, and documentation to the project.</p><div><hr></div><h3>Grants</h3><p>For this Practice Project, we will define <a href="https://andrealeonel.substack.com/p/managing-access-permissions-with">grant permissions </a>in YAML files. </p><p>Let&#8217;s think of this scenario: we need to limit access to the &#8220;dim_employee&#8221; model as it shows confidential information on the employees.</p><p>Before we get started, it&#8217;s important to understand that each adapter will have specific <a href="https://docs.getdbt.com/reference/resource-configs/grants#database-specific-requirements-and-notes">terminology that needs to be used</a>. For instance, in Big Query, which is the adapter I am using, the &#8220;select&#8221; role is called &#8220;roles/bigquery.dataViewer&#8221;.</p><h4>Setting up grants</h4><p>We&#8217;ll first set up the grant config for the &#8220;dim_employee&#8221; model in the dbt_project.yml file. </p><p>Below, I gave a fictitious user permission to query my table in BigQuery.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jNWW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jNWW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 424w, https://substackcdn.com/image/fetch/$s_!jNWW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 848w, https://substackcdn.com/image/fetch/$s_!jNWW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 1272w, https://substackcdn.com/image/fetch/$s_!jNWW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jNWW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png" width="1330" height="342" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:342,&quot;width&quot;:1330,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:33920,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jNWW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 424w, https://substackcdn.com/image/fetch/$s_!jNWW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 848w, https://substackcdn.com/image/fetch/$s_!jNWW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 1272w, https://substackcdn.com/image/fetch/$s_!jNWW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7a80c48-288b-4631-bfc7-6386ff15777c_1330x342.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Adding the grant config to the dbt_project.yml file.</figcaption></figure></div><h4>Conditional grant with Jinja</h4><p>We can also use Jinja to set conditional permissions. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3-9m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3-9m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 424w, https://substackcdn.com/image/fetch/$s_!3-9m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 848w, https://substackcdn.com/image/fetch/$s_!3-9m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 1272w, https://substackcdn.com/image/fetch/$s_!3-9m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3-9m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png" width="1329" height="444" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:444,&quot;width&quot;:1329,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36976,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3-9m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 424w, https://substackcdn.com/image/fetch/$s_!3-9m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 848w, https://substackcdn.com/image/fetch/$s_!3-9m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 1272w, https://substackcdn.com/image/fetch/$s_!3-9m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3baa6a84-37eb-4691-8523-1d6f83a44d77_1329x444.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Even though the model was built successfully for both grants, when I queried the object privileges for &#8220;dim_employee&#8221; on BigQuery, I couldn&#8217;t get any data to return. I could not get this user to come up under my IAM permissions either. Not sure what this means, but I had to move on.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VcI0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VcI0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 424w, https://substackcdn.com/image/fetch/$s_!VcI0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 848w, https://substackcdn.com/image/fetch/$s_!VcI0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 1272w, https://substackcdn.com/image/fetch/$s_!VcI0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VcI0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png" width="879" height="436" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:436,&quot;width&quot;:879,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:47025,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VcI0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 424w, https://substackcdn.com/image/fetch/$s_!VcI0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 848w, https://substackcdn.com/image/fetch/$s_!VcI0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 1272w, https://substackcdn.com/image/fetch/$s_!VcI0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4012876-4ec8-4a70-82e7-65cc52bcc3ea_879x436.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Querying object privileges on BigQuery returned no data, for some reason.</figcaption></figure></div><div><hr></div><h3>Snapshots</h3><p>We are using a dataset created by <a href="https://leo-godin.medium.com/learn-dbt-with-real-fake-data-68d6d21c3e8f">Leo Godin on Medium</a>, and I&#8217;m not entirely sure whether company or employee details change over time. </p><p>However, for the sake of our example, we are going to create 2 <a href="https://andrealeonel.substack.com/p/setting-up-and-maintaining-snapshots">Snapshots </a>to record changes to company and employee data.</p><p></p><h4>Adding live employee and company data</h4><p>First things first, we are going to connect our employee and company data to the live public database that Godin set up - so far, we&#8217;ve been keeping that data static. Don&#8217;t forget to run these models and their downstreams once done.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Tmre!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Tmre!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 424w, https://substackcdn.com/image/fetch/$s_!Tmre!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 848w, https://substackcdn.com/image/fetch/$s_!Tmre!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 1272w, https://substackcdn.com/image/fetch/$s_!Tmre!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Tmre!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png" width="1321" height="418" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:418,&quot;width&quot;:1321,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48641,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Tmre!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 424w, https://substackcdn.com/image/fetch/$s_!Tmre!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 848w, https://substackcdn.com/image/fetch/$s_!Tmre!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 1272w, https://substackcdn.com/image/fetch/$s_!Tmre!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fca9cd27c-2292-4ae3-9c5e-c380286a4c76_1321x418.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Adding <a href="https://leogodin217.github.io/dbt-fake/#!/model/model.dbt_fake_company.employees_base">Godin&#8217;s public tables</a> to our sources.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cMrl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cMrl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 424w, https://substackcdn.com/image/fetch/$s_!cMrl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 848w, https://substackcdn.com/image/fetch/$s_!cMrl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 1272w, https://substackcdn.com/image/fetch/$s_!cMrl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cMrl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png" width="1299" height="424" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/10639bf0-686c-4b23-bef9-215eae529989_1299x424.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:424,&quot;width&quot;:1299,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36922,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cMrl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 424w, https://substackcdn.com/image/fetch/$s_!cMrl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 848w, https://substackcdn.com/image/fetch/$s_!cMrl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 1272w, https://substackcdn.com/image/fetch/$s_!cMrl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F10639bf0-686c-4b23-bef9-215eae529989_1299x424.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Updating our source table in the base_employees model.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QS4q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QS4q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 424w, https://substackcdn.com/image/fetch/$s_!QS4q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 848w, https://substackcdn.com/image/fetch/$s_!QS4q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 1272w, https://substackcdn.com/image/fetch/$s_!QS4q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QS4q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png" width="1296" height="223" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:223,&quot;width&quot;:1296,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22935,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QS4q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 424w, https://substackcdn.com/image/fetch/$s_!QS4q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 848w, https://substackcdn.com/image/fetch/$s_!QS4q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 1272w, https://substackcdn.com/image/fetch/$s_!QS4q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F839cef34-f64b-47bf-b63e-b25ed7aa4101_1296x223.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Updating our source table for the stg_companies model.</figcaption></figure></div><h4>Defining Snapshot strategy</h4><p>We don&#8217;t have an &#8220;updated_at&#8221; field we can go by in our data, so we&#8217;ll adopt the &#8220;check&#8221; strategy.</p><p>It is recommended to store your snapshots in a different schema, as once dropped, you cannot recover the historical changes lost. So we will define it to be built in our prod schema.</p><p>Also, dbt recommends basing snapshots on staging models that have already been cleaned rather than the raw data.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qPxt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qPxt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 424w, https://substackcdn.com/image/fetch/$s_!qPxt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 848w, https://substackcdn.com/image/fetch/$s_!qPxt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 1272w, https://substackcdn.com/image/fetch/$s_!qPxt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qPxt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png" width="1332" height="664" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:664,&quot;width&quot;:1332,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:93754,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qPxt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 424w, https://substackcdn.com/image/fetch/$s_!qPxt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 848w, https://substackcdn.com/image/fetch/$s_!qPxt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 1272w, https://substackcdn.com/image/fetch/$s_!qPxt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F864dfff1-fcb8-41fa-9950-6b9f363135dd_1332x664.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">My configurations for the 2 Snapshots</figcaption></figure></div><p>Run the &#8220;dbt snapshot&#8221; command and check that the two tables were created on dbt and in the warehouse.</p><h4>Verifying Snapshots</h4><p>Upon running the command, you will see the tables being created in the warehouse. On the first run, dbt simply copies the existing records and adds accessory columns like &#8220;dbt_scd_id&#8221;, &#8220;dbt_updated_at&#8221;, and &#8220;dbt_valid_from&#8221;.</p><p>Upon subsequent runs, dbt will check which records have changed or if any new records have been created. The updated record and any new records will be inserted into the snapshot table.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!v86L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!v86L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 424w, https://substackcdn.com/image/fetch/$s_!v86L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 848w, https://substackcdn.com/image/fetch/$s_!v86L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 1272w, https://substackcdn.com/image/fetch/$s_!v86L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!v86L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png" width="1456" height="326" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:326,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:183137,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180913983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!v86L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 424w, https://substackcdn.com/image/fetch/$s_!v86L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 848w, https://substackcdn.com/image/fetch/$s_!v86L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 1272w, https://substackcdn.com/image/fetch/$s_!v86L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38497ddd-34ec-4ed3-8a04-e4bc04c5949e_1546x346.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Companies snapshot shown in BigQuery.</figcaption></figure></div><h4>Frequent jobs for Snapshots</h4><p>In a real-life scenario, you&#8217;d need to have a frequent, scheduled job to run the snapshots to ensure you&#8217;re capturing all changes. </p><p>In my case, since I don&#8217;t have billing enabled on BigQuery, the Snapshots wouldn&#8217;t quite work the way they&#8217;re supposed to, so I&#8217;ll skip this step for this Practice Project.</p>]]></content:encoded></item><item><title><![CDATA[Practice Project: Checkpoint 4 - Part 3]]></title><description><![CDATA[Adding model governance features to our project - and failing miserably at Model Versioning.]]></description><link>https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-aed</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-aed</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Sun, 30 Nov 2025 16:11:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!SZI5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SZI5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SZI5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 424w, https://substackcdn.com/image/fetch/$s_!SZI5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 848w, https://substackcdn.com/image/fetch/$s_!SZI5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 1272w, https://substackcdn.com/image/fetch/$s_!SZI5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SZI5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png" width="1177" height="358" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:358,&quot;width&quot;:1177,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:530503,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SZI5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 424w, https://substackcdn.com/image/fetch/$s_!SZI5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 848w, https://substackcdn.com/image/fetch/$s_!SZI5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 1272w, https://substackcdn.com/image/fetch/$s_!SZI5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f2d4e61-f7ac-4b74-a54f-a5fb7e7655c0_1177x358.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Some configurations look straightforward in the documentation but when you actually try to implement them in a complex project, you run into all sorts of bugs.</p><p>This was the case with Model Governance features. I had some trouble setting up the access modifier correctly and, unfortunately, could not implement model versioning (I explained the bugs below).</p><p>This goes to show the importance of practising. Running into bugs is very frustrating, but they help us really grasp the workings behind dbt.</p><div><hr></div><h3>Model Governance</h3><p>For this practice step, we will add some <a href="https://andrealeonel.substack.com/p/model-governance-access-contracts">model governance features </a>to our project.</p><p>Here, we will add all features for practice, but in a real-life scenario, you would only add these features as needed. In data modelling, we always strive to reduce unnecessary complexity.</p><h4>Model access</h4><p>This is the ability to make models public or private to control who can ref them.</p><p>First, we need to define a group. We already have some groups defined by department, like the &#8220;customer_success&#8221; group, which holds the &#8220;fct_company&#8221; and &#8220;fct_company_trend&#8221; models. </p><p>By default, all groups are protected, so let&#8217;s change this group to private and try to ref one of its models from outside the group.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BGij!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BGij!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 424w, https://substackcdn.com/image/fetch/$s_!BGij!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 848w, https://substackcdn.com/image/fetch/$s_!BGij!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 1272w, https://substackcdn.com/image/fetch/$s_!BGij!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BGij!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png" width="1209" height="289" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:289,&quot;width&quot;:1209,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32290,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BGij!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 424w, https://substackcdn.com/image/fetch/$s_!BGij!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 848w, https://substackcdn.com/image/fetch/$s_!BGij!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 1272w, https://substackcdn.com/image/fetch/$s_!BGij!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc15ca3e-36d2-4801-ab95-cfb0391b0de7_1209x289.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Setting up the group and access in the bt_project.yml file.</figcaption></figure></div><p>I then created a new model and tried to reference one of the models. Upon compiling, I got the expected error.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XOMz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XOMz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 424w, https://substackcdn.com/image/fetch/$s_!XOMz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 848w, https://substackcdn.com/image/fetch/$s_!XOMz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 1272w, https://substackcdn.com/image/fetch/$s_!XOMz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XOMz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png" width="1456" height="179" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:179,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29719,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XOMz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 424w, https://substackcdn.com/image/fetch/$s_!XOMz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 848w, https://substackcdn.com/image/fetch/$s_!XOMz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 1272w, https://substackcdn.com/image/fetch/$s_!XOMz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5395461b-9dc0-4d28-9698-2ff86a5a8d39_1471x181.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><h4>Model contracts</h4><p>They restrict the shape of a model in terms of column names, data types, and constraints.</p><p>Following dbt&#8217;s recommendation, we will enforce some contracts in our fact tables. For instance, fct_orders could use some contracts, as we started feeding it with live data in the <a href="https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-c38">Practice Project 4 - Step 2</a>.</p><p>Firstly, let&#8217;s add the contract and constraints to the dbt_project.yml file. Please note that I&#8217;m using BigQuery and, while it enforces schema contracts, it doesn&#8217;t enforce constraints.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TLDX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TLDX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 424w, https://substackcdn.com/image/fetch/$s_!TLDX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 848w, https://substackcdn.com/image/fetch/$s_!TLDX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 1272w, https://substackcdn.com/image/fetch/$s_!TLDX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TLDX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png" width="1324" height="811" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:811,&quot;width&quot;:1324,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:103735,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TLDX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 424w, https://substackcdn.com/image/fetch/$s_!TLDX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 848w, https://substackcdn.com/image/fetch/$s_!TLDX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 1272w, https://substackcdn.com/image/fetch/$s_!TLDX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff4ff8b43-4d0c-4fc6-9155-1274cba31f4e_1324x811.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Adding contract and constraints to the properties.yml file.</figcaption></figure></div><p>I modified the fct_orders table by selecting only two of its columns to see it fail. </p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pNbz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pNbz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 424w, https://substackcdn.com/image/fetch/$s_!pNbz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 848w, https://substackcdn.com/image/fetch/$s_!pNbz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 1272w, https://substackcdn.com/image/fetch/$s_!pNbz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pNbz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png" width="1317" height="205" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:205,&quot;width&quot;:1317,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:24097,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pNbz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 424w, https://substackcdn.com/image/fetch/$s_!pNbz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 848w, https://substackcdn.com/image/fetch/$s_!pNbz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 1272w, https://substackcdn.com/image/fetch/$s_!pNbz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa51d2055-b925-4fc0-b079-77ced99446c1_1317x205.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Attempting to enforce a schema contract fail for fct_orders.</figcaption></figure></div><p>Upon building the model, I get the model contract error:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KSVc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KSVc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 424w, https://substackcdn.com/image/fetch/$s_!KSVc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 848w, https://substackcdn.com/image/fetch/$s_!KSVc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 1272w, https://substackcdn.com/image/fetch/$s_!KSVc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KSVc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png" width="1107" height="654" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95e1fc15-d356-4197-af76-4214875203e9_1107x654.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:654,&quot;width&quot;:1107,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:79116,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KSVc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 424w, https://substackcdn.com/image/fetch/$s_!KSVc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 848w, https://substackcdn.com/image/fetch/$s_!KSVc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 1272w, https://substackcdn.com/image/fetch/$s_!KSVc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95e1fc15-d356-4197-af76-4214875203e9_1107x654.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Logs showing me the columns missing from the contract.</figcaption></figure></div><h4>Model namespaces</h4><p>Delineate ownership boundaries and responsibilities through naming structures.</p><p>We&#8217;ve been working with namespaces throughout the Practice Project. For instance, when we added groups and access modifiers to the customer_success subdirectories above, we were using namespaces.</p><p>Also, when we use the source function, we are declaring the source namespace. In the example below, it would be &#8220;dbt_fake_live&#8221;.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1tzx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1tzx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 424w, https://substackcdn.com/image/fetch/$s_!1tzx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 848w, https://substackcdn.com/image/fetch/$s_!1tzx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 1272w, https://substackcdn.com/image/fetch/$s_!1tzx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1tzx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png" width="1285" height="211" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:211,&quot;width&quot;:1285,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20955,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1tzx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 424w, https://substackcdn.com/image/fetch/$s_!1tzx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 848w, https://substackcdn.com/image/fetch/$s_!1tzx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 1272w, https://substackcdn.com/image/fetch/$s_!1tzx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a0fd143-f84c-4bea-ba07-1d59a89c03d6_1285x211.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Namespaces in action within the source function.</figcaption></figure></div><h4>Model versions</h4><p>Versioning for the models, allowing for adjustments to be made without breaking access for the end user.</p><p>Now, for this one, I must be honest: I could not get it to work.</p><p>I tried versioning fct_orders and set up the configuration as per the documentation. However, dbt refused to read &#8220;fct_orders&#8221; as the v1 model. I tried using the defined_in optional parameter, renaming fct_orders to fct_orders_v1. Nothing worked.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6en_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6en_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 424w, https://substackcdn.com/image/fetch/$s_!6en_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 848w, https://substackcdn.com/image/fetch/$s_!6en_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 1272w, https://substackcdn.com/image/fetch/$s_!6en_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6en_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png" width="1338" height="576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:576,&quot;width&quot;:1338,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62008,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6en_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 424w, https://substackcdn.com/image/fetch/$s_!6en_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 848w, https://substackcdn.com/image/fetch/$s_!6en_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 1272w, https://substackcdn.com/image/fetch/$s_!6en_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe289297c-709d-4bae-985a-90ed5a53ae11_1338x576.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">My properties file with the versions: configuration. I tried it without the defined_in parameter too, but no luck. This file was in the correct directory and fct_orders was not declared anywhere else.</figcaption></figure></div><p>Upon trying to compile the v1 (dbt compile -s fct_orders:v1), dbt seemed to see two &#8220;fct_orders&#8221; models, one versioned and one unversioned.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Vtv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Vtv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 424w, https://substackcdn.com/image/fetch/$s_!5Vtv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 848w, https://substackcdn.com/image/fetch/$s_!5Vtv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 1272w, https://substackcdn.com/image/fetch/$s_!5Vtv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Vtv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png" width="1141" height="334" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:334,&quot;width&quot;:1141,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39851,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Vtv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 424w, https://substackcdn.com/image/fetch/$s_!5Vtv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 848w, https://substackcdn.com/image/fetch/$s_!5Vtv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 1272w, https://substackcdn.com/image/fetch/$s_!5Vtv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdcbfb9f-666c-442a-bbe6-f25f7da5b85e_1141x334.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The error upon trying to compile the v1 version dbt compile -s fct_orders:v1. There was definitely only one fct_orders model and it was declared only once.</figcaption></figure></div><p>Also, interestingly, as soon as I created the fct_orders_v2 file, I got a server status error. But when I edited the file name to fct_orders__v2 (with double underscore), the server status went back to Ready. Go figure.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Pppr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Pppr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 424w, https://substackcdn.com/image/fetch/$s_!Pppr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 848w, https://substackcdn.com/image/fetch/$s_!Pppr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 1272w, https://substackcdn.com/image/fetch/$s_!Pppr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Pppr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png" width="667" height="430" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/df57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:430,&quot;width&quot;:667,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39236,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/180279999?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Pppr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 424w, https://substackcdn.com/image/fetch/$s_!Pppr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 848w, https://substackcdn.com/image/fetch/$s_!Pppr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 1272w, https://substackcdn.com/image/fetch/$s_!Pppr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdf57e444-60c6-4451-9bd1-b06c6363bc6f_667x430.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I will revisit this eventually, but I needed to move on with the Practice Project. I wanted to be honest and show you how, even after reviewing documentation thoroughly, some configurations are tricky to set up in a real-life environment.</p><p>If anyone&#8217;s got any clue as to what could be causing this issue, send me a message or leave a comment!</p>]]></content:encoded></item><item><title><![CDATA[Practice Project: Checkpoint 4 - Part 2]]></title><description><![CDATA[Let's add live data to our project and configure our first incremental model.]]></description><link>https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-c38</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part-c38</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Sat, 22 Nov 2025 14:13:05 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!KldJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KldJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KldJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 424w, https://substackcdn.com/image/fetch/$s_!KldJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 848w, https://substackcdn.com/image/fetch/$s_!KldJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 1272w, https://substackcdn.com/image/fetch/$s_!KldJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KldJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png" width="1176" height="405" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/efcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:405,&quot;width&quot;:1176,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:600288,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KldJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 424w, https://substackcdn.com/image/fetch/$s_!KldJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 848w, https://substackcdn.com/image/fetch/$s_!KldJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 1272w, https://substackcdn.com/image/fetch/$s_!KldJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefcd3539-3525-40d0-a3da-eb45adb016cf_1176x405.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://andrealeonel.substack.com/p/incremental-materialisations">Incremental materialisation</a> is one of the trickier configurations of dbt. It requires attention to detail as the placement of the configs affects how and when the incremental rows will be processed.</p><p>I covered only the essentials in incremental materialisations in this post due to a limitation of my adapter&#8217;s free tier. I think a real-life scenario would present more challenges than I was able to replicate here.</p><p>Still, this is good practice to understand the intricacies of this type of materialisation and the many ways in which it can be configured.</p><div><hr></div><h3>Incorporating live data into our project:</h3><p>So far, we have been working with static data in our Practice Project. Now, thanks to <a href="https://leo-godin.medium.com/learn-dbt-with-real-fake-data-68d6d21c3e8f">Leo Godin&#8217;s efforts in setting this fake database up</a>, we are going to add live data.</p><p>Our project will now receive new orders every day. We will assume no new employees, products, or companies are added. Only new orders.</p><h4>Setting up the new connection:</h4><p>Godin&#8217;s data is hosted in a public BigQuery dataset that we can directly add as a source to our project. You can view documentation on the full dataset <a href="https://leogodin217.github.io/dbt-fake/#!/model/model.dbt_fake_company.companies_base#columns">here</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XdH0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XdH0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 424w, https://substackcdn.com/image/fetch/$s_!XdH0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 848w, https://substackcdn.com/image/fetch/$s_!XdH0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 1272w, https://substackcdn.com/image/fetch/$s_!XdH0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XdH0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png" width="1287" height="415" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:415,&quot;width&quot;:1287,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53669,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XdH0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 424w, https://substackcdn.com/image/fetch/$s_!XdH0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 848w, https://substackcdn.com/image/fetch/$s_!XdH0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 1272w, https://substackcdn.com/image/fetch/$s_!XdH0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6aba8be-afda-48f8-9165-ba5280d08a28_1287x415.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Adding live data to our sources.yml file.</figcaption></figure></div><h4>Replacing the source of our orders table:</h4><p>Now, we are going to replace the orders source in the &#8220;stg_orders&#8221; model. Optionally, you can also remove the static orders table from the source.yml file or use the &#8220;enable: false&#8221; property to remove it from the project.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LXSd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LXSd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 424w, https://substackcdn.com/image/fetch/$s_!LXSd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 848w, https://substackcdn.com/image/fetch/$s_!LXSd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 1272w, https://substackcdn.com/image/fetch/$s_!LXSd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LXSd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png" width="1140" height="504" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:504,&quot;width&quot;:1140,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62030,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LXSd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 424w, https://substackcdn.com/image/fetch/$s_!LXSd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 848w, https://substackcdn.com/image/fetch/$s_!LXSd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 1272w, https://substackcdn.com/image/fetch/$s_!LXSd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda999dd6-335d-466d-b9c3-d4ab80535cb2_1140x504.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The orders are now captured from the live table.</figcaption></figure></div><h4>Configuring the incremental materialisation:</h4><p>You want to add the incremental strategy in the layer where the heaviest transformations take place. This way, these costly operations will only be applied to new rows at each run. </p><p>In our case, the optimal model is int_orders_detail. We are also going to implement a merge strategy and limit the scan of new records to orders from 2025. We are taking the assumption that orders from previous years never change.</p><p>Please note that I&#8217;m working on BigQuery&#8217;s free tier in this project, which doesn&#8217;t support DML queries. Therefore, even with the correct configurations, the &#8220;dbt build&#8221; command will still fail. However, the logs will show us that dbt tried to implement the incremental materialisation.</p><p><strong>dbt_project.yml configuration</strong></p><p>According to the <a href="https://docs.getdbt.com/docs/build/incremental-strategy">documentation</a>, you can add the incremental configurations to the dbt_project.yml or the model itself.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IwGf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IwGf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 424w, https://substackcdn.com/image/fetch/$s_!IwGf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 848w, https://substackcdn.com/image/fetch/$s_!IwGf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 1272w, https://substackcdn.com/image/fetch/$s_!IwGf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IwGf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png" width="1267" height="342" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:342,&quot;width&quot;:1267,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42771,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IwGf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 424w, https://substackcdn.com/image/fetch/$s_!IwGf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 848w, https://substackcdn.com/image/fetch/$s_!IwGf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 1272w, https://substackcdn.com/image/fetch/$s_!IwGf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7c2639d-3e61-42b8-b2f7-7152e86448d6_1267x342.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Setting up the incremental materialisation in the dbt_project.yml file. Some parameters are underlined red, but these are false warnings.</figcaption></figure></div><p>Upon trying to build the models, the command fails and the logs show that dbt tried to run a DML query, but my adapter has billing disabled.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!shyQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!shyQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 424w, https://substackcdn.com/image/fetch/$s_!shyQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 848w, https://substackcdn.com/image/fetch/$s_!shyQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 1272w, https://substackcdn.com/image/fetch/$s_!shyQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!shyQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png" width="1114" height="232" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:232,&quot;width&quot;:1114,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34747,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!shyQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 424w, https://substackcdn.com/image/fetch/$s_!shyQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 848w, https://substackcdn.com/image/fetch/$s_!shyQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 1272w, https://substackcdn.com/image/fetch/$s_!shyQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F69386b92-cf8d-417d-833e-a77c435a9f79_1114x232.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Logs from the failed build of int_orders_detail.</figcaption></figure></div><p><strong>In-model configuration</strong></p><p>Using a config block, we can set all the configs for the incremental materialisation in the block itself. Remember that this block can be placed strategically in the code (for example, after the data has been filtered).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ssYN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ssYN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 424w, https://substackcdn.com/image/fetch/$s_!ssYN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 848w, https://substackcdn.com/image/fetch/$s_!ssYN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 1272w, https://substackcdn.com/image/fetch/$s_!ssYN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ssYN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png" width="1206" height="463" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:463,&quot;width&quot;:1206,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46561,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ssYN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 424w, https://substackcdn.com/image/fetch/$s_!ssYN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 848w, https://substackcdn.com/image/fetch/$s_!ssYN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 1272w, https://substackcdn.com/image/fetch/$s_!ssYN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09d95854-ec3a-4832-b4cd-c6f797e24a1d_1206x463.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Setting the int_orders_detail as an incremental model.</figcaption></figure></div><p>The logs are even more detailed in this case. You can see dbt tried to merge the new records, applied our predicates, and only searched for new records within orders from 2025.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lKiB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lKiB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 424w, https://substackcdn.com/image/fetch/$s_!lKiB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 848w, https://substackcdn.com/image/fetch/$s_!lKiB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 1272w, https://substackcdn.com/image/fetch/$s_!lKiB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lKiB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png" width="1045" height="360" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:360,&quot;width&quot;:1045,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23338,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lKiB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 424w, https://substackcdn.com/image/fetch/$s_!lKiB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 848w, https://substackcdn.com/image/fetch/$s_!lKiB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 1272w, https://substackcdn.com/image/fetch/$s_!lKiB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64b54865-2e22-4c75-8496-dee1098a246e_1045x360.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The logs of my failed build showed that the compiled code included a merge statement.</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WhOJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WhOJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 424w, https://substackcdn.com/image/fetch/$s_!WhOJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 848w, https://substackcdn.com/image/fetch/$s_!WhOJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 1272w, https://substackcdn.com/image/fetch/$s_!WhOJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WhOJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png" width="1042" height="538" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:538,&quot;width&quot;:1042,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:69682,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WhOJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 424w, https://substackcdn.com/image/fetch/$s_!WhOJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 848w, https://substackcdn.com/image/fetch/$s_!WhOJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 1272w, https://substackcdn.com/image/fetch/$s_!WhOJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec1c2a99-f0d8-48c7-bb16-fc3670265777_1042x538.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">dbt is limiting the scan as per our predicates and clearly outlines what to do for each record.</figcaption></figure></div><p>We can also apply a simpler configuration to your incremental materialisation using the is_incremental macro:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ef9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ef9u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 424w, https://substackcdn.com/image/fetch/$s_!ef9u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 848w, https://substackcdn.com/image/fetch/$s_!ef9u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 1272w, https://substackcdn.com/image/fetch/$s_!ef9u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ef9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png" width="1297" height="549" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:549,&quot;width&quot;:1297,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:57572,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/179488561?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ef9u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 424w, https://substackcdn.com/image/fetch/$s_!ef9u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 848w, https://substackcdn.com/image/fetch/$s_!ef9u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 1272w, https://substackcdn.com/image/fetch/$s_!ef9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbdc8b2ea-8d01-4d7d-9504-0d86e7b7f5d8_1297x549.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Applying the is_incremental macro to process new rows only.</figcaption></figure></div><p>While incremental_predicates filter the rows that the warehouse will consider during the MERGE step, is_incremental( ) filters the rows selected from your source before the merge happens.</p>]]></content:encoded></item><item><title><![CDATA[Week 13-14: New study notes and landing a job in the age of AI recruiting]]></title><description><![CDATA[Plus, Python models, Jinja & macros and beginning of the Practice Project.]]></description><link>https://andrealeonel.substack.com/p/week-13-14-new-study-notes-and-landing</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/week-13-14-new-study-notes-and-landing</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Mon, 17 Nov 2025 10:01:53 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!4W9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4W9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4W9u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 424w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 848w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1272w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" width="960" height="318" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:318,&quot;width&quot;:960,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:525829,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/173207390?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4W9u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 424w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 848w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1272w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The past 2 weeks have been hectic as I started a new job AND moved flats in the same week - I do not recommend it!</p><p>I did slow down with the posts a bit, but I have no intention of abandoning this project. With a full-time job, I&#8217;ll obviously need to adapt my schedule, but I aim to post at least once a week.</p><p>Speaking of the new job, in addition to the study notes from the past two weeks, I've included some valuable tips for landing a job in the age of AI recruiting below. Next week, I&#8217;ll share more about my new job itself.</p><div><hr></div><h3>Study notes added: </h3><p>We finished the topics for Checkpoint 4 and began applying our learnings to the Practice Project. We covered a lot of topics in this Checkpoint, so the Practice posts will be broken into a few different parts.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;43b5713a-a598-49c1-8d6f-932e9b34364a&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Python models&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-11-05T19:15:42.406Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!Vnc6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/python-models&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:177765627,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;63914e7e-0f39-4260-9263-f3f60d9f6f35&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Jinja &amp; Macros within dbt&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-11-06T21:42:13.950Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!sURC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/jinja-and-macros-within-dbt&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:178114177,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;8b3edfeb-13ac-4aba-aabc-e8d2a80dd3e5&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!Join hundreds of aspiring dbt developers &amp; data analysts!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Practice Project: Checkpoint 4 - Part 1&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:86941928,&quot;name&quot;:&quot;Andrea Leonel&quot;,&quot;bio&quot;:&quot;Woman travels solo around the world and writes about it&quot;,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/edaed6ba-e79c-4627-8606-986981a657e1_1125x1125.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-11-09T18:35:57.586Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!0F5H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:175751983,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">A full list of the study notes is available in the study guide.</a></p><div><hr></div><h3>Here&#8217;s how to land a job in the age of AI recruiting</h3><p>TL;DR: Work on side projects (like this dbt Study Guide) and talk about them on LinkedIn to increase your profile visibility.</p><p>I quit my data job in July 2024 to freelance and upskill. A year later, I felt the need to put my new skills into practice, so I began job hunting.</p><p>I started searching while in Europe, but the market was flat. After months of insisting, I made the tough call to return to Brazil&#8212;where I got hired in under a month.</p><p>However, even though the Brazilian tech market was booming, I never landed an interview for the dozens of jobs I proactively applied for. But every week, recruiters kept approaching me on LinkedIn. One of those messages led to the job I just started.</p><p>Sure, my 10-year on-and-off experience in data and a recent Big 4 contract helped to attract the recruiters. But it&#8217;s also worth noting that since launching my Study Guide, my LinkedIn visibility increased 9&#215;.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zs0V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zs0V!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 424w, https://substackcdn.com/image/fetch/$s_!zs0V!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 848w, https://substackcdn.com/image/fetch/$s_!zs0V!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 1272w, https://substackcdn.com/image/fetch/$s_!zs0V!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zs0V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png" width="1168" height="604" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:604,&quot;width&quot;:1168,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31198,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/178113773?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zs0V!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 424w, https://substackcdn.com/image/fetch/$s_!zs0V!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 848w, https://substackcdn.com/image/fetch/$s_!zs0V!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 1272w, https://substackcdn.com/image/fetch/$s_!zs0V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F595ba743-863e-46bf-b63d-949fa4a68287_1168x604.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">My LinkedIn profile impressions.</figcaption></figure></div><p>The first big spike came when I announced the dbt Study Guide on 30th July (23.5k impressions). The next jump happened when I posted about speaking at the dbt Labs HQ in Dublin.</p><p>During this period, I gained 699 new connections&#8212;loads of aspiring data pros, but over half were senior professionals and people in IT services and consulting. LinkedIn won&#8217;t show how many recruiters follow me, but they definitely sit within these groups.</p><p>The bottom line: </p><p>AI has transformed job hunting. Candidates can now blast tailored CVs at scale, and HR teams use AI to filter the flood. Speaking to a human about your skills is harder than ever.</p><p>So, you need to let the recruiters come to you.</p><p>Show your work publicly. Share your learning, your projects, your Zoomcamps&#8212;whatever you&#8217;re building while you&#8217;re job searching.</p><p>Don&#8217;t stand still during your job search, applying mindlessly. Stand out and show yourself.</p><p>(Speaking of which, <a href="https://datatalks.club/blog/data-engineering-zoomcamp.html">DataTalks Club has a new cohort for their Data Engineering zoomcamp</a> coming up soon!)</p><div><hr></div><p><em>Does this make sense to you? I would love to hear from you here or on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p>]]></content:encoded></item><item><title><![CDATA[Practice Project: Checkpoint 4 - Part 1]]></title><description><![CDATA[Adding Seeds, installing Packages from different sources and writing custom macros.]]></description><link>https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/practice-project-checkpoint-4-part</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Sun, 09 Nov 2025 18:35:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0F5H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0F5H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0F5H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 424w, https://substackcdn.com/image/fetch/$s_!0F5H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 848w, https://substackcdn.com/image/fetch/$s_!0F5H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 1272w, https://substackcdn.com/image/fetch/$s_!0F5H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0F5H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png" width="1180" height="351" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:351,&quot;width&quot;:1180,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:520930,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0F5H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 424w, https://substackcdn.com/image/fetch/$s_!0F5H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 848w, https://substackcdn.com/image/fetch/$s_!0F5H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 1272w, https://substackcdn.com/image/fetch/$s_!0F5H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa2b57814-516b-48f0-8a87-c61edfe4256c_1180x351.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We covered a fair amount of ground in <a href="https://andrealeonel.substack.com/i/169603250/doing-more-with-dbt">Checkpoint 4</a>, so we will need to break the Practice Project posts into multiple parts.</p><p>In Part 1, we will cover adding Seeds and installing Packages and Macros.</p><p>We will then continue with further posts covering Incremental Materialisations, Model Governance, Grants, Snapshots, Python models, Exposures, and Documentation.</p><div><hr></div><h3>Seeds</h3><p>(All CSV files are <a href="https://github.com/andrea-leonel/dbt_exam_practice/tree/main/seeds">in my git repo</a>. Link to <a href="https://andrealeonel.substack.com/p/a-deep-dive-into-seeds">study note</a>)</p><p>You are the Data Analyst in our B2B corporation (I should&#8217;ve made up a name for it, too late now), and you received requests from 3 different teams.</p><h4>Requests</h4><p>Request 1: The Sales Revenue department requested some additions to the fct_orders table. They asked for two new columns:</p><ul><li><p>A state_code column to understand where those orders were shipped to. They asked for the 2-letter code for the state of each employee who placed the order.</p></li></ul><p>Let&#8217;s remember what our DAG looks like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!A31b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!A31b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 424w, https://substackcdn.com/image/fetch/$s_!A31b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 848w, https://substackcdn.com/image/fetch/$s_!A31b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 1272w, https://substackcdn.com/image/fetch/$s_!A31b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!A31b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png" width="1200" height="520" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:520,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:106255,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!A31b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 424w, https://substackcdn.com/image/fetch/$s_!A31b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 848w, https://substackcdn.com/image/fetch/$s_!A31b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 1272w, https://substackcdn.com/image/fetch/$s_!A31b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38bd6dd7-a855-406c-9c10-9afebe337ea4_1200x520.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You could go ahead and add the new column only to the fct_orders table. But, if you want to future-proof your work, the best practice would be to add it to the stg_employees table so the column can be reused by other models, if needed. </p><p>In the case of a very large seed (which is not the case here), you could also consider adding it to the int_order_details model for performance.<br></p><p>Request 2: The User Support department needs to identify the countries that they need to call when contacting an employee by phone. They use the dim_employees table to find this information.</p><ul><li><p>Add an area_code column to dim_employees to identify the area code that each employee has on their phone numbers</p></li></ul><p>Again, this is one to be added to the staging layer for reusability.  </p><p></p><p>Request 3: A specific team from the Operations department said that some products are not produced in-house, so they don&#8217;t need to track them. They said they keep having to apply manual filters by prod_id to their Excel sheets, and it&#8217;s annoying. Other teams still need to have visibility of the external products.</p><ul><li><p>Use the prod_ids csv file provided by them to create a seed identifying in-house and external products. Then add a column to the fct_product_trend table with this information so they can filter by it.</p></li></ul><p>The fct_product_trend also pulls from the int_order_details table. Similar to the first request, we are going to add the new column to the staging layer (stg_products) for reusability.</p><h4>Configuring the new seeds</h4><p>To fulfill the 3 requests above, we had to add 3 new seeds into our project. It&#8217;s time to configure them.</p><p>Let&#8217;s start by adding a properties.yml file to the seeds directory.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5C0u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5C0u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 424w, https://substackcdn.com/image/fetch/$s_!5C0u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 848w, https://substackcdn.com/image/fetch/$s_!5C0u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 1272w, https://substackcdn.com/image/fetch/$s_!5C0u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5C0u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png" width="1155" height="853" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:853,&quot;width&quot;:1155,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108403,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5C0u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 424w, https://substackcdn.com/image/fetch/$s_!5C0u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 848w, https://substackcdn.com/image/fetch/$s_!5C0u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 1272w, https://substackcdn.com/image/fetch/$s_!5C0u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee431b82-16b7-438d-8cfd-0bfaf68c7f59_1155x853.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I added only documentation properties. In the future, we will spice them up with data tests.</p><p>You can also define configurations in dbt_project.yml for your seeds. In this case, I did not need quoting, set a different delimiter, or change data types, so I did not configure them in the project file to reduce clutter.</p><div><hr></div><h3>Packages &amp; macros</h3><p>(Link to <a href="https://andrealeonel.substack.com/p/understanding-project-dependencies">study note</a>)</p><p>This is not the first time we touch on Packages. In previous checkpoints, we added macros from dbt Hub (generate_surrogate_key and date_spine from dbt_utils).</p><p>In this step, we have a few tasks:</p><ul><li><p>Practice adding Packages from other sources: Git and internal Packages. </p></li><li><p>Understand &#8220;dbt clean&#8221; in practice.</p></li><li><p>Add our own macros using Jinja to improve our code reusability.</p></li></ul><h4>Adding Packages from Git and Internal Packages</h4><p><strong>Let&#8217;s start with a Git package.</strong></p><p>In my project&#8217;s repo, I created a core_macros folder, which essentially acts as an external project I will add to my main project. Thus, it requires its own dbt_project.yml file and, of course, the macro we will be using.</p><p>I created a simple macro that outputs a string and stored it in this file structure:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Wtwi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Wtwi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 424w, https://substackcdn.com/image/fetch/$s_!Wtwi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 848w, https://substackcdn.com/image/fetch/$s_!Wtwi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 1272w, https://substackcdn.com/image/fetch/$s_!Wtwi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Wtwi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png" width="1039" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38654,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Wtwi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 424w, https://substackcdn.com/image/fetch/$s_!Wtwi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 848w, https://substackcdn.com/image/fetch/$s_!Wtwi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 1272w, https://substackcdn.com/image/fetch/$s_!Wtwi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7cbc4811-3295-4ee7-9081-78fef1bcdfca_1039x450.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">I created a subdirectory within my main project repo to store the macro. </figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8frR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8frR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 424w, https://substackcdn.com/image/fetch/$s_!8frR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 848w, https://substackcdn.com/image/fetch/$s_!8frR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 1272w, https://substackcdn.com/image/fetch/$s_!8frR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8frR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png" width="967" height="225" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:225,&quot;width&quot;:967,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13506,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8frR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 424w, https://substackcdn.com/image/fetch/$s_!8frR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 848w, https://substackcdn.com/image/fetch/$s_!8frR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 1272w, https://substackcdn.com/image/fetch/$s_!8frR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6697156-c420-42a3-b72d-b4b04ee2aea0_967x225.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">The dbt_project.yml of this subdirectory doesn&#8217;t require much configuration.</figcaption></figure></div><p>The next step is to add the macro to the packages.yml and run &#8220;dbt deps&#8221;:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!y94N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!y94N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 424w, https://substackcdn.com/image/fetch/$s_!y94N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 848w, https://substackcdn.com/image/fetch/$s_!y94N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 1272w, https://substackcdn.com/image/fetch/$s_!y94N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!y94N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png" width="976" height="228" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:228,&quot;width&quot;:976,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23440,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!y94N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 424w, https://substackcdn.com/image/fetch/$s_!y94N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 848w, https://substackcdn.com/image/fetch/$s_!y94N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 1272w, https://substackcdn.com/image/fetch/$s_!y94N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3f63c37f-d17d-462d-be8c-f7b44e4e20ea_976x228.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>One thing to note is that dbt will pin this package to a specific commit in package_lock.yml. Which means that if you make changes to the macro in a new commit, you need to edit this information in the package_lock file:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_IUO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_IUO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 424w, https://substackcdn.com/image/fetch/$s_!_IUO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 848w, https://substackcdn.com/image/fetch/$s_!_IUO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 1272w, https://substackcdn.com/image/fetch/$s_!_IUO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_IUO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png" width="1167" height="265" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:265,&quot;width&quot;:1167,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42889,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_IUO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 424w, https://substackcdn.com/image/fetch/$s_!_IUO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 848w, https://substackcdn.com/image/fetch/$s_!_IUO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 1272w, https://substackcdn.com/image/fetch/$s_!_IUO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ea52657-55f9-40f9-960e-12f23416f17f_1167x265.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Upon installing the git macro, dbt automatically pins it to a commit under revision.</figcaption></figure></div><p>Upon calling the macro, I need to use the subdirectory.macro_name reference so it finds the macro:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4d_K!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4d_K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 424w, https://substackcdn.com/image/fetch/$s_!4d_K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 848w, https://substackcdn.com/image/fetch/$s_!4d_K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 1272w, https://substackcdn.com/image/fetch/$s_!4d_K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4d_K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png" width="1102" height="396" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d94d77ea-1687-40f4-b832-291888162601_1102x396.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:396,&quot;width&quot;:1102,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36247,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4d_K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 424w, https://substackcdn.com/image/fetch/$s_!4d_K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 848w, https://substackcdn.com/image/fetch/$s_!4d_K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 1272w, https://substackcdn.com/image/fetch/$s_!4d_K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd94d77ea-1687-40f4-b832-291888162601_1102x396.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Git macro being called successfully. Core_macros is the name of the subdirectory in the repo where the macro lives.</figcaption></figure></div><p><strong>Now, let&#8217;s install an internally hosted macro:</strong></p><p>We will use the package project_evaluator available on dbt Hub, but we will install it using the tar.gz link: https://github.com/dbt-labs/dbt-project-evaluator/archive/refs/tags/v1.1.2.tar.gz</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KQH-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KQH-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 424w, https://substackcdn.com/image/fetch/$s_!KQH-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 848w, https://substackcdn.com/image/fetch/$s_!KQH-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 1272w, https://substackcdn.com/image/fetch/$s_!KQH-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KQH-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png" width="1344" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1344,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22989,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KQH-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 424w, https://substackcdn.com/image/fetch/$s_!KQH-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 848w, https://substackcdn.com/image/fetch/$s_!KQH-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 1272w, https://substackcdn.com/image/fetch/$s_!KQH-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9d6f3ff1-441e-42e7-8a56-3ed17359e1e2_1344x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Installing the Package via tarball link.</figcaption></figure></div><p>After installing it with &#8220;dbt deps&#8221;, you can run the package&#8217;s models with the following command: dbt run --select package:dbt_project_evaluator</p><p>I&#8217;m running this project on a free tier of BigQuery, so my adapter won&#8217;t allow the tables to be created. But, inspecting the logs, I can see the package was successfully installed.</p><h4>Understanding dbt clean: uninstalling project_evaluator</h4><p>Since our adapter&#8217;s free tier doesn&#8217;t allow us to use the dbt_project_evaluator package, we should now remove it.</p><p>The steps for removing a package are:</p><ul><li><p>Remove the package from package.yml.</p></li><li><p>Delete the package_lock.yml file.</p></li><li><p>Run dbt clean to empty the dbt_packages folder.</p></li><li><p>Run dbt deps to reinstall the previous packages.</p></li></ul><p>If you inspect the newly created package_lock, you will see that dbt_project evaluator is no longer there.</p><h4>Adding custom macros to our project</h4><p>When we created the intermediate models for the orders, we added some case whens to define the level of discount based of time since joined as well as volume of orders. We also had a VAT that would vary according to the product category.</p><p>In order to ensure that the same logic is used across the company and to make this code easier to maintain, we should make them as re-usable macros.</p><p>Therefore, we are going to create 3 macros:</p><ul><li><p>disc_loyalty: companies with over 2 years of registering get a 5% discount, those with over 5 years get 10%. If less than 2 years, companies with over 200 orders placed get 4% discount. </p></li><li><p>disc_volume: employees who placed over 100 orders get 5% discount, those with more than 50 orders get 3% and those with over 10 get a whopping 1% off.</p></li><li><p>vat_category: certain categories have different VATs. Instead of the standard 18%, food has 5% VAT, electronics has 20% VAT, and clothing has 12% VAT.</p></li></ul><p>I created a file for the 2 macros related to discount calculations:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KVtS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KVtS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 424w, https://substackcdn.com/image/fetch/$s_!KVtS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 848w, https://substackcdn.com/image/fetch/$s_!KVtS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 1272w, https://substackcdn.com/image/fetch/$s_!KVtS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KVtS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png" width="1273" height="717" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:717,&quot;width&quot;:1273,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:92038,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KVtS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 424w, https://substackcdn.com/image/fetch/$s_!KVtS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 848w, https://substackcdn.com/image/fetch/$s_!KVtS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 1272w, https://substackcdn.com/image/fetch/$s_!KVtS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F860f9d85-9c6d-4da7-9135-9280c1c5ad0d_1273x717.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And finally, a separate file for the vat calculation:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IaDs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IaDs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 424w, https://substackcdn.com/image/fetch/$s_!IaDs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 848w, https://substackcdn.com/image/fetch/$s_!IaDs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 1272w, https://substackcdn.com/image/fetch/$s_!IaDs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IaDs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png" width="1069" height="358" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:358,&quot;width&quot;:1069,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50214,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IaDs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 424w, https://substackcdn.com/image/fetch/$s_!IaDs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 848w, https://substackcdn.com/image/fetch/$s_!IaDs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 1272w, https://substackcdn.com/image/fetch/$s_!IaDs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F348689de-2436-484b-bbde-dfd517aa73d9_1069x358.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now, we will call these macros in the intermediate models. For example:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rjbj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rjbj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 424w, https://substackcdn.com/image/fetch/$s_!rjbj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 848w, https://substackcdn.com/image/fetch/$s_!rjbj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 1272w, https://substackcdn.com/image/fetch/$s_!rjbj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rjbj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png" width="1284" height="328" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:328,&quot;width&quot;:1284,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45692,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/175751983?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rjbj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 424w, https://substackcdn.com/image/fetch/$s_!rjbj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 848w, https://substackcdn.com/image/fetch/$s_!rjbj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 1272w, https://substackcdn.com/image/fetch/$s_!rjbj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ca5e0d6-e5de-4f67-8793-9e39c95acf1f_1284x328.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div>]]></content:encoded></item><item><title><![CDATA[Jinja & Macros within dbt]]></title><description><![CDATA[An overview of using Jinja to build custom macros in dbt.]]></description><link>https://andrealeonel.substack.com/p/jinja-and-macros-within-dbt</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/jinja-and-macros-within-dbt</guid><pubDate>Thu, 06 Nov 2025 21:42:13 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!sURC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/docs/build/jinja-macros">Jinja &amp; Macros </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>We have covered <a href="https://andrealeonel.substack.com/p/understanding-project-dependencies">macros in the context of Packages in a previous post.</a> For this post, we will touch on how to create custom macros using Jinja. </p><p>We&#8217;ll also take the opportunity to understand how Jinja works in the dbt context and some best practices for using Jinja &amp; Macros.</p><div><hr></div><h3>What is Jinja?</h3><p>Jinja is a templating language that enhances the capabilities of SQL. dbt uses it in native functions like  {{ config() }} and {{ ref() }}. But you can also use it to create bespoke macros or within the models.</p><p>These are some examples of what Jinja enables you to do:</p><ul><li><p>Using if statements and for loops</p></li><li><p>Using environment variables for production deployments</p></li><li><p>Change the build according to the target</p></li><li><p>Pivot tables</p></li><li><p>Abstract SQL codes into reusable macros</p></li></ul><p>If you need support using Jinja, you can check out its <a href="http://If you need more support using Jinja, you can check out its own documentation.">own documentation</a> and the <a href="https://docs.getdbt.com/reference/dbt-jinja-functions">dbt-specific functions</a>, like ref and source. But the general syntax for Jinja is below:</p><ul><li><p>Expressions {{ &#8230; }} : when you want to output a string.</p></li><li><p>Statements {{% &#8230; %}} : used for if statements, for loops, or variable control.</p></li><li><p>Comments {{# &#8230; #}} : used for comments.</p></li><li><p>You can also use a minus sign to remove unwanted whitespace in the compiled code, for example {{- &#8230; -}} or {{%- &#8230; -%}}</p></li></ul><div><hr></div><h3>Jinja within models</h3><p>Within models, you can use Jinja for injecting variables, environment-based logic, and references, before dbt runs the model. Jinja is processed at compile time, so you can use &#8220;dbt compile&#8221; to ensure that your code is compiling correctly.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sURC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sURC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 424w, https://substackcdn.com/image/fetch/$s_!sURC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 848w, https://substackcdn.com/image/fetch/$s_!sURC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 1272w, https://substackcdn.com/image/fetch/$s_!sURC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sURC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png" width="955" height="324" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:324,&quot;width&quot;:955,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27367,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/178114177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!sURC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 424w, https://substackcdn.com/image/fetch/$s_!sURC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 848w, https://substackcdn.com/image/fetch/$s_!sURC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 1272w, https://substackcdn.com/image/fetch/$s_!sURC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F329197a9-69e7-470a-9d9c-1c61033d78a4_955x324.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Example of Jinja being used in a SQL model. Source: ChatGPT</figcaption></figure></div><div><hr></div><h3>Jinja within macros</h3><p>Macros are the dbt equivalent of functions. Macros are defined in SQL files stored in the &#8220;macros&#8221; directory or any other directory defined in &#8220;macros-paths&#8221;.</p><p>They use Jinja to create reusable code to be used across multiple models.</p><h4>Defining and using macros</h4><p>This is how a macro would be defined. A file can contain more than one macro:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jJeZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jJeZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 424w, https://substackcdn.com/image/fetch/$s_!jJeZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 848w, https://substackcdn.com/image/fetch/$s_!jJeZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 1272w, https://substackcdn.com/image/fetch/$s_!jJeZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jJeZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png" width="999" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:999,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26982,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/178114177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!jJeZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 424w, https://substackcdn.com/image/fetch/$s_!jJeZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 848w, https://substackcdn.com/image/fetch/$s_!jJeZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 1272w, https://substackcdn.com/image/fetch/$s_!jJeZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcda8ec54-c5eb-49f2-a78d-a8f988b12026_999x253.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Defining a macro. Source: <a href="https://docs.getdbt.com/docs/build/jinja-macros">Jinja &amp; Macros documentation</a></figcaption></figure></div><p>You can then use it as a function in the SQL model, entering any necessary arguments:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FrwO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FrwO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 424w, https://substackcdn.com/image/fetch/$s_!FrwO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 848w, https://substackcdn.com/image/fetch/$s_!FrwO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 1272w, https://substackcdn.com/image/fetch/$s_!FrwO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FrwO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png" width="999" height="288" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/390f4bd6-b0c0-4926-9450-a32021624476_999x288.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:288,&quot;width&quot;:999,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23669,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/178114177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!FrwO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 424w, https://substackcdn.com/image/fetch/$s_!FrwO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 848w, https://substackcdn.com/image/fetch/$s_!FrwO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 1272w, https://substackcdn.com/image/fetch/$s_!FrwO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F390f4bd6-b0c0-4926-9450-a32021624476_999x288.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A model calling the macro. Source: <a href="https://docs.getdbt.com/docs/build/jinja-macros">Jinja &amp; Macros documentation</a></figcaption></figure></div><p>Finally, this is what the compiled code would look like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5UOc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5UOc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 424w, https://substackcdn.com/image/fetch/$s_!5UOc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 848w, https://substackcdn.com/image/fetch/$s_!5UOc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 1272w, https://substackcdn.com/image/fetch/$s_!5UOc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5UOc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png" width="1002" height="255" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:255,&quot;width&quot;:1002,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:24081,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/178114177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!5UOc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 424w, https://substackcdn.com/image/fetch/$s_!5UOc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 848w, https://substackcdn.com/image/fetch/$s_!5UOc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 1272w, https://substackcdn.com/image/fetch/$s_!5UOc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee8845b2-e06b-480f-9dd1-855b7015d506_1002x255.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The compiled code containing the macro. Source: <a href="https://docs.getdbt.com/docs/build/jinja-macros">Jinja &amp; Macros documentation</a></figcaption></figure></div><h4>Macros properties</h4><p>Macros are not a resource like models, seeds, and snapshots. However, dbt allows them certain properties for documentation purposes.</p><p>Macro properties can only be defined in a properties.yml file stored within the &#8220;macros&#8221; subdirectory.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kRA9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kRA9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 424w, https://substackcdn.com/image/fetch/$s_!kRA9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 848w, https://substackcdn.com/image/fetch/$s_!kRA9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 1272w, https://substackcdn.com/image/fetch/$s_!kRA9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kRA9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png" width="994" height="586" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:586,&quot;width&quot;:994,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:63312,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/178114177?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kRA9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 424w, https://substackcdn.com/image/fetch/$s_!kRA9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 848w, https://substackcdn.com/image/fetch/$s_!kRA9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 1272w, https://substackcdn.com/image/fetch/$s_!kRA9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7353a89f-e3d0-4e58-8cff-7cce2dc83306_994x586.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/macro-properties">macro properties documentation</a></figcaption></figure></div><ul><li><p>name (required): must match the name of the macro file.</p></li><li><p>description (optional): a string that describes the macro for dbt Docs</p></li><li><p>docs (optional): shows or hides macros from dbt Docs</p></li><li><p>arguments (optional): defines the arguments the macro accepts - again, for documentation purposes only, it does not affect how the macro runs.</p></li></ul><div><hr></div><h3>Best practices for Jinja &amp; Macros</h3><h4>Readability vs. reusability</h4><p>It&#8217;s important to strike a balance between reusable code and readability. Too much Jinja in the model can make it hard for others to read.</p><h4>Variables</h4><p>Set the variables at the top of the macro/model.</p>]]></content:encoded></item><item><title><![CDATA[Python models]]></title><description><![CDATA[Use cases for Python models and how build and configure them.]]></description><link>https://andrealeonel.substack.com/p/python-models</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/python-models</guid><pubDate>Wed, 05 Nov 2025 19:15:42 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Vnc6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/docs/build/python-models">Python Models</a><a href="https://docs.getdbt.com/reference/commands/cmd-docs"> </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>SQL models serve the main purposes you may have within the dbt. However, some transformations cannot be performed in SQL, and at times, hundreds of lines of Jinja-SQL can be replaced by just a few lines of Python. In these cases, you may want to explore Python models.</p><p>Considering the limitations of Python models, which we will cover below, writing in SQL is still preferable. However, Python models enable developers to leverage Python&#8217;s open-source libraries for analysis while still being able to subject these models to dbt&#8217;s testing and documentation facilities.</p><p>The dbt Python models are run on the platform&#8217;s Python engine. Therefore, the adapter must support Python runtime.</p><h3>The structure of a Python model</h3><p>Each Python model is a .py file in the models folder. They begin with a function that takes two parameters: dbt and session. This function should return a final DataFrame. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vnc6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vnc6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 424w, https://substackcdn.com/image/fetch/$s_!Vnc6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 848w, https://substackcdn.com/image/fetch/$s_!Vnc6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 1272w, https://substackcdn.com/image/fetch/$s_!Vnc6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vnc6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png" width="1000" height="379" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:379,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29934,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!Vnc6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 424w, https://substackcdn.com/image/fetch/$s_!Vnc6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 848w, https://substackcdn.com/image/fetch/$s_!Vnc6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 1272w, https://substackcdn.com/image/fetch/$s_!Vnc6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F903300c3-1369-4ade-858f-4239a8f89e20_1000x379.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><ul><li><p><strong>dbt:</strong> enables you to reference other models and sources, get environment info, project configs, and other dbt metadata.</p></li><li><p><strong>session: </strong>dbt sends the code to the warehouse, and this parameter allows you to interact with the objects there.</p></li></ul><p>dbt uses Pandas DataFrames because it is the most common API for DataFrames. The downside is that Pandas works on a single node, which makes working on large datasets complex.</p><h3>Referencing other models and contexts</h3><p>Python models become a regular node in the DAG. You use the dbt.ref( ) or dbt.source( ) to reference models and sources. The Python model can also be ref&#8217;ed by SQL models.</p><p>Please note that Python models cannot reference ephemeral models. This type of materialisation inlines SQL code into the downstream model, and it is not possible to inline SQL code into a DataFrame.</p><p>For referencing contexts, you can use dbt.this(), dbt.this.database(), dbt.schema(), dbt.identifier().</p><p>You can also access var, env_var, and target names configured in the models config using the dbt.config.get( ), including the usage of f strings.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7IKz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7IKz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 424w, https://substackcdn.com/image/fetch/$s_!7IKz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 848w, https://substackcdn.com/image/fetch/$s_!7IKz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 1272w, https://substackcdn.com/image/fetch/$s_!7IKz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7IKz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png" width="1003" height="408" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:1003,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54738,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7IKz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 424w, https://substackcdn.com/image/fetch/$s_!7IKz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 848w, https://substackcdn.com/image/fetch/$s_!7IKz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 1272w, https://substackcdn.com/image/fetch/$s_!7IKz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4d5ee48-8010-48a1-acad-972fd52c94b2_1003x408.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><h3>Configuring Python models</h3><p>Similar to SQL models, Python models can be configured in the dbt_project.yml file, in the properties file, or in the model itself. Python models have access to almost all the configurations of SQL models. You can also select them using similar methods.</p><p>For on-model configuration, the {{ config() }} function is replaced by the dbt.config() method. While this is possible, more complex configurations should be done in a YAML file using the config property.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LywE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LywE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 424w, https://substackcdn.com/image/fetch/$s_!LywE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 848w, https://substackcdn.com/image/fetch/$s_!LywE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 1272w, https://substackcdn.com/image/fetch/$s_!LywE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LywE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png" width="1000" height="220" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:220,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21748,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LywE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 424w, https://substackcdn.com/image/fetch/$s_!LywE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 848w, https://substackcdn.com/image/fetch/$s_!LywE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 1272w, https://substackcdn.com/image/fetch/$s_!LywE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4db61d3-e5f5-4867-b55d-810ee28d1e2c_1000x220.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><h4>Materialisations</h4><p>Python models can be materialised as tables or incremental models.</p><p>The incremental Python models support the same incremental strategies as their SQL counterparts. Just like in SQL, you need to filter the tables for rows with new data. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZkcQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 424w, https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 848w, https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 1272w, https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png" width="948" height="708" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:708,&quot;width&quot;:948,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81533,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 424w, https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 848w, https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 1272w, https://substackcdn.com/image/fetch/$s_!ZkcQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F42e9da20-69bc-4ef1-b00e-49c2cd5ab532_948x708.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><h3>Python-specific functionality</h3><h4>Using and configuring PyPI packages</h4><p>You can use Python packages as long as they are installed in the Python runtime within your data platform. </p><p>dbt recommends configuring these packages so they can be added to the project&#8217;s metadata. This can be done in a model config file or within the model itself:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-Je2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-Je2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 424w, https://substackcdn.com/image/fetch/$s_!-Je2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 848w, https://substackcdn.com/image/fetch/$s_!-Je2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 1272w, https://substackcdn.com/image/fetch/$s_!-Je2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-Je2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png" width="1000" height="310" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:310,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19720,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!-Je2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 424w, https://substackcdn.com/image/fetch/$s_!-Je2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 848w, https://substackcdn.com/image/fetch/$s_!-Je2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 1272w, https://substackcdn.com/image/fetch/$s_!-Je2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4be60155-34d7-4dba-a518-0b6d0efb0fe2_1000x310.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Configuring packages in the config file. Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TL6b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TL6b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 424w, https://substackcdn.com/image/fetch/$s_!TL6b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 848w, https://substackcdn.com/image/fetch/$s_!TL6b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 1272w, https://substackcdn.com/image/fetch/$s_!TL6b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TL6b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png" width="1003" height="223" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:223,&quot;width&quot;:1003,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21290,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TL6b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 424w, https://substackcdn.com/image/fetch/$s_!TL6b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 848w, https://substackcdn.com/image/fetch/$s_!TL6b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 1272w, https://substackcdn.com/image/fetch/$s_!TL6b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb8d9919c-80d2-4891-81eb-7c34ade6f671_1003x223.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Configuring packages in the model itself. Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><h4>User-defined functions (UDFs)</h4><p>@udf functions are also supported in the Python models.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!NupY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NupY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 424w, https://substackcdn.com/image/fetch/$s_!NupY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 848w, https://substackcdn.com/image/fetch/$s_!NupY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 1272w, https://substackcdn.com/image/fetch/$s_!NupY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NupY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png" width="955" height="499" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:499,&quot;width&quot;:955,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58378,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NupY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 424w, https://substackcdn.com/image/fetch/$s_!NupY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 848w, https://substackcdn.com/image/fetch/$s_!NupY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 1272w, https://substackcdn.com/image/fetch/$s_!NupY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F94bd67e2-ebea-4712-9cff-af94a9d60345_955x499.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><h4>No code reuse</h4><p>Currently, functions and general code cannot be reused across models.</p><h3>Limitations of Python models</h3><p>While Python models give you access to more complex transformations and Python libraries, certain dbt features and Python functionalities are not available.</p><p>The IDE Preview button does not work for Python models. For previewing the result, you should use methods such as .head() or .show().</p><p>The print() function is not supported within dbt. For debugging, you may want to check the platform&#8217;s logs, return a DataFrame that contains your logs and build it into the data warehouse, or write messages into a column:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Xm2N!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Xm2N!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 424w, https://substackcdn.com/image/fetch/$s_!Xm2N!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 848w, https://substackcdn.com/image/fetch/$s_!Xm2N!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 1272w, https://substackcdn.com/image/fetch/$s_!Xm2N!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Xm2N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png" width="922" height="498" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:498,&quot;width&quot;:922,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:61178,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177765627?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Xm2N!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 424w, https://substackcdn.com/image/fetch/$s_!Xm2N!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 848w, https://substackcdn.com/image/fetch/$s_!Xm2N!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 1272w, https://substackcdn.com/image/fetch/$s_!Xm2N!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd6eb1ed-10d8-44f0-8652-e582e3658eee_922x498.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Writing debug messages into a column. Source: <a href="https://docs.getdbt.com/docs/build/python-models">Python models documentation</a></figcaption></figure></div><p>And finally, Python models are also slower to run than SQL models and more costly to compute.</p>]]></content:encoded></item><item><title><![CDATA[Generating documentation with dbt Docs]]></title><description><![CDATA[dbt natively supports a comprehensive documentation website full of possibilities.]]></description><link>https://andrealeonel.substack.com/p/generating-documentation-with-dbt</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/generating-documentation-with-dbt</guid><pubDate>Thu, 30 Oct 2025 23:07:48 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Gn94!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/docs/build/documentation">Documentation </a>and <a href="https://docs.getdbt.com/reference/commands/cmd-docs">dbt docs </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>It&#8217;s important to keep a thorough, up-to-date documentation of your projects so users and colleagues can quickly understand the content of the datasets. </p><p>dbt enables developers to easily configure and generate documentation for their projects using descriptions and commands. </p><p>The documentation generated includes an overview of the project structure, descriptions of tables and columns, and information about the data warehouse.</p><p>dbt Docs is the feature available in the free plans, while paid users can use dbt Catalog. We&#8217;ll focus on dbt Docs here.</p><h3>Adding descriptions to your project</h3><p>Start by adding descriptions to tables and columns. They should be added to the same file where the data tests are declared.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Gn94!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Gn94!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 424w, https://substackcdn.com/image/fetch/$s_!Gn94!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 848w, https://substackcdn.com/image/fetch/$s_!Gn94!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 1272w, https://substackcdn.com/image/fetch/$s_!Gn94!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Gn94!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png" width="994" height="682" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:682,&quot;width&quot;:994,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56423,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Gn94!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 424w, https://substackcdn.com/image/fetch/$s_!Gn94!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 848w, https://substackcdn.com/image/fetch/$s_!Gn94!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 1272w, https://substackcdn.com/image/fetch/$s_!Gn94!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/documentation">docs documentation</a></figcaption></figure></div><p>If you need a description longer than one sentence, use &#8220;&gt;&#8221;:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4H4a!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4H4a!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 424w, https://substackcdn.com/image/fetch/$s_!4H4a!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 848w, https://substackcdn.com/image/fetch/$s_!4H4a!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 1272w, https://substackcdn.com/image/fetch/$s_!4H4a!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4H4a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png" width="883" height="315" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:315,&quot;width&quot;:883,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36423,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4H4a!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 424w, https://substackcdn.com/image/fetch/$s_!4H4a!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 848w, https://substackcdn.com/image/fetch/$s_!4H4a!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 1272w, https://substackcdn.com/image/fetch/$s_!4H4a!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fa05d31-4caf-4b99-95db-08b17746a650_883x315.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/documentation">docs documentation</a></figcaption></figure></div><p>And to insert line breaks, use &#8220;|&#8221;:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JRVW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JRVW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 424w, https://substackcdn.com/image/fetch/$s_!JRVW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 848w, https://substackcdn.com/image/fetch/$s_!JRVW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 1272w, https://substackcdn.com/image/fetch/$s_!JRVW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JRVW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png" width="877" height="312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:312,&quot;width&quot;:877,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27264,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JRVW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 424w, https://substackcdn.com/image/fetch/$s_!JRVW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 848w, https://substackcdn.com/image/fetch/$s_!JRVW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 1272w, https://substackcdn.com/image/fetch/$s_!JRVW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae2e5c85-1e48-4b0d-b6d5-5002c2070877_877x312.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/documentation">docs documentation</a></figcaption></figure></div><p>You can also use a docs block to add more robust descriptions to your files.</p><h4>Using docs blocks</h4><p>Docs blocks allow developers to use Jinja and markdown in the descriptions.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zSY9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zSY9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 424w, https://substackcdn.com/image/fetch/$s_!zSY9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 848w, https://substackcdn.com/image/fetch/$s_!zSY9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 1272w, https://substackcdn.com/image/fetch/$s_!zSY9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zSY9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png" width="990" height="487" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:487,&quot;width&quot;:990,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46140,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zSY9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 424w, https://substackcdn.com/image/fetch/$s_!zSY9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 848w, https://substackcdn.com/image/fetch/$s_!zSY9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 1272w, https://substackcdn.com/image/fetch/$s_!zSY9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcff3ae79-99e3-4945-a6d4-976c6fb8d794_990x487.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/documentation#using-docs-blocks">docs documentation</a></figcaption></figure></div><p>You then point a description config to the relevant docs block using the doc( ) function:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Bqaq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Bqaq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 424w, https://substackcdn.com/image/fetch/$s_!Bqaq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 848w, https://substackcdn.com/image/fetch/$s_!Bqaq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 1272w, https://substackcdn.com/image/fetch/$s_!Bqaq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Bqaq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png" width="1000" height="430" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:430,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32767,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Bqaq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 424w, https://substackcdn.com/image/fetch/$s_!Bqaq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 848w, https://substackcdn.com/image/fetch/$s_!Bqaq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 1272w, https://substackcdn.com/image/fetch/$s_!Bqaq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc3d4d187-a1ed-4f60-82df-6027317855df_1000x430.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/documentation#using-docs-blocks">docs documentation</a></figcaption></figure></div><p>Docs block files need to be uniquely named and use the &#8220;docs&#8221; Jinja tag. Their name can contain alphanumeric digits and underscores, but it cannot start with a number. The file type is .md.</p><p>dbt will look for docs blocks in all resource paths. Alternatively, you can place all docs blocks in one folder and point &#8220;docs-path&#8221; to it.</p><p><strong>Using docs blocks for the overview page</strong></p><p>Within your docs website, dbt creates a default overview page with helpful information about the project.</p><p>You can override this with specific information about your company's style guide, links to reports, or relevant contact information.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kRQE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kRQE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 424w, https://substackcdn.com/image/fetch/$s_!kRQE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 848w, https://substackcdn.com/image/fetch/$s_!kRQE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 1272w, https://substackcdn.com/image/fetch/$s_!kRQE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kRQE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png" width="988" height="435" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:435,&quot;width&quot;:988,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56908,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kRQE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 424w, https://substackcdn.com/image/fetch/$s_!kRQE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 848w, https://substackcdn.com/image/fetch/$s_!kRQE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 1272w, https://substackcdn.com/image/fetch/$s_!kRQE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ff30f2c-f799-4117-a069-b5f374d5c8d5_988x435.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A docs block for a custom overview page. Source: <a href="https://docs.getdbt.com/docs/build/documentation#using-docs-blocks">docs documentation</a></figcaption></figure></div><h3>Using the dbt docs commands</h3><p>dbt docs has two supported commands: generate and serve. They can be run in the command line or, if using the IDE, set to be run during a job.</p><h4>dbt docs generate</h4><p>This command generates the documentation website following these steps:</p><ol><li><p>Copying an &#8220;index.html&#8221; into the &#8220;target/&#8221; directory.</p></li><li><p>Compiling the code and adding it to manifest.json.</p></li><li><p>Stores data warehouse metadata in the catalog.json file.</p></li></ol><p>The combination of manifest.json and catalog.json makes up the data that powers the docs website.</p><p><strong>Methods available for dbt docs generate:</strong></p><p>You can use the &#8220;--select&#8221; method to only add specific nodes to catalog.json:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3mm2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3mm2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 424w, https://substackcdn.com/image/fetch/$s_!3mm2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 848w, https://substackcdn.com/image/fetch/$s_!3mm2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 1272w, https://substackcdn.com/image/fetch/$s_!3mm2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3mm2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png" width="997" height="70" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:70,&quot;width&quot;:997,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:6010,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3mm2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 424w, https://substackcdn.com/image/fetch/$s_!3mm2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 848w, https://substackcdn.com/image/fetch/$s_!3mm2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 1272w, https://substackcdn.com/image/fetch/$s_!3mm2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb4e432aa-d1ab-4ff1-a895-6a4615e99a40_997x70.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/commands/cmd-docs">dbt docs documentation</a></figcaption></figure></div><p>The &#8220;--no-compile&#8221; method skips step 2, that is, it skips compilation.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!miWA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!miWA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 424w, https://substackcdn.com/image/fetch/$s_!miWA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 848w, https://substackcdn.com/image/fetch/$s_!miWA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 1272w, https://substackcdn.com/image/fetch/$s_!miWA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!miWA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png" width="988" height="79" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:79,&quot;width&quot;:988,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5597,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!miWA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 424w, https://substackcdn.com/image/fetch/$s_!miWA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 848w, https://substackcdn.com/image/fetch/$s_!miWA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 1272w, https://substackcdn.com/image/fetch/$s_!miWA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7001d1a1-7a59-42c1-8cdc-085c50b7821e_988x79.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/commands/cmd-docs">dbt docs documentation</a></figcaption></figure></div><p>The &#8220;--empty-catalog&#8221; does not populate the catalog.json, which can speed up the command in development. However, in production, you can end up excluding valuable warehouse information from the docs, like column types, stats, sample values, etc.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!krqC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!krqC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 424w, https://substackcdn.com/image/fetch/$s_!krqC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 848w, https://substackcdn.com/image/fetch/$s_!krqC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 1272w, https://substackcdn.com/image/fetch/$s_!krqC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!krqC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png" width="1000" height="67" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:67,&quot;width&quot;:1000,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:6288,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!krqC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 424w, https://substackcdn.com/image/fetch/$s_!krqC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 848w, https://substackcdn.com/image/fetch/$s_!krqC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 1272w, https://substackcdn.com/image/fetch/$s_!krqC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd84a075e-7a90-4188-9bd8-7c24d6c0dd0d_1000x67.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/commands/cmd-docs">dbt docs documentation</a></figcaption></figure></div><p>Use the &#8220;--static&#8221; method to generate a static page for hosting in cloud providers. When you generate a docs site, you still need to serve it (more on that below), so the index.html, manifest.json, and catalog.json files get loaded into the front end.</p><p>With this method, dbt creates a standalone index.html file that can be used externally.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!J2QZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!J2QZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 424w, https://substackcdn.com/image/fetch/$s_!J2QZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 848w, https://substackcdn.com/image/fetch/$s_!J2QZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 1272w, https://substackcdn.com/image/fetch/$s_!J2QZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!J2QZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png" width="999" height="78" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:78,&quot;width&quot;:999,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5705,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!J2QZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 424w, https://substackcdn.com/image/fetch/$s_!J2QZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 848w, https://substackcdn.com/image/fetch/$s_!J2QZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 1272w, https://substackcdn.com/image/fetch/$s_!J2QZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b10331f-eadc-4818-ac51-a1c85ca7552e_999x78.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/commands/cmd-docs">dbt docs documentation</a></figcaption></figure></div><h4>dbt docs serve</h4><p>After generating documentation with &#8220;dbt docs generate&#8221;, this command starts a web server on port 8080 to serve your documentation locally and launches it using the default browser.</p><p>You can also use several flags to adjust how this server is created:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zAAr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zAAr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 424w, https://substackcdn.com/image/fetch/$s_!zAAr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 848w, https://substackcdn.com/image/fetch/$s_!zAAr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 1272w, https://substackcdn.com/image/fetch/$s_!zAAr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zAAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png" width="993" height="196" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79103952-38ae-44de-be21-f03c736b9775_993x196.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:196,&quot;width&quot;:993,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18555,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177607505?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zAAr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 424w, https://substackcdn.com/image/fetch/$s_!zAAr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 848w, https://substackcdn.com/image/fetch/$s_!zAAr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 1272w, https://substackcdn.com/image/fetch/$s_!zAAr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79103952-38ae-44de-be21-f03c736b9775_993x196.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/commands/cmd-docs">dbt docs documentation</a></figcaption></figure></div>]]></content:encoded></item><item><title><![CDATA[Managing access permissions with Grants]]></title><description><![CDATA[Using and configuring Grants]]></description><link>https://andrealeonel.substack.com/p/managing-access-permissions-with</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/managing-access-permissions-with</guid><pubDate>Thu, 30 Oct 2025 21:35:58 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d47d3acf-0fee-4c42-80fc-c68d42571740_946x262.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/reference/resource-configs/grants">Grants </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>Grants can be defined for models, seeds, and snapshots to manage access to the datasets at build time. For resources with this config, dbt will run any grant or revoke statements when you run it. The grants will also be included in the JSON manifest.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0Rjc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0Rjc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 424w, https://substackcdn.com/image/fetch/$s_!0Rjc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 848w, https://substackcdn.com/image/fetch/$s_!0Rjc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 1272w, https://substackcdn.com/image/fetch/$s_!0Rjc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0Rjc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png" width="997" height="73" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:73,&quot;width&quot;:997,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10520,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177592634?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0Rjc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 424w, https://substackcdn.com/image/fetch/$s_!0Rjc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 848w, https://substackcdn.com/image/fetch/$s_!0Rjc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 1272w, https://substackcdn.com/image/fetch/$s_!0Rjc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0462b5c2-576a-4057-814d-da8f7b83f4aa_997x73.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Example of a grant statement run by the grant config. Source: <a href="https://docs.getdbt.com/reference/resource-configs/grants">grants documentation</a></figcaption></figure></div><p>Grants are usually defined in YAML files as a resource config. However, in specific cases, they might need to be defined in manual statements written in hooks:</p><ul><li><p>Apply grants to objects other than views and tables.</p></li><li><p>More granular access permissions (row or column level, for instance)</p></li><li><p>Apply them with advanced capabilities not offered out-of-the-box by dbt or that are adapter-specific.</p></li></ul><h3>Configuring grants</h3><p>Like other configs, grants can be declared in dbt_project.yml, in a properties file, or in the resource itself. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vAZN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vAZN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 424w, https://substackcdn.com/image/fetch/$s_!vAZN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 848w, https://substackcdn.com/image/fetch/$s_!vAZN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 1272w, https://substackcdn.com/image/fetch/$s_!vAZN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vAZN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png" width="946" height="262" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c62bee37-0be4-4e92-bedf-442178496ad4_946x262.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:262,&quot;width&quot;:946,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20400,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177592634?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vAZN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 424w, https://substackcdn.com/image/fetch/$s_!vAZN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 848w, https://substackcdn.com/image/fetch/$s_!vAZN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 1272w, https://substackcdn.com/image/fetch/$s_!vAZN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc62bee37-0be4-4e92-bedf-442178496ad4_946x262.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Configuring access to the users &#8220;reporter&#8221; and &#8220;bi&#8221;. Source: <a href="https://docs.getdbt.com/reference/resource-configs/grants">grants documentation</a></figcaption></figure></div><p>The grants config also follows the config inheritance pattern of other configs: the more specific config takes precedence.</p><p>However, an exclusive feature of this config is the &#8220;add and merge&#8221; behaviour. Say you have a group of models that has a grant configuration at properties.yml level, but you need a particular model to have additional users. Here&#8217;s how you can achieve this:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VK48!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VK48!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 424w, https://substackcdn.com/image/fetch/$s_!VK48!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 848w, https://substackcdn.com/image/fetch/$s_!VK48!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 1272w, https://substackcdn.com/image/fetch/$s_!VK48!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VK48!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png" width="997" height="135" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/900be833-dff4-43db-8265-df7964cf8435_997x135.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:135,&quot;width&quot;:997,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14994,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177592634?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VK48!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 424w, https://substackcdn.com/image/fetch/$s_!VK48!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 848w, https://substackcdn.com/image/fetch/$s_!VK48!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 1272w, https://substackcdn.com/image/fetch/$s_!VK48!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F900be833-dff4-43db-8265-df7964cf8435_997x135.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Using +select to add users to the grants configuration. Source: <a href="https://docs.getdbt.com/reference/resource-configs/grants">grants documentation</a></figcaption></figure></div><h3>Conditional grants</h3><p>Like any other config, you can use Jinja for more specific configurations. In the example below, the user access depends on the environment:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4rkG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4rkG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 424w, https://substackcdn.com/image/fetch/$s_!4rkG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 848w, https://substackcdn.com/image/fetch/$s_!4rkG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 1272w, https://substackcdn.com/image/fetch/$s_!4rkG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4rkG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png" width="988" height="223" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/af1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:223,&quot;width&quot;:988,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:20096,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177592634?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4rkG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 424w, https://substackcdn.com/image/fetch/$s_!4rkG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 848w, https://substackcdn.com/image/fetch/$s_!4rkG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 1272w, https://substackcdn.com/image/fetch/$s_!4rkG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faf1ef0dc-a58c-4828-b148-a2ca663dbba2_988x223.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/resource-configs/grants">grants documentation</a></figcaption></figure></div><h3>Revoking grants</h3><p>If you need to completely remove the access previously granted, deleting the grants configuration won&#8217;t do it. You need to give it an empty list, instead:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!l1V-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!l1V-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 424w, https://substackcdn.com/image/fetch/$s_!l1V-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 848w, https://substackcdn.com/image/fetch/$s_!l1V-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 1272w, https://substackcdn.com/image/fetch/$s_!l1V-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!l1V-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png" width="946" height="201" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:201,&quot;width&quot;:946,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11042,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177592634?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!l1V-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 424w, https://substackcdn.com/image/fetch/$s_!l1V-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 848w, https://substackcdn.com/image/fetch/$s_!l1V-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 1272w, https://substackcdn.com/image/fetch/$s_!l1V-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc230ff24-920d-4505-8af4-8a6c9b3c076d_946x201.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/resource-configs/grants">grants documentation</a></figcaption></figure></div>]]></content:encoded></item><item><title><![CDATA[Week 12: Model Governance fun and exciting news!]]></title><description><![CDATA[And a reminder to avoid accidentally firing an unfinished email to hundreds of people.]]></description><link>https://andrealeonel.substack.com/p/week-12</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/week-12</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Thu, 30 Oct 2025 01:10:25 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!4W9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4W9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4W9u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 424w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 848w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1272w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" width="960" height="318" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:318,&quot;width&quot;:960,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:525829,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/173207390?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4W9u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 424w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 848w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1272w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As I accidentally anticipated on Wednesday with an early publish (sorry about that!), this week we have gone deeper into a complex, but very important topic: Model Governance.</p><p>We have also covered simpler, but no less important features: Grants and Docs.</p><p>You can see the links to the new study notes below. And if you scroll down further, I have a bit of personal news!</p><div><hr></div><h3>Study notes added: </h3><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;01d4a6d4-e63a-4e89-9f84-2419aa2fd6bc&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Model Governance: access, contracts and namespaces&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-27T23:48:47.234Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!X8n4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/model-governance-access-contracts&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:177059194,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;e7b5307a-4143-40f6-b3f2-6b37c3d56f11&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;How and when to use Model Versioning&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-30T01:07:02.173Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!xxdE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/how-and-when-to-use-model-versioning&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:177417488,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;4611c27e-68cc-4b3e-918f-209dd6736355&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Managing access permissions with Grants&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-30T21:35:58.830Z&quot;,&quot;cover_image&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d47d3acf-0fee-4c42-80fc-c68d42571740_946x262.webp&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/managing-access-permissions-with&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:177592634,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;304ba51d-b3fa-403d-ba2b-21defbd83c5b&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Generating documentation with dbt Docs&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-30T23:07:48.830Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!Gn94!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea3e3045-6db8-4f22-ab16-2b524ecc7fde_994x682.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/generating-documentation-with-dbt&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:177607505,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p><a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">A full list of the study notes is available in the study guide.</a></p><div><hr></div><h3>Bye-bye, freelance life! Hello, full-time work!</h3><p>Last year, I was feeling a bit stagnated at my full-time job. I was in a Data Analyst role that was largely non-technical. And the company&#8217;s data infrastructure was still in its early development days.</p><p>This led me to quit my full-time job to venture into the freelance world. </p><p>I did want to make a consulting career happen, and I landed some interesting contracts. However, I also wanted to take this time as an opportunity to upskill.</p><p>I learned the fundamentals of Data Engineering with the <a href="https://datatalks.club/">DataTalks Zoomcamp</a>; I improved my SQL and Python skills; and I deep dived into data modelling and dbt (and hopefully will be certified soon!).</p><p>Just over 1 year later, the contracts started running a bit thin as life became harder for non-Europeans looking for work in Europe-based companies.</p><p>I felt like it was the right time to get back into full-time work and put all these new skills into practice.</p><p>I returned to my home country, where the job market was much better than in Europe, and landed a job in less than a month.</p><p>It&#8217;s a more technical Business Intelligence role within a large organisation with a mature data environment. The salary is fantastic too. I&#8217;m very excited!</p><p>In future weekly posts, I can share tips on how to land a data job (I&#8217;ve got a lot of experience in that!). But, for now, I just want to leave you with this message:</p><blockquote><p>Don&#8217;t be afraid to make a career move and take a risk, especially if you don&#8217;t have a family to support, like me. Obviously, don&#8217;t be dumb. Think strategically, prepare yourself financially, and don&#8217;t take it as a holiday. But, do take that leap and go see what&#8217;s out there, if you feel like that&#8217;s the right thing to do.</p></blockquote><div><hr></div><p><em>Have the study notes been useful to you so far? How are you getting on with your self-paced learning journey? I would love to hear from you here or on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p>]]></content:encoded></item><item><title><![CDATA[How and when to use Model Versioning]]></title><description><![CDATA[Use cases for model versioning and specific configs.]]></description><link>https://andrealeonel.substack.com/p/how-and-when-to-use-model-versioning</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/how-and-when-to-use-model-versioning</guid><pubDate>Thu, 30 Oct 2025 01:07:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!xxdE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">Model Versions</a> documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>In this post, we will dissect the definition, config, and best practices for Model Versions. This is part of the Model Governance section of the Study Guide, which also includes a post covering the other 3 features: <a href="https://andrealeonel.substack.com/p/model-governance-access-contracts">Access Modifiers, Model Contracts, and Namespaces.</a></p><h3>Table of contents</h3><ul><li><p><a href="https://andrealeonel.substack.com/i/177417488/what-why-and-when-model-versioning">What, why, and when: model versioning</a></p></li><li><p><a href="https://andrealeonel.substack.com/i/177417488/creating-a-model-version">Creating a model version</a></p></li><li><p><a href="https://andrealeonel.substack.com/i/177417488/configuring-a-model-version">Configuring a model version</a></p></li><li><p><a href="https://andrealeonel.substack.com/i/177417488/running-a-model-version">Running a model version</a></p></li><li><p><a href="https://andrealeonel.substack.com/i/177417488/optimising-model-versions">Optimising model versions</a></p></li></ul><div><hr></div><h3>What, why, and when: model versioning</h3><h4>Why version a model?</h4><p>Model versioning is a way to handle situations where you need to modify a model that&#8217;s already being used by downstream models or end-user tools. It serves 2 main purposes.</p><p><strong>Handling breaking changes</strong></p><p>When you run a model and it fails to build due to a breaking change (caused by a deleted column or changed data type, for example), all downstream models and end-user tools will be affected.</p><p>In smaller organisations, this may be an easy problem to solve. Fix the model, adjust downstream models and tools. Bob&#8217;s your uncle.</p><p>However, in larger organisations, a breaking change may affect tons of models and tools across different teams. Instead of making everyone react immediately, you can start working on a new version of the model while keeping the old version running without any breakage. This allows teams to migrate at their own pace without disrupting production workflows.</p><p><strong>Controlled change management</strong></p><p>Besides handling breaking changes, model versioning is also effective in deploying code changes in a controlled way. Model versioning enables developers to:</p><ul><li><p>Deploy a &#8220;pre-release&#8221; version in the same environment as the current one.</p></li><li><p>Gradually migrate downstream users to the new version.</p></li><li><p>Eventually, deprecate (using the &#8220;deprecation_date&#8221; config) and remove the old model when it&#8217;s no longer necessary.</p></li></ul><p><strong>When should you version a model?</strong></p><p>Create a new version of a model when you&#8217;re making modifications that intentionally break the model&#8217;s contract. If you&#8217;re making a non-breaking change, you don&#8217;t need a new version.</p><p>Remember that the process of deprecating an old model and adopting a new version takes time, resources, and collaboration between teams. When you stick to non-breaking changes, you avoid all of that, but at the cost of models with lots of unused columns. Weigh pros and cons and make a judgment call of what&#8217;s best for your use case.</p><p>You can also think of a schedule of releases where models get updated to the latest version periodically to clean the unused columns.</p><h4>Model versioning vs. Version control</h4><p>Version control is linked to <a href="https://andrealeonel.substack.com/p/getting-started-with-git-branching">branching strategies</a>. Your entire project goes to a separate branch for reviewing by the relevant teams. You can also leverage state to only rebuild changed resources. Changes can be rolled back by reverting to a previous commit.</p><p>Model versions live in the same branch and environment. They exist when people or processes outside of your team depend on the models. They enable you to offer a migration path with clear diffs and deprecation dates.</p><h4>Model versioning vs. New model</h4><p>What&#8217;s the difference between model versioning and duplicating an existing model and naming it &#8220;dim_customers_v2&#8221;?</p><p>Both have similar effects, but model versioning enables you to:</p><ul><li><p>Reuse model configuration.</p></li><li><p>You can tag a versioned model as latest, prerelease, or old, and build models based on this designation, using the &#8220;version&#8221; method.</p></li><li><p>deliver notification of deprecation or newer versions to consumers.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xxdE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xxdE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 424w, https://substackcdn.com/image/fetch/$s_!xxdE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 848w, https://substackcdn.com/image/fetch/$s_!xxdE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 1272w, https://substackcdn.com/image/fetch/$s_!xxdE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xxdE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png" width="1344" height="352" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:352,&quot;width&quot;:1344,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31272,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xxdE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 424w, https://substackcdn.com/image/fetch/$s_!xxdE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 848w, https://substackcdn.com/image/fetch/$s_!xxdE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 1272w, https://substackcdn.com/image/fetch/$s_!xxdE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c544fa4-39ba-4c07-b801-367c13c8d402_1344x352.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">An example of a <a href="https://andrealeonel.substack.com/p/the-4-key-dbt-commands-and-node-selectors">YAML selector </a>using the &#8220;version&#8221; method. Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!k0ZP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k0ZP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 424w, https://substackcdn.com/image/fetch/$s_!k0ZP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 848w, https://substackcdn.com/image/fetch/$s_!k0ZP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 1272w, https://substackcdn.com/image/fetch/$s_!k0ZP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k0ZP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png" width="1342" height="250" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:250,&quot;width&quot;:1342,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:51685,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k0ZP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 424w, https://substackcdn.com/image/fetch/$s_!k0ZP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 848w, https://substackcdn.com/image/fetch/$s_!k0ZP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 1272w, https://substackcdn.com/image/fetch/$s_!k0ZP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcdeeb32a-b6b7-4615-8d50-b222a2d3c363_1342x250.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Notification of prerelease version available. Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><div><hr></div><h3>Creating a model version</h3><p>The first step is to duplicate the relevant model, adjust the code as needed, and save it with a clear suffix (for instance, &#8220;_v2&#8221;).</p><p>Then, you are going to declare this new model as a version of a model, highlighting the changes made to it. You can also give it a full specification, but dbt recommends adding diffs only.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G-XX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G-XX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 424w, https://substackcdn.com/image/fetch/$s_!G-XX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 848w, https://substackcdn.com/image/fetch/$s_!G-XX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 1272w, https://substackcdn.com/image/fetch/$s_!G-XX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G-XX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png" width="1294" height="895" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:895,&quot;width&quot;:1294,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:107548,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!G-XX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 424w, https://substackcdn.com/image/fetch/$s_!G-XX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 848w, https://substackcdn.com/image/fetch/$s_!G-XX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 1272w, https://substackcdn.com/image/fetch/$s_!G-XX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F633da10e-0a1d-4b65-86ac-74b43acb89b2_1294x895.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Declaring multiple versions of a model (diffs only). Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><p>By adding the &#8220;v: 2&#8221; config, dbt will link it to a file named &#8220;dim_customers_v2&#8221;. dbt recommends following this convention, but if you need to override this, you can use the config &#8220;defined_in: file_name&#8221;.</p><p>Besides, dbt will automatically assign the &#8220;latest_version&#8221; to the greatest version number. In the config above, we assigned latest_version to v1, so dbt will automatically read v2 as a prerelease version. When v2 is ready to be deployed, we could change this config to v2 or remove it altogether.</p><div><hr></div><h3>Configuring a model version</h3><p>Each version can take standard model configurations (materialized, description, contract, etc) as well as the versioning-specific configs below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_Jou!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Jou!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 424w, https://substackcdn.com/image/fetch/$s_!_Jou!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 848w, https://substackcdn.com/image/fetch/$s_!_Jou!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 1272w, https://substackcdn.com/image/fetch/$s_!_Jou!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Jou!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png" width="1051" height="447" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:447,&quot;width&quot;:1051,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56744,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_Jou!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 424w, https://substackcdn.com/image/fetch/$s_!_Jou!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 848w, https://substackcdn.com/image/fetch/$s_!_Jou!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 1272w, https://substackcdn.com/image/fetch/$s_!_Jou!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F296d8a9b-165d-4379-8374-3fe69ae93e13_1051x447.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/resource-properties/versions">versions configuration</a></figcaption></figure></div><ul><li><p>V: denotes the version. It can an integer or a string. dbt sorts versions by ascending numeric or alphabetical order.</p></li><li><p>defined in (optional): defines the model name related to this version. This is in case you don&#8217;t use the naming convention &lt;model_name&gt;_v&lt;v&gt;.</p></li><li><p>alias (optional): a custom name for the table in the database, in case you don&#8217;t want to original file name.</p></li><li><p>include (optional): lists the columns from the top-level property to include in this version. It can be a list or &#8220;all&#8221; or &#8220;*&#8221;.</p></li><li><p>exclude (optional): columns to be removed from the top-level property. It can only be declared if &#8220;include&#8221; is declared.</p></li><li><p>latest_version (optional): denotes the latest version which is the model dbt will refer do in an unpinned ref or in the &#8220;version:latest&#8221; selection method. If not defined, dbt will interpret the latest version as in the V definition.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xuBw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xuBw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 424w, https://substackcdn.com/image/fetch/$s_!xuBw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 848w, https://substackcdn.com/image/fetch/$s_!xuBw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 1272w, https://substackcdn.com/image/fetch/$s_!xuBw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xuBw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png" width="1048" height="928" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/294df340-967f-493a-93b3-426b278a0d3b_1048x928.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:928,&quot;width&quot;:1048,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:75330,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xuBw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 424w, https://substackcdn.com/image/fetch/$s_!xuBw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 848w, https://substackcdn.com/image/fetch/$s_!xuBw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 1272w, https://substackcdn.com/image/fetch/$s_!xuBw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F294df340-967f-493a-93b3-426b278a0d3b_1048x928.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/resource-properties/versions">versions documentation</a></figcaption></figure></div></li></ul><p>In the example above:</p><ul><li><p>v1 includes none of the columns from &#8220;customers&#8221; and includes an id column.</p></li><li><p>v2 takes all columns from &#8220;customers&#8221;, except for customer_country.</p></li><li><p>v3 takes all columns from &#8220;customers&#8221; and puts customer_country back in.</p></li><li><p>v4 takes all columns from &#8220;customers&#8221;</p></li></ul><h4>Setting up an alias for the data warehouse</h4><p>You may want &#8220;dim_customers_v1&#8221; to continue populating the &#8220;dim_customers&#8221; table in the warehouse. For that, you can use the &#8220;alias&#8221; configuration:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7SVu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7SVu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 424w, https://substackcdn.com/image/fetch/$s_!7SVu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 848w, https://substackcdn.com/image/fetch/$s_!7SVu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 1272w, https://substackcdn.com/image/fetch/$s_!7SVu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7SVu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png" width="1345" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1345,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:19384,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7SVu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 424w, https://substackcdn.com/image/fetch/$s_!7SVu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 848w, https://substackcdn.com/image/fetch/$s_!7SVu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 1272w, https://substackcdn.com/image/fetch/$s_!7SVu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe991e44c-9dcd-44b2-87ad-56406efeea7d_1345x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><p>Alternatively, you can create a post-hook with a macro that creates or updates dim_customers with the version you are currently building. That way, if someone is querying the table outside of dbt, they will always get the current version.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!w0Qs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w0Qs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 424w, https://substackcdn.com/image/fetch/$s_!w0Qs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 848w, https://substackcdn.com/image/fetch/$s_!w0Qs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 1272w, https://substackcdn.com/image/fetch/$s_!w0Qs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!w0Qs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png" width="1014" height="787" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:787,&quot;width&quot;:1014,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:96014,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!w0Qs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 424w, https://substackcdn.com/image/fetch/$s_!w0Qs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 848w, https://substackcdn.com/image/fetch/$s_!w0Qs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 1272w, https://substackcdn.com/image/fetch/$s_!w0Qs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8e12462-56ca-47fc-9b7f-dcdabb507584_1014x787.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">A macro that clones a view/table and pins it to the latest version. Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><div><hr></div><h3>Running a model version</h3><p>By selecting the main model name, in our example &#8220;dim_customers&#8221;, you run all versions of the model. </p><p>You can also run a specific version by selecting the specific file name or use the &#8220;.v2&#8221; suffix to run the model configured as &#8220;v: 2&#8221;.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RWXX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RWXX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 424w, https://substackcdn.com/image/fetch/$s_!RWXX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 848w, https://substackcdn.com/image/fetch/$s_!RWXX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 1272w, https://substackcdn.com/image/fetch/$s_!RWXX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RWXX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png" width="1456" height="122" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:122,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31259,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RWXX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 424w, https://substackcdn.com/image/fetch/$s_!RWXX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 848w, https://substackcdn.com/image/fetch/$s_!RWXX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 1272w, https://substackcdn.com/image/fetch/$s_!RWXX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffdeb6e33-ec4d-4cef-86ca-114680e684a4_1468x123.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><p>Finally, you can use the &#8220;version:&#8221; method pointing to latest, prerelease, or old to select a specific method.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8CfL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8CfL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 424w, https://substackcdn.com/image/fetch/$s_!8CfL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 848w, https://substackcdn.com/image/fetch/$s_!8CfL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 1272w, https://substackcdn.com/image/fetch/$s_!8CfL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8CfL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png" width="1452" height="88" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:88,&quot;width&quot;:1452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13864,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8CfL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 424w, https://substackcdn.com/image/fetch/$s_!8CfL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 848w, https://substackcdn.com/image/fetch/$s_!8CfL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 1272w, https://substackcdn.com/image/fetch/$s_!8CfL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65426856-002f-4dbb-89c6-e04c43d58f04_1452x88.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div><div><hr></div><h3>Optimising model versions</h3><p>If the new version only makes simple modifications to the code, like removing a column, you can simply create a view and use Jinja to refer to the previous version and make the necessary changes using a select statement.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!l17b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!l17b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 424w, https://substackcdn.com/image/fetch/$s_!l17b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 848w, https://substackcdn.com/image/fetch/$s_!l17b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 1272w, https://substackcdn.com/image/fetch/$s_!l17b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!l17b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png" width="1456" height="305" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:305,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44617,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177417488?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!l17b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 424w, https://substackcdn.com/image/fetch/$s_!l17b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 848w, https://substackcdn.com/image/fetch/$s_!l17b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 1272w, https://substackcdn.com/image/fetch/$s_!l17b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c351961-e4c4-4774-bdf0-0b2c1b8a4ab4_1521x319.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/mesh/govern/model-versions">model version documentation</a></figcaption></figure></div>]]></content:encoded></item><item><title><![CDATA[Model Governance: access, contracts and namespaces]]></title><description><![CDATA[Let's uncover the reasons for model governance features and how to configure 3 of them. Model Version is coming in a separate post.]]></description><link>https://andrealeonel.substack.com/p/model-governance-access-contracts</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/model-governance-access-contracts</guid><pubDate>Mon, 27 Oct 2025 23:48:47 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!X8n4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/docs/mesh/govern/about-model-governance">Model Governance</a>, <a href="https://docs.getdbt.com/docs/mesh/govern/model-access">Model Access</a>, and <a href="https://docs.getdbt.com/docs/mesh/govern/model-contracts">Model Contracts</a> documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>dbt has native features that help developers define model structure and visibility. </p><p>By using these tools, we can set who can see a model, what data it should contain, how it changes over time, and how it can be referenced by other models.</p><p>The features available in the open-source version of dbt are:</p><ul><li><p>Model access: the ability to make models public or private to control who can ref them.</p></li><li><p>Model contracts: restrict the shape of a model in terms of column names, data types, and constraints.</p></li><li><p>Model namespaces: delineate ownership boundaries and responsibilities through naming structures.</p></li><li><p>Model versions: versioning for the models, allowing for adjustments to be made without breaking access for the end user.</p></li></ul><p>We will cover the first 3 features in this post and dedicate a separate post to Model Versions.</p><h3>Table of contents</h3><ul><li><p>Model Access</p></li><li><p>Model Contracts</p></li><li><p>Namespaces</p></li><li><p>When to adopt model governance features</p></li></ul><div><hr></div><h3>Model access</h3><p>We can define model access by using two configurations: access and group.</p><p>These can be declared in the dbt_project.yml file, in a properties.yml file, or in the model itself. They are also subject to the config hierarchy (model first, then properties.yml, and finally dbt_project.yml).</p><h4>Access modifiers</h4><p>This configuration allows the developer to limit which models can ref an individual model or a group of models.</p><p>There are 3 types of model access:</p><ul><li><p>Protected (default): can be ref&#8217;ed by models in the same project (or package).</p></li><li><p>Private: can be ref&#8217;ed by models in the same group.</p></li><li><p>Public: can be ref&#8217;ed by any model in any group, package, or project</p></li></ul><p>If you change the access modifier to public, ensure to run a production job to apply the changes.</p><p>Things to note:</p><ul><li><p>Ephemeral models cannot be set to public.</p></li><li><p>The access configuration doesn&#8217;t impact permissions at database level.</p></li><li><p>Models in packages can be ref&#8217;ed by any model, regardless of the access config. Package maintainers can set the &#8220;restricted-access&#8221; config to true so that private and protected models can only be accessed by models within the package.</p></li><li><p>dbt recommends setting models in development to private so they don&#8217;t get accidentally ref&#8217;ed by other models.</p></li></ul><h4>Groups</h4><p>The main role of Groups is to restrict access to models. Every declared group comes with a default protected access configuration, which means these models can only be ref&#8217;ed by models in the same project.</p><p>Although we are specifically talking about models here, other resources (all except sources and exposures) can be assigned to a group. Each resource can only be part of one group.</p><p><strong>Declaring groups</strong></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oFNP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oFNP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 424w, https://substackcdn.com/image/fetch/$s_!oFNP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 848w, https://substackcdn.com/image/fetch/$s_!oFNP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 1272w, https://substackcdn.com/image/fetch/$s_!oFNP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oFNP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png" width="1041" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1041,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11078,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177059194?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oFNP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 424w, https://substackcdn.com/image/fetch/$s_!oFNP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 848w, https://substackcdn.com/image/fetch/$s_!oFNP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 1272w, https://substackcdn.com/image/fetch/$s_!oFNP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F248c3667-d4ef-4b66-afa9-e26d9699d7d8_1041x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Configuring a group in a properties.yml file. Source: <a href="https://docs.getdbt.com/docs/build/groups">groups documentation</a></figcaption></figure></div><p>If you want to override the default access modifier, you can set it in the config. For example, by setting the access config to &#8220;private&#8221;, you are limiting ref&#8217;ing to models in the same group.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!X8n4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X8n4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 424w, https://substackcdn.com/image/fetch/$s_!X8n4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 848w, https://substackcdn.com/image/fetch/$s_!X8n4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 1272w, https://substackcdn.com/image/fetch/$s_!X8n4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X8n4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png" width="1087" height="330" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/92f631d5-58ac-47cb-a127-eda221172810_1087x330.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:330,&quot;width&quot;:1087,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31569,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177059194?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!X8n4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 424w, https://substackcdn.com/image/fetch/$s_!X8n4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 848w, https://substackcdn.com/image/fetch/$s_!X8n4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 1272w, https://substackcdn.com/image/fetch/$s_!X8n4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92f631d5-58ac-47cb-a127-eda221172810_1087x330.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Changing the access modifier for a group. Source: <a href="https://docs.getdbt.com/docs/build/groups">groups documentation</a></figcaption></figure></div><p>You can also add a &#8220;description&#8221; and a &#8220;meta&#8221; config to your groups:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!svyu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!svyu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 424w, https://substackcdn.com/image/fetch/$s_!svyu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 848w, https://substackcdn.com/image/fetch/$s_!svyu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 1272w, https://substackcdn.com/image/fetch/$s_!svyu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!svyu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png" width="1084" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:1084,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41258,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177059194?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!svyu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 424w, https://substackcdn.com/image/fetch/$s_!svyu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 848w, https://substackcdn.com/image/fetch/$s_!svyu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 1272w, https://substackcdn.com/image/fetch/$s_!svyu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8807ce8b-f642-4fe0-bb48-da44ee65808c_1084x337.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/groups">groups documentation</a></figcaption></figure></div><p>Finally, another useful feature of groups is the ability to select all models in a group using the &#8220;group:&#8221; method. For instance, dbt run --select &#8220;group:finance&#8221;.</p><div><hr></div><h3>Model contracts</h3><p>When you set up a model contract, dbt ensures that the dataset resulting from a model follows the defined shape, or it will fail to build.</p><p>Contracts can be enforced upon SQL models that are materialised as a table or incremental (with &#8220;append_new_columns&#8221; or &#8220;fail&#8221; on_schema_change config). Certain adapters may not support it or have constraint restrictions.</p><p>dbt recommends setting up contracts for models that feed into visualisation tools for the end user or models that are used by other teams or projects.</p><h4>How to define a contract</h4><p>Under a &#8220;contract&#8221; config, set &#8220;enforced&#8221; to true. Then, you are required to add every column name and data type, following your adapter&#8217;s types. </p><p>Finally, if your adapter supports it, you can add the optional config of &#8220;constraints&#8221;. The types and reinforceability available will depend on the adapter. Some adapters may allow the model to build even if it violates a constraint.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Nd2D!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nd2D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 424w, https://substackcdn.com/image/fetch/$s_!Nd2D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 848w, https://substackcdn.com/image/fetch/$s_!Nd2D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 1272w, https://substackcdn.com/image/fetch/$s_!Nd2D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Nd2D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png" width="918" height="783" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:783,&quot;width&quot;:918,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88744,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177059194?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Nd2D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 424w, https://substackcdn.com/image/fetch/$s_!Nd2D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 848w, https://substackcdn.com/image/fetch/$s_!Nd2D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 1272w, https://substackcdn.com/image/fetch/$s_!Nd2D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d957eba-a524-4d2e-b678-2b2c7143be4a_918x783.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/resource-properties/constraints">constraint documentation</a></figcaption></figure></div><p><strong>Defining constraints</strong></p><p>The possible configurations for constraints are:</p><ul><li><p>Type (required): can be one of not_null, unique, primary_key, foreign_key, check and custom.</p></li><li><p>Expression: free text required for some constraints.</p></li><li><p>Name (optional): human-friendly name.</p></li><li><p>Columns: list of column names to apply the constraint to.</p></li><li><p>Warn_unenforced: set to false to skip warnings for constraints supported but unenforced by the adapter.</p></li><li><p>Warn_unsuported: set to false to skip warnings for constraints not supported by the adapter.</p></li></ul><p>Furthermore, the foreign_key constraint type accepts the input of &#8220;to:&#8221; with a ref or source function and &#8220;to_columns:&#8221; with the corresponding primary key.</p><h4>Contracts specificities</h4><p><strong>Handling breaking changes</strong></p><p>When a contract is enforced and a previous state is being used for comparison, dbt will check for changes in the schema that could break downstream models. </p><p>This includes:</p><ul><li><p>removing an existing column</p></li><li><p>change the data type of a column</p></li><li><p>removing or altering one of the constraints of a column</p></li><li><p>removing or renaming a contracted model </p></li></ul><p>The severity of the error will depend on whether the model is versioned. For versioned models, dbt will issue a contract error, and you must add a new version with the changes. For unversioned models, dbt will only issue a warning.</p><p><strong>Contracts vs. Data Tests</strong></p><p>Contracts are different from Data Tests in that they prevent a model from building if it doesn&#8217;t have a specific shape. Data Tests validate the data after the model has been built, and they also offer more flexibility in terms of configuration.</p><p>You should consider replacing some Data Tests with Constraints to save on compute costs and ensure the dataset is shaped correctly at build-time.</p><p><strong>Contracts for incremental models</strong></p><p>Since Contracts are supposed to ensure that the YAML definitions and the schema are the same, they can only be imposed in incremental tables with the on_schema_change config set to &#8220;fail&#8221; or &#8220;append_new_columns&#8221;.</p><p>In the other two possible configurations, &#8220;ignore&#8221; and &#8220;sync_all_columns&#8221;, dbt will either not check for schema changes or actively modify it. This contradicts the idea of a contract and potentially creates breaking changes.</p><p>Essentially, if dbt automatically changes the schema, the contract can no longer guarantee that downstream consumers are still compatible.</p><div><hr></div><h3>Model namespaces</h3><p>Namespaces are meant to create a logical organization or grouping of objects in your project. There are several ways of creating namespaces.</p><h4>dbt&#8217;s file structure</h4><p>Your subdirectories are automatically namespaces. </p><p>For instance, the models under the &#8220;staging&#8221; folder can have commands applied to them as a group or have a separate schema defined for them.</p><p>These folders can be defined based on ownership. Besides, with a custom schema, developers can define who can see what data. Both these steps aid data governance.</p><h4>Name</h4><p>When using ref and source functions, you can use two arguments using the name set up in the configuration.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Fc80!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Fc80!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 424w, https://substackcdn.com/image/fetch/$s_!Fc80!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 848w, https://substackcdn.com/image/fetch/$s_!Fc80!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 1272w, https://substackcdn.com/image/fetch/$s_!Fc80!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Fc80!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png" width="1144" height="130" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:130,&quot;width&quot;:1144,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10536,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177059194?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Fc80!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 424w, https://substackcdn.com/image/fetch/$s_!Fc80!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 848w, https://substackcdn.com/image/fetch/$s_!Fc80!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 1272w, https://substackcdn.com/image/fetch/$s_!Fc80!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F74f38d0f-a3bc-4b88-a0d0-7122e81b1b67_1144x130.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: ChatGPT</figcaption></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XZ1Z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 424w, https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 848w, https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 1272w, https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png" width="921" height="61" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/70737ef9-1022-41c6-b898-999d57292ec1_921x61.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:61,&quot;width&quot;:921,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:6585,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/177059194?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 424w, https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 848w, https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 1272w, https://substackcdn.com/image/fetch/$s_!XZ1Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70737ef9-1022-41c6-b898-999d57292ec1_921x61.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/reference/dbt-jinja-functions/ref#ref-project-specific-models">ref function documentation</a></figcaption></figure></div><p>For the ref function, the namespace is optional. dbt recommends specifying it when the project uses models from other projects or packages. This adds clarity and avoids ambiguity, as dbt will first look for the model name in the current project.</p><div><hr></div><h3>When to adopt model governance features</h3><p>It is important to note that, while adding these features will strengthen the trust and stability of your project, you need to consider that they often require a lot of additional setup and maintainability.</p><p>For that reason, ensure your models are ready to benefit from these features before you start adopting them. If your models are still changing significantly, maintaining these features can become tricky.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Week 11: reviewing resources and an honest reflection on motivation]]></title><description><![CDATA[Between one client demand and another, we found time to learn more about Seeds, Snapshots, and Exposures.]]></description><link>https://andrealeonel.substack.com/p/week-11-reviewing-resources-and-an</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/week-11-reviewing-resources-and-an</guid><dc:creator><![CDATA[Andrea Leonel]]></dc:creator><pubDate>Fri, 24 Oct 2025 09:01:18 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!4W9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data&nbsp;analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4W9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4W9u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 424w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 848w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1272w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png" width="960" height="318" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:318,&quot;width&quot;:960,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:525829,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/173207390?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4W9u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 424w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 848w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1272w, https://substackcdn.com/image/fetch/$s_!4W9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a7a929f-da79-4664-abe5-e030d1e5f950_960x318.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This week, we focused on deep diving into three more dbt resources: Seeds, Snapshots, and Exposures. We covered configuration, best practices, and the purpose of each. See the study links below.</p><p>Also, I shared 3 things I did to keep myself consistent during this hectic October, juggling client work and self-paced learning.</p><div><hr></div><h3>Study notes added: </h3><p>We covered the remaining 3 resources of a dbt project:</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;436b8c98-5f05-49ec-ad78-b7e9f579bd7d&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;A deep dive into Seeds&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-22T00:17:09.434Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!HeYT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F193226cd-ae1c-45d4-8860-fe43fc56ea09_1081x748.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/a-deep-dive-into-seeds&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:176779610,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;6747d2bd-c253-4bd9-b50d-cc936ceb5a91&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;Setting up and maintaining Snapshots&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-23T01:25:29.780Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!b5XS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F453cdfbf-3026-497c-83a2-077f95510d41_1089x330.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/setting-up-and-maintaining-snapshots&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:176791566,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;5bace770-d3db-494a-a480-2733af6e2c35&quot;,&quot;caption&quot;:&quot;Part of the &#8220;Mastering dbt&#8221; series. Access to the full Study Guide. Let&#8217;s connect on LinkedIn!&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;All you need to know about dbt's Exposures&quot;,&quot;publishedBylines&quot;:[],&quot;post_date&quot;:&quot;2025-10-23T22:26:49.412Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!opeu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://andrealeonel.substack.com/p/all-you-need-to-know-about-dbts-exposures&quot;,&quot;section_name&quot;:&quot;Mastering dbt&quot;,&quot;video_upload_id&quot;:null,&quot;id&quot;:176953288,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:0,&quot;comment_count&quot;:0,&quot;publication_id&quot;:2945779,&quot;publication_name&quot;:&quot;Andrea Leonel - Data Analysis &amp; Analytics Engineering&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!TwlV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b5ecf6f-7ab0-4ae3-a73f-95478b9fef4e_500x500.png&quot;,&quot;belowTheFold&quot;:true,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>This is a breeze, considering we are covering model governance and Python models next week!</p><p><a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">A full list of the study notes is available in the study guide.</a></p><div><hr></div><h3>Juggling work and self-paced learning</h3><p>This month, I was inundated with requests from a client. While my bank account appreciated it, my motivation to study dbt definitely took a hit.</p><p>Time was scarce, and when I did carve out a moment, I was often too mentally drained to focus. The workload has eased now, but every challenge brings a lesson. </p><p>Here are 3 things that helped me stay consistent:</p><ol><li><p><strong>Commit to doing at least a little bit every day:</strong></p><p>Busy days fly by, and skipping &#8220;just one&#8221; can easily snowball. Even on hectic days, I tried to write a short paragraph, read a few pages, or plan the next steps &#8212; anything to keep the momentum going.</p><p></p></li><li><p><strong>Have a long-term plan in place:</strong></p><p>Since this is a side project, I didn&#8217;t have a strict timeline. However, when life got hectic, I felt like having a long-term schedule gave me a sense of direction and helped me stay motivated when life got busy.</p><p></p></li><li><p><strong>Remember your purpose:</strong></p><p>I started this dbt study guide almost 3 months ago. After so many posts, it became easy to forget <em>why</em> I began. Reminding myself that this project helps me upskill &#8212; and helps others learn too &#8212; kept me motivated and inspired.</p></li></ol><div><hr></div><p><em>Have the study notes been useful to you so far? How are you getting on with your self-paced learning journey? I would love to hear from you here or on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!</em></p>]]></content:encoded></item><item><title><![CDATA[All you need to know about dbt's Exposures]]></title><description><![CDATA[Adding and configuring Exposures in our project.]]></description><link>https://andrealeonel.substack.com/p/all-you-need-to-know-about-dbts-exposures</link><guid isPermaLink="false">https://andrealeonel.substack.com/p/all-you-need-to-know-about-dbts-exposures</guid><pubDate>Thu, 23 Oct 2025 22:26:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!opeu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Part of the <a href="https://andrealeonel.substack.com/p/study-for-the-dbt-analytics-engineering">&#8220;Mastering dbt&#8221;</a> series. Access to the full <a href="https://andrealeonel.substack.com/p/dbt-analytics-engineering-certification">Study Guide</a>. Let&#8217;s connect on <a href="https://www.linkedin.com/in/andrealeonel/">LinkedIn</a>!<br>Notes from the <a href="https://docs.getdbt.com/docs/build/exposures">Exposure </a>and <a href="https://docs.getdbt.com/reference/exposure-properties">Exposure properties</a><a href="https://docs.getdbt.com/reference/commands/snapshot"> </a>documentation.</em></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://andrealeonel.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join hundreds of aspiring dbt developers &amp; data analysts!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>After learning about <a href="https://andrealeonel.substack.com/p/a-deep-dive-into-seeds">Seeds </a>and <a href="https://andrealeonel.substack.com/p/setting-up-and-maintaining-snapshots">Snapshots</a>, the final resource we will analyse in this Checkpoint is Exposures.</p><p>Exposures is a metadata object that defines and describes the downstream use of your project. They are used to represent and document external resources like dashboards, reports, machine learning models, and APIs.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vfzi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vfzi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 424w, https://substackcdn.com/image/fetch/$s_!Vfzi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 848w, https://substackcdn.com/image/fetch/$s_!Vfzi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 1272w, https://substackcdn.com/image/fetch/$s_!Vfzi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vfzi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png" width="811" height="273" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:273,&quot;width&quot;:811,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44135,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/176953288?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vfzi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 424w, https://substackcdn.com/image/fetch/$s_!Vfzi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 848w, https://substackcdn.com/image/fetch/$s_!Vfzi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 1272w, https://substackcdn.com/image/fetch/$s_!Vfzi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7aa00a14-b8c3-4d09-badf-4fa5276f5b57_811x273.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/exposures">exposures documentation</a></figcaption></figure></div><p>There are 3 main purposes for this:</p><ol><li><p><strong>End-to-end visibility:</strong> understanding what resources are using your dbt project so you know the impact of altering a model.</p></li><li><p><strong>Documentation</strong>: show external assets in the dbt documentation.</p></li><li><p><strong>Governance</strong>: help track ownership and accountability for data assets.</p></li></ol><div><hr></div><h3>How to declare Exposures</h3><p>Exposures can be defined manually with a .yml file or created automatically for supported integrations.</p><h4>Declaring an Exposure</h4><p>Exposures are declared under the &#8220;exposures:&#8221; key in a .yml file nested under models.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!opeu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!opeu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 424w, https://substackcdn.com/image/fetch/$s_!opeu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 848w, https://substackcdn.com/image/fetch/$s_!opeu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 1272w, https://substackcdn.com/image/fetch/$s_!opeu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!opeu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png" width="1074" height="558" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:558,&quot;width&quot;:1074,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54729,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/176953288?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!opeu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 424w, https://substackcdn.com/image/fetch/$s_!opeu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 848w, https://substackcdn.com/image/fetch/$s_!opeu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 1272w, https://substackcdn.com/image/fetch/$s_!opeu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3ef60b7f-f8a5-4349-b1cb-b951526f1fd6_1074x558.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/exposures">exposures documentation</a></figcaption></figure></div><h3>Exposure properties</h3><p><strong>Required properties:</strong></p><ul><li><p>name: a unique name for the exposure in snake case (replacing spaces by _)</p></li><li><p>type: it can be dashboard, notebook, analysis, ml, or application. For documentation purposes.</p></li><li><p>owner: name or email required. Additional properties  <code>name</code> or <code>email</code> required; additional properties allowed</p></li></ul><p><strong>Recommended properties:</strong></p><ul><li><p>depends_on: defines the metric, ref, or source (although it is highly unlikely to have an exposure linked to a source) that the exposure depends on.</p></li></ul><p><strong>Optional properties:</strong></p><ul><li><p>label: allows for a more human-friendly name than the &#8220;name&#8221; property, which doesn&#8217;t allow spaces.</p></li><li><p>url: the link to the data asset used to populate the &#8220;View this exposure&#8221; button in the upper right corner of the documentation site.</p></li><li><p>maturity: it can be &#8220;high&#8221;, &#8220;medium&#8221;, or &#8220;low&#8221; and refers to the level of confidence in the asset.</p></li><li><p>enabled: if set to False, dbt does not consider this resource part of the project. Can also be set in the dbt_project.yml file.</p></li><li><p>description: sets descriptions for documentation purposes.</p></li><li><p>tags: add common tags to resources to apply commands to all in one go using the &#8220;tag:&#8221; method.</p></li><li><p>meta: adds custom metadata for the resource to the manifest.json file and documentation.</p></li></ul><h3>Running commands with exposures</h3><p>As Exposures are metadata objects, you cannot run or build them. To have them included in the documentation, just run &#8220;dbt docs generate&#8221; and the exposures will appear in the documentation.</p><p>Besides, you can use the &#8220;exposures:&#8221; method to run or test all the upstream models that the Exposure depends on.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!y24J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!y24J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 424w, https://substackcdn.com/image/fetch/$s_!y24J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 848w, https://substackcdn.com/image/fetch/$s_!y24J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 1272w, https://substackcdn.com/image/fetch/$s_!y24J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!y24J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png" width="1080" height="100" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:100,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:11595,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://andrealeonel.substack.com/i/176953288?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!y24J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 424w, https://substackcdn.com/image/fetch/$s_!y24J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 848w, https://substackcdn.com/image/fetch/$s_!y24J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 1272w, https://substackcdn.com/image/fetch/$s_!y24J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9bc753b-b138-4911-874c-2b8086e3ece0_1080x100.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Source: <a href="https://docs.getdbt.com/docs/build/exposures">exposures documentation</a></figcaption></figure></div>]]></content:encoded></item></channel></rss>