Posts

Showing posts with the label dbt

Macros in dbt | Data Build Tool | Jinja and macros tutorial

  oms_dbt_proj\macros\oms_common.sql {% macro to_celsius ( fahrenheit_column , decimal_places = 1 ) %}   ROUND ( ({{ fahrenheit_column }} - 32 ) * 5 / 9 , {{ decimal_places }}) {% endmacro %} {% macro generate_profit_model ( table_name ) %} SELECT   sales_date ,   SUM ( quantity_sold * unit_sell_price ) as total_revenue ,   SUM ( quantity_sold * unit_purchase_cost ) as total_cost ,   SUM ( quantity_sold * unit_sell_price ) - SUM ( quantity_sold * unit_purchase_cost ) as total_profit FROM {{ source ( 'training' , table_name ) }} GROUP BY sales_date {% endmacro %} oms_dbt_proj\models\profit_uk.sql {{ generate_profit_model ( 'sales_uk' ) }}

DBT doc blocks | DBT Docs | dbt documentation best practices

  oms_config.yml models :   - name : customers_stg     description : Staged customer data from order management system (OMS), with minor row-level transformations.       columns :       - name : Email         description : Customer's Primay Email address for promotions and offers.               tests :           - string_not_empty   - name : employees_stg     description : Staged employees data from order management system (oms), with minor row-level transformations.       columns :       - name : JobTitle         description : Employee's Job Title based on his current Roles and Responsibilities.               tests :           - string_not_empty   - name : orders_stg     description : Staged orders data from order ma...

How to Install DBT and Set Up a Project, Create Your First dbt Model

  ###### Snowflake DDL  - at the end ######### Hello Data Folks,  Today we’ll see how to install DBT, set up your first project, and create a dbt model. So, without further ado, let's dive right in and get started!   Python is a prerequisite for using dbt, so make sure to download it from python.org and install it on your system. Please select this checkbox during the installation process. This’ll automatically add the Python installation directory to your system's Path variable. To verify that Python is working correctly, open the command prompt and use the "python --version" command. Looking good!   Let's now download and install Visual Studio Code, the most powerful and widely used IDE in the industry. After installing VS Code, please proceed to install the Python and dbt extensions one after another. As a best practice, please choose extensions with high downloads and ratings.   Please open the terminal, and cd to the path where you want to setup your f...