Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      How To Prevent WordPress SQL Injection Attacks

      June 13, 2025

      Java never goes out of style: Celebrating 30 years of the language

      June 12, 2025

      OpenAI o3-pro available in the API, BrowserStack adds Playwright support for real iOS devices, and more – Daily News Digest

      June 12, 2025

      Creating The “Moving Highlight” Navigation Bar With JavaScript And CSS

      June 11, 2025

      Microsoft Copilot’s own default configuration exposed users to the first-ever “zero-click” AI attack, but there was no data breach

      June 13, 2025

      Sam Altman says “OpenAI was forced to do a lot of unnatural things” to meet the Ghibli memes demand surge

      June 13, 2025

      5 things we didn’t get from the Xbox Games Showcase, because Xbox obviously hates me personally

      June 13, 2025

      Minecraft Vibrant Visuals finally has a release date and it’s dropping with the Happy Ghasts

      June 13, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      QAQ-QQ-AI-QUEST

      June 13, 2025
      Recent

      QAQ-QQ-AI-QUEST

      June 13, 2025

      JS Dark Arts: Abusing prototypes and the Result type

      June 13, 2025

      Helpful Git Aliases To Maximize Developer Productivity

      June 13, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft Copilot’s own default configuration exposed users to the first-ever “zero-click” AI attack, but there was no data breach

      June 13, 2025
      Recent

      Microsoft Copilot’s own default configuration exposed users to the first-ever “zero-click” AI attack, but there was no data breach

      June 13, 2025

      Sam Altman says “OpenAI was forced to do a lot of unnatural things” to meet the Ghibli memes demand surge

      June 13, 2025

      5 things we didn’t get from the Xbox Games Showcase, because Xbox obviously hates me personally

      June 13, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»YAML files in DBT

    YAML files in DBT

    June 12, 2025

    To make streamline project development and maintenance, in any programming language, we need the support of metadata, configuration, and documentation. Project configurations can be done using configuration files. Configuration files are easy to use and make it user friendly to interact with developer. One such type of configuration files used in DBT are the YAML files.
    In this blog, will go through the required YAML files in DBT.
    Let’s understand first what YAML is and DBT

    DBT (Data Build Tool) :
    Data transformation is the important process in modern analytics. DBT is a system to transform, clean and aggregate data within data warehouse. The power of DBT lies in its utilization of YAML files for both configuration and transformation.
    Note:
    Please go through link for DBT(DBT)
    What is YAML file:
    YAML acronym as “Yet Another Markup Language.” It is easy to read and understand. YAML is superset of JSON.
    Common use of YAML file:
    – Configuration Management:
    Use to define configuration like roles, environment.
    – CI/CD Pipeline:
    CI/CD tools depend on YAML file to describe their pipeline.
    – Data Serialization:
    YAML can manage complex data types such as linked list, arrays, etc.
    – API:
    YAML can be use in defining API contracts and specification.

    Sample Example of YAML file:
    Pictureyaml
    YAML files are the core of defining configuration and transformation in DBT. YAML files have “.yml” extension.

    The most important YAML file is
    profiles.yml:
    This file needs to be locally. It contains sensitive that can be used to connect with target data warehouse.
    Purpose:
    It consists of main configuration details to which connect with data warehouse(Snowflake, Postgres, etc.)
    profile configuration looks like as :
    Picturedbtdemo
    Note:
    We should not share profiles.yml file with anyone because it consists of target data warehouse information. This file will be used in DBT core and not  in DBT cloud.
    YAML file classification according to DBT component:
    Let us go through different components of DBT with corresponding YAML files:

    1.dbt_project.yml:
    This is the most important configuration file in DBT. This file tells DBT what configuration
    need to use for projects. By default, dbt_project.yml is the current directory structure

    For Example:

    name: string
    
    config-version: 2
    version: version
    
    profile: profilename
    
    model-paths: [directorypath]
    seed-paths: [directorypath]
    test-paths: [directorypath]
    analysis-paths: [directorypath]
    macro-paths: [directorypath]
    snapshot-paths: [directorypath]
    docs-paths: [directorypath]
    asset-paths: [directorypath]
    
    packages-install-path: directorypath
    
    clean targets: [directorypath]
    
    query-comment: string
    
    require-dbt-version: version-range | [version-range]
    
    flags:
      <global-configs>
    
    dbt-cloud:
      project-id: project_id # Required
      defer-env-id: environment # Optional
    
    exposures:
      +enabled: true | false.
    
    quoting:
      database: true | false
      schema: true | false
      identifier: true | false
    
    metrics:
      <metric-configs>
    
    models:
      <model-configs>
    
    seeds:
      <seed-configs>
    
    semantic-models:
      <semantic-model-configs>
    
    saved-queries:
      <saved-queries-configs>
    
    snapshots:
      <snapshot-configs>
    
    sources:
      <source-configs>
      
    tests:
      <test-configs>
    
    vars:
      <variables>
    
    on-run-start: sql-statement | [sql-statement]
    on-run-end: sql-statement | [sql-statement]
    
    dispatch:
      - macro_namespace: packagename
        search_order: [packagename]
    
    restrict-access: true | false
    

     

    Model:
    Models use SQL language that defines how your data is transformed .In a model, configuration file, you define the source and the target tables and their transformations. It is under the model directory of DBT project, and we can give name as per our convenience.
    Below is the example:
    Picturemodel   This is the YAML file in model. Given name as “schema.yml”
    Purpose of model YML file:
    It configures the model level metadata such as tags, materialization, name, column which use for transforming the data
    It looks like as below:

    version: 2
    
    models:
      - name: my_first_dbt_model
        description: "A starter dbt model"
        columns:
          - name: id
            description: "The primary key for this table"
            data_tests:
              - unique
              - not_null
    
      - name: my_second_dbt_model
        description: "A starter dbt model"
        columns:
          - name: id
            description: "The primary key for this table"
            data_tests:
              - unique
              - not_null
    
    
    

    2.Seed:
    Seeds used to load CSV files into data model. This is useful for staging before applying any
    transformation.
    Below is the example:
    Pictureseeds

    Purpose of Seeds YAML file:
    To define the path of CSV file under seed directory and which column needs to transform in CSV file and load into the data warehouse tables.

    Configuration file looks like as below:

    version: 2
    seeds:
      - name: <name>
        description: Raw data from a source
        database: <database name>
        schema: <database schema>
        materialized: table
        sql: |-
          SELECT
            id,
            name
          FROM <source_table>
    
    

    Testing:
    Testing is a key step in any project. Similarly, DBT create test folder to test unique constraints, not null values.

    Create dbtTest.yml file under test folder of DBT project

    And it looks like as below:

    Picturetest
    Purpose of test YML file as:
    It helps to check data integrity quality and separates from the business logic
    It looks like as below:

    columns:
      - name: order_id
        tests:
          - not_null
          - unique
    
    

    As we go through different YAML files in DBT and purpose for the same.

    Conclusion:
    dbt and its YAML files provide human readable way to manage data transformation. With dbt, we can easily create, transform, and test the data models and make valuable tools for data professionals. With both DBT and YAML, it empowers you to work more efficiently as data analyst. Data engineers or business analysts

    Thanks for reading.

     

     

     

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleWhy AI-Led Experiences Are the Future — And How Sitecore Stream Delivers Them
    Next Article Developing a Serverless Blogging Platform with AWS Lambda and Python

    Related Posts

    Artificial Intelligence

    Last Week in AI #302 – QwQ 32B, OpenAI injunction refused, Alexa Plus

    June 13, 2025
    Artificial Intelligence

    LWiAI Podcast #202 – Qwen-32B, Anthropic’s $3.5 billion, LLM Cognitive Behaviors

    June 13, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    The best VPNs for Canada in 2025: Expert tested

    News & Updates

    Best Free and Open Source Alternatives to Microsoft Forms

    Linux

    Gemma Scope: helping the safety community shed light on the inner workings of language models

    Artificial Intelligence

    CVE-2025-35996 – KUNBUS PiCtory Stored Cross-Site Scripting (XSS)

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    CVE-2025-27132 – OpenHarmony Out-of-Bounds Write Arbitrary Code Execution

    May 6, 2025

    CVE ID : CVE-2025-27132

    Published : May 6, 2025, 9:15 a.m. | 1 hour, 12 minutes ago

    Description : in OpenHarmony v5.0.3 and prior versions allow a local attacker arbitrary code execution in pre-installed apps through out-of-bounds write. This vulnerability can be exploited only in restricted scenarios.

    Severity: 3.8 | LOW

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    RL^V: Unifying Reasoning and Verification in Language Models through Value-Free Reinforcement Learning

    May 13, 2025

    Biophysical Brain Models Get a 2000× Speed Boost: Researchers from NUS, UPenn, and UPF Introduce DELSSOME to Replace Numerical Integration with Deep Learning Without Sacrificing Accuracy

    April 16, 2025

    “The Chinese player base is the holy grail”: Tencent buys 15.75% stake in Helldivers 2 dev Arrowhead as huge profit numbers emerge

    June 7, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.