<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by NULLIF() - An analytics engineering blog on Medium]]></title>
        <description><![CDATA[Stories by NULLIF() - An analytics engineering blog on Medium]]></description>
        <link>https://medium.com/@nullif.blog?source=rss-3ad4c2390bbc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wYKEVltjI8sqMeVmxq_MrQ.png</url>
            <title>Stories by NULLIF() - An analytics engineering blog on Medium</title>
            <link>https://medium.com/@nullif.blog?source=rss-3ad4c2390bbc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:30:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nullif.blog/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Choosing the right data catalog for your organization]]></title>
            <link>https://medium.com/@nullif.blog/choosing-the-right-data-catalog-for-your-organization-1e7ddc7d1f5f?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e7ddc7d1f5f</guid>
            <category><![CDATA[data-catalog]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Wed, 06 Mar 2024 05:55:34 GMT</pubDate>
            <atom:updated>2024-03-06T05:59:36.257Z</atom:updated>
            <content:encoded><![CDATA[<p>With hundreds of data assets to manage comes the creation of business key performance indicators targets and definitions, and even more questions from your colleagues.</p><p><em>“What does this mean?”<br>“Where is this used?”<br>“Is this asset deprecated?”<br>“When was the last time this data was refreshed?” <br>“Who is the owner of this report?”</em></p><p>Modern data catalogs have introduced a one-stop shop for answering stakeholder questions, visualizing documentation and defining assets across your data stack.</p><p>A data catalog is a centralized platform that enables organizations to discover, organize, and manage their data assets effectively. It provides a unified interface for users to search, understand, and access data across various sources, formats, and locations. Additionally, modern data catalogs often incorporate features such as data lineage tracking, metadata management, collaboration tools, and integration with data governance frameworks to ensure data quality, compliance, and usability. These catalogs play a crucial role in empowering data-driven decision-making and fostering collaboration among data users within an organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*HhGzlZeFiflv5fiJeQeKMQ.jpeg" /></figure><p><strong>Step 1: The RFP</strong></p><p>Usually, when your organization needs to invest in a new software or product, you will compile a list of questions that you will send to your various contenders. The questions should use be easy to respond to and produce responses that will indicate key areas about their business, their core competencies, and parts of their offering that sets them apart from the rest. This is called a Request for Proposal or RFP.</p><p>For all RFPs, it is important that you have a section of questions for gathering <strong>general company information</strong> like:</p><ul><li>Number of employees,</li><li>Office location(s),</li><li>Funding amount and round,</li><li>Years in business,</li><li>Security certifications (SOC2, etc.)</li></ul><p>Depending on the problem you are trying to solve, the questions for your specific data catalog RFP may look different. Some question categories may include; integrations, security, as well as usability. If you are struggling to come up with the categories for your RFP questions, take a look at each vendors’ website as they’ve usually defined their core competencies for you, which can help inform your categories. Additionally, if there is something that it is uniquely important to your organization, but is not displayed on their site, you can add an additional category.</p><p>The number of vendors to include in an RFP can vary depending on several factors, including the complexity of the project, the size of the organization issuing the RFP, the industry standards, and the availability of qualified vendors in the market.</p><p>In general, it’s a good practice to include a sufficient number of vendors to ensure competition and obtain a diverse range of proposals. However, including too many vendors can overwhelm the evaluation process and make it difficult to manage effectively.</p><p>A common approach is to identify a shortlist of qualified vendors based on pre-established criteria such as reputation, experience, expertise, and capacity to meet the project requirements. Including around 3 to 7 vendors in the RFP process is often considered manageable and allows for meaningful comparison of proposals.</p><p>Ultimately, the goal is to strike a balance between having enough vendors to promote competition and obtain quality proposals while keeping the process manageable for evaluation and decision-making.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*_e0npYIv-WR3XS3qEbN4eg.jpeg" /></figure><p>Based on the responses to the RFP, you will likely cut your contenders down significantly. The remaining vendors will move into the next phase of the selection process — the POC.</p><p><strong>Step 2: The POC</strong></p><p>POCs are commonly used in various industries, including technology, engineering, software development, and business, to mitigate risks, gather feedback, and make informed decisions about whether to proceed with a project. Successful POCs can provide valuable insights, validate assumptions, and help refine the concept before investing significant resources into further development.</p><p>A POC stands for “Proof of Concept.” It’s a demonstration or a small-scale trial of a product, service, or idea to validate its feasibility, functionality, or potential value before committing to full-scale development or implementation. In a POC, the main objective is to test whether the concept or solution works as intended and meets the desired objectives or requirements.</p><p>By having regular check-ins with your vendors you keep lines of communication open. This is your chance to ask questions, seek clarification, ask how other companies are utilizing certain features, etc.</p><p>This is also where you’ll be able to ask about the feature roadmap, and other things the vendors are working on for future releases. They may not be able to give you hard dates, but they may be able to approximate quarters for the high priority features in order for you to make a decision.</p><p><strong>Step 3: Internal debrief</strong></p><p>While connecting with the vendors during the POC is valuable, checking in with your business users is also an important component of the process. These are the folks that will be using the tool once you’ve selected it, so including them in this process means they can provide valuable insights about which tools are their favourites, and which are harder to use. You should add your most frequent data explorers onto the data catalog first after the initial implementation is complete so that they can help champion the investment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/0*aGuFvtf_IRRqJEh8.png" /></figure><p>Selecting the right data catalog for your organization involves careful consideration of various factors. Success measures for implementation play a crucial role, including adoption and contribution rate. Tracking metrics such as unique logins per week and unique contributions per week can provide valuable insights into user engagement and the platform’s effectiveness in serving your organization’s needs. By prioritizing these measures, organizations can ensure that the chosen data catalog aligns closely with their objectives and fosters active participation among users. Ultimately, a well-chosen data catalog not only enhances data accessibility and management but also facilitates meaningful contributions from all stakeholders, driving overall success in data utilization efforts.</p><p><strong>Katherine C, author of the weekly NULLIF() newsletter!</strong> <a href="https://nullifblog.ck.page/subscribenow">Subscribe today</a><br>Connect with me on LinkedIn: <a href="https://www.linkedin.com/in/katherine-chiodo/">https://www.linkedin.com/in/katherine-chiodo/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e7ddc7d1f5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Master dbt and leverage variables]]></title>
            <link>https://blog.devgenius.io/mastering-dbt-and-leveraging-variables-d553f3f62cb0?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d553f3f62cb0</guid>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data-modelling]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analysis]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 20:08:00 GMT</pubDate>
            <atom:updated>2024-02-21T14:00:16.357Z</atom:updated>
            <content:encoded><![CDATA[<p>While SQL has always been a part of my analytics journey, dbt introduced a new understanding of other programming concepts. <strong>Variables, are one of those concepts.</strong></p><p>Traditionally, a variable has referred to an identifier that represents a value stored in computer memory, which can be manipulated and referenced in a program or script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWNq4rM2HlJYdKRme7gTlQ.jpeg" /></figure><h4>Variables 101</h4><p>Similarly, dbt variables are parameters or values that can be defined and configured within a dbt project to control various aspects of data modelling and the transformation processes.</p><p>Variables are important for dynamic SQL generation because they allow queries to adapt to changing parameters at runtime. dbt offers various types of variables, two of which we’ll cover today.</p><h4>Variables in dbt projects</h4><p>The position of the variable in the dbt_project.yml file determines whether the variable is global or local.</p><p><em>And as you probably guessed:<br>- Global variable = dbt project-level variable <br>- Local variable = dbt model-level variable</em></p><p><strong>Project-level variables<br></strong>These variables exist and can be used globally throughout your project.</p><pre># dbt_project.yml<br><br>config-version: 2<br><br>vars:<br>  my_variable_name: &quot;my_variable_value&quot;</pre><p>Project-level variables are set on the top-level of the dbt_project.yml like the project name, and version configurations.</p><p><strong>Model-level variables<br></strong>These variables are resource-specific, meaning they exist only within the resource-path they have been assigned to.</p><pre># dbt_project.yml<br><br>config-version: 2<br><br>models:<br>  my_project:<br>    my_model:<br>      vars:<br>        my_variable_name: &quot;my_variable_value&quot;</pre><p>Project-level variables are set under the models: resource-path similar to the default database and schema configurations.</p><p>There’s also an option to set your model-level variables directly in your .sql file. It’s important to note that setting variables directly within SQL files should be used judiciously and may be less maintainable than defining variables in the dbt_project.yml.</p><p>In any case, setting and calling a variable in the .sql file looks like so:</p><pre>-- my_sql_file.sql<br><br>{% set my_variable = &#39;my_value&#39; %}<br><br>SELECT *<br>FROM my_table<br>WHERE column = &#39;{{ my_variable }}&#39;;</pre><p>You’ll need to use Jinja in order to set the variables and their values and call the variable in your query.</p><h4>Common use cases for variables</h4><p>A great use case of project-level variables are thresholds for monitoring your business metrics for various key performance indicators.</p><pre># dbt_project.yml<br><br>config-version: 2<br><br>vars:<br>  # KPI thresholds for monitoring business metrics<br>  sales_growth_threshold: 0.1  # Minimum sales growth rate for a successful quarter<br>  customer_churn_threshold: 0.05  # Maximum customer churn rate for acceptable performance<br>  average_order_value_target: 1000  # Target average order value to achieve</pre><p>This example has defined project-level variables for various KPI thresholds related to sales growth, customer churn, and average order value. These variables can be used in dbt models to evaluate business metrics against predefined thresholds and trigger alerts or actions based on performance. By managing KPI thresholds as project-level variables, you can easily adjust them according to changing business requirements without modifying SQL code across multiple models.</p><p>Now, let’s say you have a sales table in your data warehouse, and you want to calculate the commission for each sales transaction. However, the commission percentage may vary based on different criteria, such as the sales region or product category.</p><p>You can use a model-level variable to define the commission percentage for each sales region or product category directly within the model, allowing for flexible commission calculations without modifying the main SQL logic.</p><pre># dbt_project.yml<br><br>config-version: 2<br><br>models:<br>  my_project:<br>    sales:<br>      vars:<br>        average_commission_percentage: 0.05  # Average commission percentage for sales<br>        north_american_commission_percentage: 0.07 # Canada &amp; USA commission percentages for sales<br>        mena_commission_percentage: 0.10 # Middle EAST &amp; North Africa commission percentage for sales</pre><h4>Leveraging variables in your .sql files</h4><p>In order to use a variable in your models, you’ll need to do the following:</p><pre>-- my_sql_file.sql<br><br>SELECT *<br>FROM my_table<br>WHERE column = &#39;{{ var(&#39;my_variable_name&#39;) }}&#39;;</pre><ul><li>In the SQL file, {{ var(&#39;my_variable_name&#39;) }} will be replaced by the value of my_variable_name defined in dbt_project.yml.</li><li>Make sure to use double curly braces {{ }} to reference the variable and use the var() function to retrieve the value of the variable within the SQL file.</li><li>Similar to the example above, you do not need to use the var function when setting them directly in the .sql file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*z0H3FiVfzgxa9w8Jqx8uIg.jpeg" /></figure><h4>Managing and organizing your variables</h4><ol><li>Centralize variable management: as mentioned, use the variables set in the model files sparingly. All variables should be defined in the dbt_project.yml file so every author in the code base can see them in one place.</li><li>Use consistent naming conventions: adopt a clear and consistent naming convention for your variables to make them easy to understand and manage. Consider prefixes or suffixes to indicate variable scope (e.g., project_, model_) and use descriptive names that reflect their purpose.</li><li>Organize hierarchically: group related variables together in logical hierarchies within the dbt_project.yml file. For example, organize variables by functional area (e.g., database_connection, model_configuration) to improve readability and maintainability.</li><li>Document variables thoroughly: provide comprehensive documentation for each variable to clarify its purpose, expected values, and usage. Use comments in the dbt_project.yml file to document variable definitions, and include inline comments in SQL code to explain how variables are used.</li></ol><p><strong>How are you and your team using variables in your dbt project?</strong></p><p>Katherine C, author of the weekly NULLIF() newsletter!<strong><br></strong>Subscribe today: <a href="https://nullifblog.ck.page/subscribenow">https://nullifblog.ck.page/subscribenow</a><br>Connect with me on LinkedIn: <a href="https://www.linkedin.com/in/katherine-chiodo/">https://www.linkedin.com/in/katherine-chiodo/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d553f3f62cb0" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/mastering-dbt-and-leveraging-variables-d553f3f62cb0">Master dbt and leverage variables</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing multi-project architecture with dbt-meshify]]></title>
            <link>https://blog.devgenius.io/managing-multi-project-architecture-with-dbt-meshify-1875b5e3eb93?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1875b5e3eb93</guid>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[data-mesh]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Thu, 15 Feb 2024 04:09:18 GMT</pubDate>
            <atom:updated>2024-02-15T16:23:07.505Z</atom:updated>
            <content:encoded><![CDATA[<p>A year ago today I had absolutely no idea what multi-project architecture referred to. I had no idea about the complexities it would introduce to the dbt development cycle I had just spent more than three years getting used to.</p><p>The introduction of multi-project architecture meant grasping some new vocabulary: <br><em>Model governance <br>Monolithic repository <br>Multi-project deployments <br>Data mesh</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*VSZ-GOE8I7ELBpDXHlbD6w.png" /></figure><p>If you are managing the ingestion of data into various databases then its likely you’re in a multi-project architecture. This means there are likely more than one place to submit and review PRs. Often times, you’ll hear a <strong>multi-project</strong> architecture referred to as a <strong>multi-repository </strong>architecture, because projects and repositories are a 1:1. Below is an outline of leveraging the dbt-meshify package to streamline the reading from other databases to build models.</p><h3>Current State</h3><p>I can write SQL, navigate new datasets and know my way around a dbt project, but I had never created a dbt model previously that would use a cross-database ref function and my first major project in my new role was a model that selected from 10 different dbt-projects. Major yikes.</p><p>To my surprise, there were a few things I needed to do in order to so and together, each of these steps would produce a model that selects the appropriate data from each different databases. Those steps are outlined below.</p><h4>A source.yml file</h4><p>This is how you tell dbt where to look for the models in your other databases. It needs the following inputs below in order to run successfully.</p><pre>version: 2<br><br>sources:<br>  - name: users_canada <br>    database: canada_prod<br>    schema: ecom_shopify <br>    tables: &amp;users_tables <br>      - name: table_1<br>      - name: table_2<br>      - name: table_3<br>      - name: table_4<br>      - name: table_5<br>  - name: users_usa <br>    database: usa_prod <br>    schema: ecom_shopify <br>    tables: *users_tables</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*tGtC6DqjdyfTzvEj2AhqHA.png" /></figure><p>You can create one per cross-project model or one for all cross-project use-cases. While they are easy to create, they can become cumbersome to manage depending on how you decide to create them. I’d recommend one per schema, or at least one for every models directory subfolder.</p><p>If you are bringing in the exact same resources from multiple databases, you don’t need to specify all the table names each time. You can utilize the <em>&amp; </em>symbol in the first instance of the table specifications. In the second iteration, you can use the * symbol (like in the example above) to specify that you’d like to include all the tables called in from the first iteration.</p><h4>User roles</h4><p>Take note of the role your dbt user is using, and assess whether or not it has read permissions for the databases you are trying to read from. If it doesn’t it’s possible you may need to call a pre-hook that uses a secondary role which does have the required permission. Pre-hooks are SQL statement(s) to be run before or after a model is built and can be stored in the macros/ directory. Pre-hooks can be called in individual model config blocks like:</p><pre>{{ config(<br>    database=&#39;reporting&#39;, <br>    schema=&#39;shopify&#39;, <br>    pre_hook= &quot;{{ secondary_role() }}&quot;<br>) }}</pre><h4>Build your FROM statement</h4><p>Your FROM statement will not be exactly as your traditional statement, however, it will still use a source function with two inputs.</p><pre>WITH<br><br>final AS ( <br>    SELECT <br>        *<br>    FROM <br>        {{ source(&#39;canadian_location_data&#39;, &#39;prizm_unique_license&#39;) }}<br>)<br><br>SELECT * FROM final</pre><ul><li>As opposed to references files from within your project, use the source function in the FROM statement.</li><li>From the source.yml function, use the name &amp; table name configs as the inputs here.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*rrmTF2AjS4oV3NdgCBvw7g.jpeg" /></figure><h3>Welcome, the new normal</h3><p>At Coalesce 2023 in San Diego, dbt Labs announced a package called dbt-meshify that automates the creation of model governance and cross-project lineage features. This package will leverage your dbt project metadata to create and/or edit the files in your project to properly configure the models in your project with these features.</p><p>The most exciting part of this release for those managing cross-project architecture is the cross-project references. This feature removes the need for all of the steps outlined above, and introduces a more efficient process. We can now utilize dependencies.yml to store our imported packages, as well as our projects.</p><pre>## dependencies.yml<br><br>packages:<br>  - package: dbt-labs/dbt_utils<br>    version: 1.1.1<br><br>projects:<br>  - name: sample_data  # matches the &#39;name&#39; in their &#39;dbt_project.yml&#39; file.</pre><p>Now, instead of needing to create the source.yml file above, you can add the name of the project to the dependencies.yml and use the ref function in the FROM statement. Unlike installing a package, the models in the sample_data project will <em>not</em> be pulled down as source code and parsed into your project. Instead, dbt provides a metadata service that resolves references to public models defined in the sample_data project. Writing a cross-project ref now looks like this:</p><pre>WITH final AS (<br>  <br>    SELECT * FROM {{ ref(&#39;ecom_shopify&#39;, &#39;customers&#39;) }}<br>)<br><br>SELECT * FROM final</pre><p>The biggest difference is the list of tables available to query from. In other words, <strong>before dbt-meshify there was no way to freely be able to query all of a database’s <em>public</em> models.</strong></p><p><strong>Katherine C, author of the weekly NULLIF() newsletter!<br></strong>Subscribe today: <a href="https://nullifblog.ck.page/subscribenow">https://nullifblog.ck.page/subscribenow</a><br>Connect with <a href="https://www.linkedin.com/in/katherine-chiodo-811693135/">me</a> on LinkedIn ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1875b5e3eb93" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/managing-multi-project-architecture-with-dbt-meshify-1875b5e3eb93">Managing multi-project architecture with dbt-meshify</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced insights into dbt source freshness testing]]></title>
            <link>https://blog.devgenius.io/advanced-insights-into-dbt-source-freshness-testing-376685bf9085?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/376685bf9085</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Wed, 07 Feb 2024 03:30:39 GMT</pubDate>
            <atom:updated>2024-02-08T16:24:07.076Z</atom:updated>
            <content:encoded><![CDATA[<p>In last week’s <a href="https://medium.com/dev-genius/all-you-need-to-know-about-dbt-source-freshness-testing-bf1f198f955e">post</a> we walked through the freshness testing functionality, and the various ways you can instrument the testing in your projects. This week, we take those fundamentals and build on them with more advanced use cases and insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*NzEySAv8hnDyw8I12UuLcg.jpeg" /></figure><h3>Different ways to build models based on freshness</h3><p>Ensuring that only fresh models are built in your CI/CD pipelines is crucial for maintaining data accuracy and efficiency in analytics workflows. The following sections will delve into the significance of prioritizing recently updated data for model building and the benefits it brings to your development process. They will explore strategies for instrumenting these commands within your CI/CD jobs, empowering you to optimize resource utilization and streamline your data pipeline management.</p><h4>Fresh rebuilds with state selection</h4><p>When a job is selected, dbt Cloud will surface the artifacts from that job’s most recent successful run. dbt will then use those artifacts to determine the set of fresh sources. In your job commands, you can signal to dbt to run and test only on these fresher sources and their children by including the source_status:fresher+ argument. This requires both previous and current state to run dbt source freshness and have the sources.json artifact be available.</p><pre># Command step order <br>dbt source freshness<br>dbt build --select &quot;source_status:fresher+&quot;</pre><p>The build command above can be added to your CI/CD job in order to limit the volume of data processed during each run.</p><h4>Running a data freshness macro</h4><p>One approach is to use dbt’s --select flag along with custom SQL queries that check for data freshness. For example, you could create a custom materialized view or a dbt macro that queries metadata tables to determine the freshness of your data sources. Then, based on the results of these queries, you can dynamically generate a list of models to build using the --select flag.</p><ol><li>Create a custom SQL file or macro that checks data fresh:</li></ol><pre>-- Check data freshness SQL example<br>{% macro select_models_based_on_freshness() %}<br>{% set freshness_threshold = var(&#39;freshness_threshold_days&#39;, default=1) %}<br>{% set selected_models = [] %}<br><br>{% for model in adapter.list_relations(schema=schema) %}<br>    {% set last_refreshed = run_query(&quot;SELECT MAX(updated_at) FROM &quot; ~ model) %}<br>    {% set days_since_refresh = datediff(&#39;day&#39;, last_refreshed, current_timestamp()) %}<br>    {% if days_since_refresh &lt;= freshness_threshold %}<br>        {% set selected_models = selected_models + [model] %}<br>    {% endif %}<br>{% endfor %}<br><br>{{ return(selected_models) }}<br>{% endmacro %}</pre><p>You might want to adjust the freshness_threshold_days parameter in the macro to specify the maximum allowed age of the data in days. This parameter allows you to control how fresh the data needs to be for a model to be selected.</p><p>2. Use the macro in your dbt project to dynamically select models:</p><pre># dbt_project.yml<br><br>models:<br>  my_selected_models:  # This is the name of the model you&#39;re defining<br>    materialized: view  # This specifies the materialization type, such as view, table, etc.<br>    sql: &quot;{{ select_models_based_on_freshness() }}&quot;  # This is where you reference the macro</pre><p>In this snippet:</p><ul><li>my_selected_models is the name of the model you&#39;re defining. You can replace it with any name that suits your model.</li><li>materialized: view indicates that the model will be materialized as a view. You can choose a different materialization type if needed.</li><li>sql: &quot;{{ select_models_based_on_freshness() }}&quot; is where you reference the macro. This line tells dbt to execute the macro select_models_based_on_freshness() to determine the SQL code for building this model.</li></ul><p>Ensure that this block is properly indented under the models section of your dbt_project.yml file. This configuration tells dbt how to build the selected models using the logic defined in the macro. If you have any other models defined in your dbt_project.yml file, they should be on the same level of indentation as my_selected_models. Each model definition block starts with the model name followed by its configuration parameters.</p><p>3. Run dbt with the --select flag to build only the selected models: Finally, run dbt with the --select flag to build only the models selected by the macro. You can specify the name of the model defined in the dbt_project.yml file.</p><pre>dbt run --select my_models</pre><p>You can use the above command in your dbt CI/CD job command alongside SlimCI principles in order to save on costs/compute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*KYnPUt5B6cIKQr2a4-Yhuw.jpeg" /></figure><h4>Why this is useful</h4><p>Building only fresh models in CI/CD jobs offers several benefits and is a valuable practice in modern data analytics environments for many reasons.</p><ul><li><strong>Efficient resource utilization: </strong>By running only the models affected by recent data changes, you optimize resource usage, including computational resources and time. This efficiency reduces unnecessary processing and speeds up the CI/CD pipeline, leading to faster deployments and updates.</li><li><strong>Improved data quality:</strong> Focusing on fresh models ensures that your analytics reflect the most recent data, enhancing the quality and accuracy of your insights. Outdated or stale data can lead to misleading analysis and decisions, so prioritizing fresh models helps maintain data integrity and relevance.</li><li><strong>Cost reduction:</strong> By minimizing unnecessary processing and leveraging cloud resources efficiently, you can lower operational costs associated with data processing and storage. Running only fresh models reduces the amount of computational resources consumed, leading to cost savings over time.</li></ul><p>How does your team manage data freshness, is there anything I missed?</p><p><strong>Katherine Chiodo, author of </strong><a href="https://nullifblog.ck.page/subscribenow"><strong>NULLIF()</strong></a><strong> Newsletter</strong><br><em>Connect with me on </em><a href="https://www.linkedin.com/in/katherine-chiodo-811693135/"><em>LinkedIn</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=376685bf9085" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/advanced-insights-into-dbt-source-freshness-testing-376685bf9085">Advanced insights into dbt source freshness testing</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All you need to know about dbt source freshness testing]]></title>
            <link>https://blog.devgenius.io/all-you-need-to-know-about-dbt-source-freshness-testing-bf1f198f955e?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf1f198f955e</guid>
            <category><![CDATA[data-freshness]]></category>
            <category><![CDATA[data-ingestion]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[dbt]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 01:01:53 GMT</pubDate>
            <atom:updated>2024-02-01T19:49:41.957Z</atom:updated>
            <content:encoded><![CDATA[<p>It should be no surprise that data modelling and testing are my favourite things about this role. I’ve consistently found it fascinating how well dbt and the rest of the tech stack integrate so well to enhance visibility into data lineage, but also to enable data engineering autonomy.</p><p>Throughout my dbt experience, I’ve gained insights into observability, testing, and data ingestion, but the source freshness tests are one of the most influential aspects of its functionality — providing increased visibility over large datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouy6ccHac87ANIzoelbZbg.jpeg" /></figure><h3>What is source freshness testing?</h3><p><strong>Command:</strong> dbt source freshness<br><strong>Definition:</strong> Freshness refers to the amount of time between the most recent record, and now, for a given table.<br><strong>Configuration:</strong> Freshness tests are configured via a freshness block using a timestamp column you wish to use to check freshness — usually a loaded_at field. <br><strong>Usage:</strong> This command uses the node selection syntax select, exclude, &amp; selector.</p><p>When we enable source freshness tests, we are asking “<em>how fresh is our data?</em>” coupled with an assertion that data should remain as “fresh” as our policies dictate, or otherwise it will not build.</p><h4>Implementing freshness testing</h4><p>Similar to setting our own SLAs, it is impossible to do so accurately without the data points to support your analysis.</p><ol><li>For freshness testing, it is important to take a look at the time between when the column was first loaded and then the next time data was loaded.</li><li>Calculate the difference between those two times in a date part that makes sense to the source, and then calculate the max of that time difference column. <em>NOTE: </em>The output of this is the largest gap between your data in the time period you looked at. That value becomes the input to the error_after config in the freshness block for your test. <br><strong>Anything greater than the longest time between loads is an automatic failure.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*doyzum-R02HG2klE4fxAOg.jpeg" /></figure><pre>-- Calculate the time, in hours, between each load and the following<br>-- For the output - calculate the MAXIMUM time between loads<br>WITH <br><br>prework AS ( <br>  user_id,<br>  created_at, <br>  loaded_at, <br>  LEAD(loaded_at) AS following_loaded_at<br>FROM <br>  users<br>), <br><br>time_diff AS ( <br>  SELECT <br>    DATEDIFF(&#39;hours&#39;, loaded_at, following_loaded_at) AS diff_hours<br>  FROM <br>     prework <br>  GROUP BY <br>    loaded_week ASC <br>)<br><br>SELECT MAX(diff_hours) FROM time_diff; </pre><p>Once you determine a confident maximum number of hours of freshness between your loads, you can take this value and use it in the error_after: config.</p><pre>version: 2<br><br>sources:<br>  - name: source_name  <br>    freshness:<br>      warn_after: <br>        count: 4 ## AVG(load_hours)<br>        period: hour<br>      error_after:<br>        count: 6 ## MAX(load_hours)<br>        period: hour<br>    loaded_at_field: created_at</pre><p>Once these tests are added to your sources, you can add the freshness test as a step in your CI/CD jobs to ensure that tests are not run unless the source is up to date (or within the freshness error timeframe).</p><h4>Other ways to implement freshness testing</h4><p>Besides the functionality dbt offers out of the box, there are various other ways to test for recency/freshness. Below are some examples:</p><p><strong>dbt_utils.recency test: </strong>Asserts that a timestamp column in the reference model contains data that is at least as recent as the defined date interval.</p><pre>version: 2<br><br>models:<br>  - name: model_name<br>    tests:<br>      - dbt_utils.recency:<br>          datepart: hour<br>          field: created_at<br>          interval: 6</pre><p><strong>dbt_expectations.expect_row_values_to_have_recent_data test: </strong>Expect the model to have rows that are at least as recent as the defined interval prior to the current timestamp. Optionally gives the possibility to apply filters on the results.</p><pre>tests:<br>  - dbt_expectations.expect_row_values_to_have_recent_data:<br>      datepart: hour <br>      interval: 6<br>      row_condition: &#39;id is not null&#39; #optional</pre><p>My preference here is to use the dbt source freshness command because of the ability to run it in CI/CD jobs for proactive alerting at every refresh using the dedicated job command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*BObwVfbN6PAwvyPZwP5ong.png" /><figcaption>Did someone say freshness?</figcaption></figure><p>By enabling the CI/CD jobs to test for freshness, we are able to proactively assess what is happening, and alert our business users. By adding the tests on each source, we can confidently manage our stakeholders’ expectations with regards to how immediate we are pulling new data in to high-priority customer reports in the reporting layer.</p><p>As we dive into the world of modern data stacks, freshness testing stands out as a game-changer. Whether it’s ensuring that crucial business metrics are up-to-date or making our decision-making processes stronger, freshness testing has a bunch of cool and useful use cases. Stay tuned for part two next week for more advanced ways of using source freshness testing in your dbt project.</p><p><strong>Katherine Chiodo, author of </strong><a href="https://nullifblog.ck.page/subscribenow"><strong>NULLIF()</strong></a><strong> Newsletter</strong><br><em>Connect with me on </em><a href="https://www.linkedin.com/in/katherine-chiodo-811693135/"><em>LinkedIn</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf1f198f955e" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/all-you-need-to-know-about-dbt-source-freshness-testing-bf1f198f955e">All you need to know about dbt source freshness testing</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimize your dbt development with these essential VSCode extensions]]></title>
            <link>https://blog.devgenius.io/optimize-your-dbt-development-with-these-essential-vscode-extensions-d233f321c14a?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d233f321c14a</guid>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[vscode-extension]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[dbt]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Tue, 23 Jan 2024 21:21:15 GMT</pubDate>
            <atom:updated>2024-01-26T00:45:02.350Z</atom:updated>
            <content:encoded><![CDATA[<p>When I started using dbt in my first role, we were using dbt core. While it took a little while to get used to the command line and using git, I quickly adapted and never really looked back. When I discovered my new team at the CFL had licenses for dbt Cloud I was excited to give it a try but definitely reluctant to get out of the command line. While dbt Cloud has many benefits, like the UI for CI/CD jobs and creating environments, I quickly realized I missed the ease of dbt core and the command line.</p><p>Thankfully, there are many VSCode extensions (my preferred code editor) that you can install to make dbt core look and operate like dbt Cloud. My favourite, and a few additional tips, are below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*YE5ekwGod6D1Q-nJlZx1Sg.png" /></figure><h4>Better Comments</h4><p>This extension is essential as it helps you create more human-friendly comments in your code base. There are a few reasons for leaving comments in your code, and this extension lets you format your annotations accordingly. From alerts, TODO’s, queries, highlights and commented out code, you can set the colour, tags, and comments preferences in the User or Workspace settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*dt0ryLQcGRBFXtYtNPnJeQ.png" /><figcaption>Source: <a href="https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments">Better Comments marketplace</a></figcaption></figure><p>Additionally, there are multiple other settings you can configure to maximize your comments.</p><p>&quot;better-comments.multilineComments&quot;: true<br>This setting will control whether multiline comments are styled using the annotation tags. When false, multiline comments will be presented without decoration.</p><p>&quot;better-comments.highlightPlainText&quot;: false<br>This setting will control whether comments in a plain text file are styled using the annotation tags. When true, the tags (defaults: ! * ? // — ) will be detected if they&#39;re the first character on a line.</p><p>better-comments.tags<br>The tags are the characters or sequences used to mark a comment for decoration. The default 5 can be modified to change the colours, and more can be added.</p><pre><br>&quot;better-comments.tags&quot;: [<br>  {<br>    &quot;tag&quot;: &quot;!&quot;,<br>    &quot;color&quot;: &quot;#FF2D00&quot;,<br>    &quot;strikethrough&quot;: false,<br>    &quot;underline&quot;: false,<br>    &quot;backgroundColor&quot;: &quot;transparent&quot;,<br>    &quot;bold&quot;: false,<br>    &quot;italic&quot;: false<br>  },<br>  {<br>    &quot;tag&quot;: &quot;?&quot;,<br>    &quot;color&quot;: &quot;#3498DB&quot;,<br>    &quot;strikethrough&quot;: false,<br>    &quot;underline&quot;: false,<br>    &quot;backgroundColor&quot;: &quot;transparent&quot;,<br>    &quot;bold&quot;: false,<br>    &quot;italic&quot;: false<br>  },<br>  {<br>    &quot;tag&quot;: &quot;//&quot;,<br>    &quot;color&quot;: &quot;#474747&quot;,<br>    &quot;strikethrough&quot;: true,<br>    &quot;underline&quot;: false,<br>    &quot;backgroundColor&quot;: &quot;transparent&quot;,<br>    &quot;bold&quot;: false,<br>    &quot;italic&quot;: false<br>  },<br>  {<br>    &quot;tag&quot;: &quot;--&quot;,<br>    &quot;color&quot;: &quot;#98C379&quot;,<br>    &quot;strikethrough&quot;: false,<br>    &quot;underline&quot;: false,<br>    &quot;backgroundColor&quot;: &quot;transparent&quot;,<br>    &quot;bold&quot;: false,<br>    &quot;italic&quot;: false<br>  },<br>  {<br>    &quot;tag&quot;: &quot;todo&quot;,<br>    &quot;color&quot;: &quot;#FF8C00&quot;,<br>    &quot;strikethrough&quot;: false,<br>    &quot;underline&quot;: false,<br>    &quot;backgroundColor&quot;: &quot;transparent&quot;,<br>    &quot;bold&quot;: false,<br>    &quot;italic&quot;: false<br>  }<br>]</pre><h4>Better Jinja</h4><p>This extension is essential as it helps highlight various parts of your Jinja, whether it be macros, ref functions, config blocks, and variables (vars). While it provides syntax highlighting for various languages, there are three that are applicable for dbt development, and two of which I’ve enabled personally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfOIyEb9j5xcf9ggblp4JQ.png" /><figcaption>Source: <a href="https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml">Better Jinja marketplace</a></figcaption></figure><p><strong>Jinja YAML: </strong>system name jinja-yaml.<br>Default file associations: .yml.j2, .yaml.j2, .yaml.jinja, and .yml.jinja.<br>This plays nicely with using Jinja loops inside source schema YAML files.</p><p><strong>Jinja SQL: </strong>system name jinja-sql.<br>Default file associations: .sql.j2, .sql.jinja and .sql.jinja2.<br>This plays nice with your models directory and macros. It highlights things like ref functions, configs, and other use cases of Jinja in these files.</p><p><strong>Jinja Markdown:</strong> system name jinja-md.<br>Default file associations: .md.jinja, .md.jinja2 and .md.j2.<br>Although I don’t currently have this enabled, it would play nicely with doc blocks if you are using that functionality for your documentation.</p><h4>dbt Power User</h4><p>This extension is by far my favourite because it enables functionality from dbt Cloud in dbt Core. While I won’t go into detail about all the features, I’ll outline the ones I use most frequently.</p><ol><li><strong>Autocomplete model, macro, source names: </strong>the extensions will display a list of resources as you begin to write out the first few letters. For more, see <a href="https://docs.myaltimate.com/develop/autocomplete/">here</a>.</li><li><strong>Preview query results: </strong>using Cmd+Enter on a Mac you can select a portion of a model or the entire thing and preview the results in the Query Results tab of the Terminal window. Similar to the dbt show command, except it allows you to analyze the results directly within VSCode using various data visualization options. See more <a href="https://docs.myaltimate.com/test/queryResults/">here</a>.</li><li><strong>Column lineage: </strong>view model lineage as well as column lineage with components like models, seeds, and sources. For column-level lineage you’ll need an API key, but you won’t need one for model lineage. <br>One of my favourite parts about this feature is that you can see a list of columns with descriptions and the tests that are written for those particular components. See more <a href="https://docs.myaltimate.com/test/lineage/">here</a>.</li><li><strong>Generate dbt models from SQL: </strong>this feature becomes extremely helpful if you do a lot of your testing in your IDE using traditional table object names, or if you are in the process of migrating to dbt. With this feature, you can easily convert SQL to jinja-sql by populating the right references. This feature requires an API key (<a href="https://www.altimate.ai/"><strong>www.altimate.ai</strong></a>) but with one additional click of a button, you’ve converted a SQL query to a dbt model. See more <a href="https://docs.myaltimate.com/develop/genmodelSQL/">here</a>.</li><li><strong>Generate documentation: </strong>let’s be real for a second and admit that writing documentation is one of the <em>worst </em>but most valuable features of dbt. This feature allows you to generate model and column descriptions automatically or write descriptions manually in the UI editor. Then, your descriptions are automatically formatted and saved in YAML files. See more <a href="https://docs.myaltimate.com/document/generatedoc/">here</a>.</li></ol><h4>dbt Shortcuts</h4><p>This extension is quite duplicative if you have dbt Power User installed given one of the features available (but not listed above) is the ability to build, compile, test and run resources without the need to write the entire command. Unfortunately, this extension, is not compatible with the build command.</p><p>Instead of: dbt run -m model_name <br>With dbt Shortcuts, you can run: dbt run and it will run the open file. <br>With dbt Power User, you can simply click the UI and it will run the open file (and its parents or dependencies if you so choose).</p><h4>Batch Rename</h4><p>Admittedly, I did not have this extension installed until a few weeks ago, but when my manager told our team about it, I knew I had to install it. We recently went through a process of changing our file naming conventions in dbt, and with more than 100 files, it was extremely tedious. Thankfully, this extension allows you to use the find/replace and multi-cursor functionality to rename multiple files at once inside the editor window.</p><p><strong>It’s as simple as: </strong><br>1. Select files in the explorer sidebar,<br>2. Right click one of the files and click &quot;Batch Rename&quot;,<br>3. Edit the file names in the editor</p><h4>Other VSCode tips</h4><p>I am a huge believer that technology should be set up to work best for us. One of the biggest pain points for dbt Cloud that I noticed during my short stint with it was the lack of Auto Save functionality. Once I was able to switch back to VSCode, I ensured that this was the first thing I enabled in my workspace.</p><p>Here’s how you do it:<br>1. Open VSCode<br>2. Click the File tab at the top left of the page <br>3. Click Auto Save (and a checkmark should appear beside it).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*QWcVsT4udP_uciLxxpQdSw.png" /><figcaption>Enabling Auto Save in VSCode</figcaption></figure><p>Did I miss anything? What extensions or VSCode shortcuts have you enabled to enhance your dbt development? Let me know in the comments, or my LinkedIn page!</p><p><strong>Katherine Chiodo, </strong>author of the weekly NULLIF() newsletter! <strong><br>Subscribe now: </strong><a href="https://nullifblog.ck.page/subscribenow">https://nullifblog.ck.page/subscribenow</a><br><strong>Connect with me on LinkedIn:</strong> <a href="https://www.linkedin.com/in/katherine-chiodo-811693135/">https://www.linkedin.com/in/katherine-chiodo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d233f321c14a" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/optimize-your-dbt-development-with-these-essential-vscode-extensions-d233f321c14a">Optimize your dbt development with these essential VSCode extensions</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Navigating the landscape of dimensional modelling]]></title>
            <link>https://medium.com/@nullif.blog/navigating-the-landscape-of-dimensional-modelling-66063a232801?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/66063a232801</guid>
            <category><![CDATA[entity-relationship-model]]></category>
            <category><![CDATA[data-modelling]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 20:47:31 GMT</pubDate>
            <atom:updated>2024-01-16T20:49:01.041Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Part 2 will be building upon the principles and foundations laid in Part 1 (linked above).</em></p><p>In <a href="https://medium.com/dev-genius/part-1-an-introduction-to-dimensional-modelling-35d3a7ae49e4">part one</a>, we laid the groundwork by exploring basic principles, transaction fact tables, and dimension tables. In part two, our focus moves beyond those basic principles and includes comparison to other modelling paradigms.</p><p>Join us for a practical exploration as we delve into the nuances of dimensional modelling, revealing insights tangible for optimizing data architecture. We hope you find part two as insightful as part one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*lwGY8gs_uVdr2a0qcra91g.jpeg" /></figure><h4><strong>Aggregate fact tables</strong></h4><p>Aggregate fact tables are similar to periodic snapshot fact tables (covered in part 1), with the main difference being that they summarize or “roll up” many actions to the context of a dimensional entity, instead of a date. The entity that is being summarized represents the table’s grain. Once again, these are less flexible, more specific and shorter than transaction fact tables. They also provide a nice table to SELECT * FROM. These can be difficult to incorporate a time series component into, but not impossible! Plus, time dimensionality is aptly covered by other types of fact tables.</p><p>Below are two examples of aggregate fact tables for orders, summarized to the context of a customer and a product. Once again, it’s fairly straightforward to envision the SQL required to model these with dbt’s {{ ref() }} function, given the transaction fact table example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/0*K8a-6l0MOlqvrhAF" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/0*GGTp_Nbf_ouqxGLR" /></figure><h4><strong>Accumulating snapshot fact tables</strong></h4><p>Accumulating snapshot fact tables summarize different events as they occur throughout a known business process. They are probably the least common of the different fact table types. In their simplest form, they’ll feature a primary key and timestamp columns, each representative of not only when a given event occurred, but also if that known event has or hasn’t yet occurred.</p><p>Below is an example of an order’s fulfillment to a customer. We have a timestamp column for each known step in the fulfillment process: ordered, shipped, received, and (if it occurs) returned. Can you spot different ways that this type of table could be analytically valuable? (<em>hint:</em> DATEDIFF)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/0*aQwVnLKIL4924jM0" /></figure><h4><strong>The Star Schema</strong></h4><p>In recapping both blog posts, we have defined 5 different table types, but what’s the point? The key to dimensionally modelled data is how these tables fit together seamlessly — represented no better than by a Star Schema.</p><p>Dialling it all the way back to our first two table types, Star Schemas are entity relationship diagrams with a transaction fact table at the centre, and dimension tables surrounding it, visually resembling a star. Tables are linked together by fact foreign keys &lt;&gt; dimension primary keys, via MANY:1 JOIN relationships.</p><p>Below is an example of a Star Schema featuring three of our tables. Assuming we have well-defined business metrics around orders, consider how intuitive it would be to define this Star Schema in a self-serve BI tool. <strong>Ultimately, Star Schema + Self Serve = Enablement. </strong>Anyone — regardless of SQL capabilities, can now query order metrics, and observe them alongside product and customer dimensions. Star Schemas make it pretty difficult to write an incorrect query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OiYBOV6adkYkFroS" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*wNhUMqvuYurrp6r4gxaRnA.jpeg" /></figure><h4>Cons, counterpoints &amp; other modelling paradigms</h4><p>Up until now, we’ve defined dimensional modelling, built some fact and dimension tables with dbt, assembled a Star Schema, and chucked it all in a self-serve BI tool for anyone interested in e-commerce orders to query. That’s great, but what’s the catch?</p><p>It’s a fantastic question. After all, we live in a world rich with trade-offs. Dimensional modelling isn’t perfect, but what is? There are drawbacks, and there are also other modelling paradigms that “do better” under certain circumstances. As with all things data, <em>the “correct” decision always “depends”.</em></p><p>Admittedly, it’s difficult to find a dimensional modelling con without a valid counterpoint. Again, trade-offs and use-cases are key. Let’s go through a few of them, and discuss trade-offs with other modelling paradigms.</p><p><strong>Con</strong>: Star Schemas are very one-dimensional (or — perhaps better put, one-factual). What if I want to analyze multiple facts?<br><strong>Counter</strong>: This is the best criticism against dimensional modelling. Star Schemas zone in on a single event. However, if we look at some of the other tables that we built earlier, namely periodic snapshots and aggregates, and squint hard enough, a fairly straightforward method for “fact combining” — one that avoids the dreaded fact-to-fact JOIN, reveals itself.<br><strong>Who Does It “Better”?</strong>: Bill Inmon and entity-centric data modelling both champion entities as your modelling focal point. While these can get us to the “fact combining” promised land quicker, it’s not that big of a lift to get there with lineage building and good old facts and dimensions already in hand — not to mention the benefits of simply having those.</p><p><strong>Con</strong>: It seems like I’m always a JOIN away. Why do I have to JOIN so often?<br><strong>Counter</strong>: You typically do have to JOIN a dimension table to a transaction fact table to grab that GROUP BY dimension to pair with your metric. We did just that with our first boilerplate query earlier. The trade-off here leans towards object modularity over query simplicity: that Dimension table you’re JOINing can also be JOINed to any fact table where its primary key exists as a foreign key.<br><strong>Who Does It “Better”?</strong>: The one big table (OBT) approach — which is more or less exactly what it sounds like, solves for not having to JOIN at the cost of dimensional modularity, reusability, and consistency. Personally, JOINs aren’t that difficult, and conducting them forces some brain power towards table grain, which is a good thing.</p><p><strong>Con</strong>: SCDs and non/semi-additive facts can be difficult to handle, let alone identify. SCD’s were explained in more detail <a href="https://medium.com/@nullif.blog/understanding-slowly-changing-dimensions-with-dbt-snapshots-9010c38e4339">here</a> in a previous post. <br><strong>Counter</strong>: Recognizing and properly handling these is probably the most difficult concept of dimensional modelling. That being said, some light reading can be your best friend here. There are 7 ways to handle SCDs, 3 of which probably cover 90% of the use-cases. Non/semi-additivity can be avoided, guardrailed in the BI tool, deferred to the BI tool (e.g. ratios and percentages), or handled with some SQL gymnastics (e.g. WAU / MAU).<br><strong>Who Does It “Better”?: </strong>Data Vault, a popular modelling strategy in Europe, has an interesting way of maintaining changed/historical records (more or less “all the data, all the time”).</p><p><strong>Con</strong>: It seems like a dimensional model requires a lot of start-up time before delivering anything of value to the business.<br><strong>Counter</strong>: This is true, but the short and sweet counterpoint is that it’s worth it. Once a large amount of dimensions have accumulated, they’re incredibly reusable against new facts. For the puzzlers out there, it’s akin to having a bunch of puzzle pieces that not only all fit together, but can be assembled to create many different puzzles.<br><strong>Who Does It “Better”?</strong>: Any data modelling strategy will require more start-up time than an assemblage of ad-hoc point solutions. The trade-off here is velocity versus scalability. Velocity can be necessary, but if it’s your overarching modelling strategy, you’ll eventually experience a high-velocity loss of trust in your data outputs.</p><h4>The end is near</h4><p>It has aptly been observed that “<em>all models are wrong, but some are useful.</em>” We personally find dimensional models to be very useful. They’re reliable, recyclable, malleable, provide robust utility well beyond a single use-case, and can often stand-in to solve new use-cases which they weren’t originally designed for. While we’re often reminded when they’re wrong (by humans or test failures, both typically via Slack), they certainly help to combat the natural progression of orderly things into disorder.</p><p>Tools are wonderful, and help make our lives easier. Without a <em>strategy</em>, however, they’ll accelerate that transition into an entropic mess, and spend money rampantly while doing so. Dimensional modelling is a strategy that has (so far) worked for many. We’re confident that — like any data modelling paradigm, it can work for any data practitioner.</p><p><strong>Katherine Chiodo &amp; Ben Labenski<br></strong>Subscribe to the NULLIF() <a href="https://nullifblog.ck.page/subscribenow">newsletter</a>!</p><p><strong>Connect with us on LinkedIn at:</strong><br><a href="https://www.linkedin.com/in/katherine-chiodo-811693135/">https://www.linkedin.com/in/katherine-chiodo</a><br><a href="https://www.linkedin.com/in/ben-labenski-325334166/">https://www.linkedin.com/in/ben-labenski-325334166/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66063a232801" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: An introduction to dimensional modelling]]></title>
            <link>https://blog.devgenius.io/part-1-an-introduction-to-dimensional-modelling-35d3a7ae49e4?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/35d3a7ae49e4</guid>
            <category><![CDATA[data-modelling]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <category><![CDATA[star-schema]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[dbt]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Tue, 09 Jan 2024 21:15:41 GMT</pubDate>
            <atom:updated>2024-01-10T18:21:45.123Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>LinkedIn is a powerful tool for various reasons — professional development, job opportunities, and networking to name a few. A few weeks ago <a href="https://www.linkedin.com/in/ben-labenski-325334166/">Ben Labenski</a>, Senior Analytics Engineer at theScore, reached out to me and we mutually agreed to collaborate on a piece about Dimensional Modelling. We hope this is a topic you enjoy!</blockquote><p><em>Entropy</em>, often cited in the Second Law of Thermodynamics, is based around a system’s state of disorder, randomness, or uncertainty. The general trend of entropy is that a system will transition from a state of order to disorder over time.</p><p>This oft-recounted high school chemistry lesson can be applied to many different walks of life. In terms of “<em>things that aren’t related to Thermodynamics whatsoever, but often transition from a state of order to disorder</em>”, we believe that a <strong>data warehouse</strong> is a perfect example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/0*XalGD1Dn8vpE86dC.jpeg" /></figure><p>Yes, major advancements in the data space have formidably armed us with (often free!) tools that have genuinely increased our velocity (<em>cough, cough, the Modern Data Stack</em>). What has perhaps gotten lost along the way with all of these new and fancy tools, however, is the order, the architecture, the setting of and adhering to standards — <strong>the strategy.</strong></p><p>Back in the 90’s, long before the Modern Data Stack, Ralph Kimball coined the concept of Dimensional Modelling. Akin to a few other data modelling paradigms, Kimball Dimensional Modelling has withstood the test of time — a remarkable feat considering how much the data space has evolved in that same timespan. If anything, given the boom of tools and explosion of data volume, Dimensional Modelling — or any modelling strategy more generally, is more paramount than ever to a data team’s persisted success, scalability and overall sanity. As the old adage goes, “<em>With great power comes great responsibility</em>”. Tools have given us great power. Adhering to a modelling strategy and resisting the natural transition from order to disorder is where responsibility comes into play.</p><h4>What is dimensional modelling?</h4><p>A model is a theoretical representation of something real. Dimensional modelling is the concept of representing your business processes as facts<strong> </strong>&amp; dimensions:</p><ul><li>Facts resemble <em>verbs: </em>the actions or occurrences that encapsulate a business.</li><li>Dimensions, on the other hand, resemble <em>nouns:</em> the people, places, things, or entities that interact with a business.</li></ul><pre>SELECT<br>   dim_table.dimension AS some_noun,<br>   COUNT(fct_table.primary_key) AS count_of_a_verb,<br>   SUM(fct_table.fact) AS total_of_another_verb<br>FROM <br>   fct_table<br>INNER JOIN dim_table<br>   ON fct_table.foreign_key = dim_table.primary_key<br>GROUP BY <br>   some_noun</pre><p>Let’s now explore the different types of tables that one might SELECT FROM in a dimensionally modelled data warehouse. We’ll consistently reference grain, and we’ll also touch on how tools like dbt — in championing data lineage as a first-class concept, can make dimensional modelling intuitive. We’ll leverage a practical e-commerce example, as everyone can relate to online shopping this time of year.</p><h4>Dimension tables</h4><p>Dimension tables are horizontally wide and (often) vertically short. With a grain of one row per dimensional entity, these tables house descriptive columns <em>(dimensions)</em> for the entity being represented.</p><p>The primary key (PK) of a dimension table exists as a foreign key (FK) in fact tables where dimensional context of that entity can be provided. Dimensions are typically what you’ll want to GROUP BY in a query for analytics use-cases.</p><p>Below are two very simple dimension table examples for customers and products of some hypothetical e-commerce platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/0*dlmyGNyXQulHYWvM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/0*7Bm4FKkiiAlTeURV" /></figure><p>It would be irresponsible to discuss dimension tables without highlighting Slowly Changing Dimensions (SCDs). Luckily, these were recently covered in a previous <a href="https://medium.com/@nullif.blog/understanding-slowly-changing-dimensions-with-dbt-snapshots-9010c38e4339">post</a>.</p><h4>Transaction fact tables</h4><p>Transaction fact tables are horizontally narrow and vertically long. These are the most commonly occurring fact table types, and you’re probably already familiar with them.</p><p>With a grain of one row per transaction, these tables house events (PK) featuring entities (FK) and the analytically valuable numbers (often $) associated with those events. Aggregating against columns in a transaction fact table is how business metrics are formulated. Due to transaction-level granularity, these fact tables are very robust and flexible, though they can get quite large.</p><p>Below is a very simple example of a transaction fact table for orders. For the purpose of simplicity, let’s make the (wild) assumption that this e-commerce company only allows one product per order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*cxIX02sR7udt4qpZ" /></figure><h4>Periodic snapshot fact tables</h4><p>These tables summarize or “roll up” many actions or occurrences over a defined time period. That period (daily, weekly, etc.) maps to the table’s grain. Since there’s typically aggregation at play in modelling these, they’re generally less flexible, more specific (time series), and vertically shorter (thereby more performant) than transaction fact tables.</p><p>They can also be a model in your arsenal that allows you to perform the much vaunted SELECT * FROM some_ideal_clean_and_pristine.table_that_you_think_exists</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*-SkZIkkYSZwT3Z14.jpg" /></figure><p>Below is an example of a periodic snapshot fact table. Given the previous transaction fact table example, it’s fairly straightforward to envision the SQL required to model this with dbt’s {{ ref() }} function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/0*lJQmJItScYktyYy4" /></figure><p>Similar to SCDs in dimension tables, it would be irresponsible to omit mention of <em>non/semi-additive</em> facts when discussing periodic snapshot fact tables. We’ll save those for another time, but as a teaser, consider what might happen if you went about summing unique users in the above example table to obtain unique user counts by week.</p><h4>Stay tuned for part 2 releasing next week!</h4><p>There are a couple more table types that may be found in a dimensionally modelled data warehouse, which will be discussed next week. As a primer, the remaining table types that we’ll cover, aggregate fact &amp; accumulating snapshot fact, are similar to periodic snapshot facts in terms of trading flexibility for increased specificity in solving for a particular use-case.</p><p>While aggregate, accumulating &amp; periodic snapshot fact tables are useful, they’re complementary to transaction fact and dimension tables; the foundational pieces of dimensional modelling. A Star Schema supports this quite nicely, which we’ll also discuss in the next post.</p><p>Lastly, we’ll briefly cover other modelling paradigms, and see how they stack up against dimensional modelling (as always — it depends on the use-case). Stay tuned!</p><p><strong>Katherine Chiodo &amp; Ben Labenski<br></strong>Subscribe to the NULLIF() <a href="https://nullifblog.ck.page/subscribenow">newsletter</a> to receive emails for my weekly posts!</p><p><strong>Connect with us on LinkedIn at:</strong><br><a href="https://www.linkedin.com/in/katherine-chiodo-811693135/">https://www.linkedin.com/in/katherine-chiodo</a><br><a href="https://www.linkedin.com/in/ben-labenski-325334166/">https://www.linkedin.com/in/ben-labenski-325334166/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35d3a7ae49e4" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/part-1-an-introduction-to-dimensional-modelling-35d3a7ae49e4">Part 1: An introduction to dimensional modelling</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A comprehensive guide to automating data testing in dbt]]></title>
            <link>https://blog.devgenius.io/a-comprehensive-guide-to-automating-data-testing-in-dbt-a1ca8a1d588c?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1ca8a1d588c</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[dbt]]></category>
            <category><![CDATA[analytics-engineering]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Wed, 03 Jan 2024 01:01:02 GMT</pubDate>
            <atom:updated>2024-01-04T08:12:24.158Z</atom:updated>
            <content:encoded><![CDATA[<h3>A comprehensive guide to managing data quality with dbt tests</h3><p>It’s no surprise that dbt has a long list of capabilities when it comes to data transformations, including; documentation, testing and data quality, deployments and lineage.</p><p>Ensuring data quality through testing has always been my favourite part of the analytics engineering role. From a very early point in my career, even when I had not yet integrated dbt as part of my stack, I was always so consumed by data quality, and suggesting improvements to the application that would in turn improve the quality of our data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*Y8QNokpbifL38gsG4Jt1tg.png" /><figcaption>I have a strong affinity for cats, and data quality!</figcaption></figure><h4>Test types</h4><p>dbt offers various testing types out of the box, including; not null, unique, relationships and accepted values.</p><ul><li>not_null: validates that there are no null values present in a column.</li><li>unique: validates that there are no duplicate values present in a column.</li><li>relationships: validates that all of the records in a child table have a corresponding record in a parent table — also referred to as referential integrity.</li><li>accepted_values: validates that all of the values in a column are present in a supplied list of values. If any values other than those provided in the list are present, then the test will fail.</li></ul><p>When run, dbt builds a select query for each test, if these queries return zero rows, the test passes. Check out the <a href="https://docs.getdbt.com/reference/resource-properties/data-tests">dbt documentation</a> for optional parameters to be used alongside these tests.</p><p>In addition to out of the box testing above, there are also data tests. Data tests are SQL queries that live in your tests/ directory as .sql files — that when run should return the failing records. They are also known as singular data tests, because they are one-off assertions usable for a single purpose.</p><p>Similar to the .sql models, these tests use Jinja in the ref statement of the query. It does so that it can tell dbt which model/source is being tested and thus when to run those tests. Running a dbt test -m model_name will run all the out-of-the-box and singular tests attributed to that model. In order to only run the singular data tests for a specific model, you would use the command: dbt test --select test_type: singular</p><h4>There is no need to reinvent the wheel</h4><p>The <a href="https://hub.getdbt.com/">dbt package hub</a> contains a list of useful packages that can be used to amplify the tests run in our project. A few of my favourites are linked below:</p><ul><li><a href="https://hub.getdbt.com/dbt-labs/dbt_utils/latest/">dbt_utils</a>: contains a list of SQL generators, Jinja helpers, generic tests, web and introspective macros that can be used to do things like generate a surrogate key, group by, and assert non-accepted values. This package is maintained by dbt Labs. Below is the source code for the generate_surrogate_key macro, which is what is run every time we call it in our SQL models.</li></ul><pre>{%- macro generate_surrogate_key(field_list) -%}<br>    {{ return(adapter.dispatch(&#39;generate_surrogate_key&#39;, &#39;dbt_utils&#39;)(field_list)) }}<br>{% endmacro %}<br><br>{%- macro default__generate_surrogate_key(field_list) -%}<br><br>{%- if var(&#39;surrogate_key_treat_nulls_as_empty_strings&#39;, False) -%}<br>    {%- set default_null_value = &quot;&quot; -%}<br>{%- else -%}<br>    {%- set default_null_value = &#39;_dbt_utils_surrogate_key_null_&#39; -%}<br>{%- endif -%}<br><br>{%- set fields = [] -%}<br><br>{%- for field in field_list -%}<br><br>    {%- do fields.append(<br>        &quot;coalesce(cast(&quot; ~ field ~ &quot; as &quot; ~ dbt.type_string() ~ &quot;), &#39;&quot; ~ default_null_value  ~&quot;&#39;)&quot;<br>    ) -%}<br><br>    {%- if not loop.last %}<br>        {%- do fields.append(&quot;&#39;-&#39;&quot;) -%}<br>    {%- endif -%}<br><br>{%- endfor -%}<br><br>{{ dbt.hash(dbt.concat(fields)) }}<br><br>{%- endmacro -%}</pre><p>Below is an example of when generating a surrogate key would come in handy for models that lack a primary key. Although the example below is <em>(hopefully)</em> unlikely, it demonstrates the efficacy for situations where you need to denote a not null and unique key across your entire dataset. Assuming your users table lacked a user_id column, you could use the full_name, gender and acquired_at value to denote the unique key.</p><pre>WITH <br><br>example_cte AS ( <br>  SELECT <br>    {{ dbt_utils.generate_surrogate_key([&#39;full_name&#39;, &#39;gender&#39;, &#39;acquired_at&#39;]) }} AS surrogate_key, <br>    full_name,<br>    gender,<br>    acquired_at<br>  FROM <br>      {{ ref(&#39;users&#39;) }} <br>) <br><br>SELECT * FROM example_cte</pre><p>In the .yml file for this users model, you could then assert that newly created surrogate key was both unique and not_null. Each time you tested this file, it would run the source code pasted above to ensure that this key passed both tests.</p><ul><li><a href="https://hub.getdbt.com/calogica/dbt_expectations/latest/">dbt_expectations</a>: contains a list of tests that expect the table, column and/or row values to look a certain way. There are a series of available tests in various categories, but some of my most commonly used are the REGEX pattern matching, as well as the matching data type tests.</li></ul><p>While we could easily have reproduced the behind-the-scenes SQL that is being run in our own data warehouse, relying on packages like these allow for increased readability and speed when testing our data and asserting data quality.</p><h4>Ok, but why test?</h4><p>Imagine you have an application that asks for full name, email, date of birth, sex, phone number, and province of residence when you sign-up for an account. The information added to this page upon acquisition will be the data in the users table. The following examples below assume that the application does not use required fields and all the assertions will happen in the backend with the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_IdpV0abo9p7CY3Otyq1g.png" /><figcaption>Example account sign-up page</figcaption></figure><p><strong>First &amp; Last Names:</strong> it would be fairly difficult to have tests on these two fields other than asserting that they are not_null. Given the variance in length and spelling of names, utilizing tests from the packages listed above is likely not going to be possible.</p><pre>version: 2 <br><br>models:<br>  - name: users  <br>    columns:<br>      - name: first_name<br>        description: The users first name. <br>        tests: <br>          - not_null<br>      - name: last_name <br>        description: The users last name. <br>        tests: <br>          - not_null </pre><p><strong>Email:</strong> an email address is important during registration, because likely your users will have to validate their emails after signing up. <br>This means that your email address will likely need to be <em>unique</em> (i.e. no other user has registered with that same email), and that the pattern of your email follows that of a <em>valid</em> email address which you can assert using the dbt_expectations.expect_column_values_to_match_regex test.</p><pre>version: 2 <br><br>models:<br>  - name: users  <br>    columns:<br>      - name: email<br>        description: The user&#39;s email address.<br>        tests: <br>          - not_null<br>          - unique <br>          - dbt_expectations.expect_column_values_to_match_regex: <br>              regex: &quot;%__@_%.__%&quot;</pre><p><strong>Date of Birth: </strong>the input to the date of birth in the photo above is set by DD/MM/YYYY, so the application is expecting it to be in that format, and will only accept it once that format has been fulfilled. The birth date input needs to validate that the registrant is not born in the future, as well as the registrant is not older than a logical year of birth.</p><pre>version: 2 <br><br>models:<br>  - name: users  <br>    columns:<br>      - name: date_of_birth<br>        description: The user&#39;s date of birth. <br>        tests: <br>          - not_null<br>          - dbt_expectations.expect_column_values_to_match_regex: <br>              regex: &quot;^(0[1-9]|[1-2][0-9]|3[0-1])/(0[1-9]|1[0-2])/(19|20)\d{2}$&quot;</pre><pre>-- Singular data test to validate that the date of birth is not in the future<br>WITH <br><br>assert_birthdate_is_valid AS ( <br>  SELECT<br>    COUNT(*) AS total_users <br>  FROM <br>    {{ ref(&#39;users&#39;) }}<br>  WHERE <br>     birth_date &gt; CURRENT_DATE()<br>  HAVING total_users &gt; 1 <br>) <br><br>SELECT * FROM assert_birthdate_is_valid </pre><p><strong>Sex at Birth: </strong>as you can see from the image above, the input for sex at birth is a drop down with a set of standardized values. Whenever we have a set of standardized values, it is recommended to add an accepted_values test. This way, if the product ever saves a value that we don’t expect, the test will fail and we will be able to override the buggy data in our users.sql model or on the users profile.</p><pre>version: 2 <br><br>models:<br>  - name: users  <br>    columns:<br>      - name: sex_at_birth<br>        description: The user&#39;s sex at birth<br>        tests: <br>          - not_null<br>          - accepted_values: <br>              values: [value_1, value_2, value_3]</pre><p><strong>Residence: </strong>assuming that only Canadians can register for your application, the residence field on the registration image above should contain yet another standardized list of values. This means that we can utilize the accepted_values out-of-the-box test to add the list of Canadian provinces and territories. If the application allowed for Canadian and American registrations, the list of accepted_values list would become too long and not add much value. There has to be a trade off for the length of the list of accepted_values and the impact it has on the data quality.</p><pre>version: 2 <br><br>models:<br>  - name: users  <br>    columns:<br>      - name: residence <br>        description: The user&#39;s Canadian residence. <br>        tests: <br>          - not_null<br>          - accepted_values: <br>              values: [value_1, value_2, value_3, value_4, ... value_13]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*yCg24aGfeHa1t2aWcfwWow.png" /><figcaption>Me after I’ve spent a tremendous amount of time adding high-impact tests to our data sources</figcaption></figure><p>Testing enhances the efficacy of user registration data by validating the accuracy and consistency of critical fields such as email, birth date &amp; sex at birth – ensuring data quality and reliability. Its impact lies in providing a systematic and automated approach to early detection of data inconsistencies, fostering confidence among users and analysts while promoting scalability and long-term maintenance of high-quality user information in the data warehouse.</p><p>It’s important to note that dbt testing is part of a broader data testing and quality assurance strategy. While it can address certain aspects of data quality, additional measures, such as input validation at the application level, may be necessary to ensure the integrity of user registration information at the source.</p><p><strong>Katherine Chiodo, author of the weekly NULLIF() newsletter<br></strong>Subscribe today! <a href="https://nullifblog.ck.page/subscribenow">https://nullifblog.ck.page/subscribenow</a><br>Connect on LinkedIn: <a href="https://www.linkedin.com/in/katherine-chiodo-811693135/">https://www.linkedin.com/in/katherine-chiodo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1ca8a1d588c" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/a-comprehensive-guide-to-automating-data-testing-in-dbt-a1ca8a1d588c">A comprehensive guide to automating data testing in dbt</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Striking the right balance: project delivery and continuous learning in professional development]]></title>
            <link>https://medium.com/@nullif.blog/striking-the-right-balance-project-delivery-and-continuous-learning-in-professional-development-c416eb7b9799?source=rss-3ad4c2390bbc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c416eb7b9799</guid>
            <category><![CDATA[professional-development]]></category>
            <dc:creator><![CDATA[NULLIF() - An analytics engineering blog]]></dc:creator>
            <pubDate>Wed, 20 Dec 2023 06:12:55 GMT</pubDate>
            <atom:updated>2023-12-20T06:12:55.105Z</atom:updated>
            <content:encoded><![CDATA[<p>Those who know me, know I love to learn and always have. In every job interview I’ve ever had, I’ve always used my love of learning as the answer to that dreaded greatest strength interview question. This doesn’t only apply to my work life — but it’s ubiquitous in all areas of my life.</p><p>As a young girl, my grandmother taught me how to make traditional dishes in the kitchen and we’d dance around listening to music on our CD player. In my adult life, I’ve taken up knitting and sewing, pottery, and as of late, even antique furniture revitalization. I consistently derive pleasure from keeping myself occupied in various ways.</p><p>If you were to ask me where this passion for learning new things comes from, I would have a hard time pinpointing pivotal moments in my life that led me here. Even at a young age, I stuck out as a nerdier, louder and more eccentric version of those around me. Constantly dancing to the beat of my own drum, regardless of who was around.</p><p>The more you take on, the more you let other things eventually slip. This has proven true for work and my personal life. For me, it has become one of the more difficult things about being someone who is interested in such a wide range of topics. A few weeks ago, LinkedIn suggested a prompt for my content, and immediately I knew this was something I would be interested in discussing. <strong>Balance</strong>. The balance between continuous learning in professional development, and meeting your ever-growing project deadlines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xFHAtPAVda1m9riZSez23w.jpeg" /></figure><h4>Always prioritize the deadlines</h4><p>If I were to outline a hierarchy of needs for professional development and managing work deadlines, I’d place the latter at the top. Unlike Maslow’s hierarchy, professional development isn’t a prerequisite for meeting your deadlines — they’re two separate things. It’s about knowing when deadlines are coming up and when you have some time in your day to shift focus to other things.</p><p>Recently, my teammate and I were tasked to work on a big project for the company. During this time, my calendar was packed, leaving little to no free time. Alongside our meetings and producing the work required, I realized I wouldn’t have time to read the newsletters I was used to starting my day with in addition to responding to LinkedIn messages for coffee chats. <em>It was simply not possible.</em></p><p>In the past, I might have felt the need to do both, and as a result, I would have struggled in both areas. Professional development for me, requires a clear mind with set intentions. Knowing that 95% of my brainpower was focused on finishing the project during this period, I let go of the internalized pressure to keep up with my daily reading routine.</p><p>What I observed was that by concentrating on the project, I had more capacity to learn something completely new when the opportunity arose. In short, completing a project like this one, can still be a form of professional development, and often, you’ll notice the two <em>will</em> intersect. This project involved working on something unfamiliar to me, something I had never done before. Although this topic wouldn’t have come up in my professional development efforts otherwise, the learning still took place nonetheless.</p><h4>Find a list of your trusted sources and keep it small (for now)</h4><p>With so many prominent figures and new tools emerging in this industry what seems like everyday, it’s hard to know where to look and what to focus on. There also needs to be balance with where you look for your inspiration and professional development opportunities.</p><p>What works for me is sticking to authors who focus on topics that are relevant to where I am in my career today. Yes, I have goals for where I see myself in five and ten years, but that would take too many hours out of my already-short day. With that being said, I have found that focusing on progressing in Analytics Engineering, technical writing and data warehouse design principles helps me keep my opportunities for professional development to a healthy minimum.</p><p>However you choose to learn, is completely up to you. Everyone has their preferred methods, and I prefer to subscribe to newsletters or follow prominent members of the industry on LinkedIn and read through their posts. While newsletters are great, there is something euphoric about opening a new book and being the first highlight in amongst the clear, crisp pages. All this to say, I’ll also never pass up on an opportunity to purchase a new book with information relevant to my interests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*JpUOSqliiLn93-EryuDWIg.jpeg" /></figure><h4>Webinars are not intended to be listened to live</h4><p>If you’re like me your calendar is absolutely filled with webinars you’d love to attend, but likely can’t. I’m here to tell you that, 99% of webinars are sent to you via email once they’re finished. You don’t and shouldn’t pressure yourself to take 2 hours out of your day to attend them. When I first got started in my data career, I would sit at my desk and attempt to listen to webinars while also trying to develop SQL queries or dashboards. This proved to be highly inefficient for me, because not only did I not grasp anything from the webinars I attended, I found myself distracted and constantly forgetting what the goal of my work actually was.</p><p>While my ability to context switch and multi-task has improved significantly in the last five years, I also believe there is a fine line for when multi-tasking breaches on inefficient. Listening to webinars while you are trying to produce good work is one of those times. For me, I’ve typically decided that the best time to listen to webinars is near the end of the work week which is typically filled with less meetings. If the week has been extremely busy, I dedicate a few hours on the weekend to listening and taking notes that I can share the upcoming week.</p><p>In a previous post, I included a bunch of my favourite resources for how I choose to stay current and up-skill with regards to my career. I’ve linked that <a href="https://www.linkedin.com/posts/katherine-chiodo_upskilling-learning-professionaldevelopment-activity-7046549003768918016-38WD?utm_source=share&amp;utm_medium=member_desktop">here</a> for those who may be interested.</p><p><strong>Katherine Chiodo, author of the weekly NULLIF() newsletter ❤ <br></strong>Subscribe today! <a href="https://nullifblog.ck.page/subscribenow">https://nullifblog.ck.page/subscribenow</a><br>Connect on LinkedIn: <a href="https://www.linkedin.com/in/katherine-chiodo-811693135/">https://www.linkedin.com/in/katherine-chiodo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c416eb7b9799" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>