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 first project.

Create a Python virtual environment.

Activate the virtual environment created.

 

Let's install dbt with the “pip install dbt hyphen data platform” command.

For instance, if you are using Snowflake, run “pip install dbt-snowflake”.

 

Before we initialize our first project, we should create a dot dbt folder in the user home directory.

You can either do it over here, with this make directory command.

Or navigate to the home directory using %userprofile%, and create the folder.

This is the default folder where dbt will create and maintain the profile dot yamel, one of the important dbt configuration files, where database connection details and user credentials are stored.

 

We are ready to initialize our first dbt project using the “dbt init” command.

This command creates the necessary folder structure for dbt.

and generates the dbt_project dot yamel file, which contains project-specific configurations.

it also creates the profiles dot yamel file, which stores the database connection details.

 

Please follow the onscreen instructions and respond to the prompts that appear.

 

Now, let's navigate to the project that was just created.

The file we want to focus on is the dbt_project dot yamel. It contains important information such as the project name, version, and most notably, the target database profile.

Additionally, you’ll find the profiles dot yamel file in your home directory. This file stores the database connection details, which you supplied during the dbt init process.

 

At this point, it’s a good idea to verify the connectivity between dbt and your data platform using the “dbt debug” command.

Great, connection works as expected.

 

Next, we’ll move forward to creating our first dbt model.

In the context of dbt, a model refers to a SQL query or a group of SQL queries that are designed to carry out a particular transformation task on your data platform.

 

This data model represents an “order management system”, a project in the retail domain.

We’ll explore more about this business and data model in our upcoming sessions. However, for now, our focus will be on the customers and orders.

Using these two tables, let's attempt to identify customers who have placed a larger number of orders.

 

As mentioned earlier, dbt models predominantly consist of SQL statements.

So, let's begin by writing a SELECT query that fulfills our requirement.

We could join the "customers" and "orders" tables, and aggregate the results using the GROUP BY clause.

 

It works! However, dbt makes extensive use of Common Table Expressions or CTEs, for improved readability and modularity; so, you must understand how to write SQL queries using CTEs.

CTEs act as temporary tables that are accessible only within the same query and are discarded after the query execution. To use a CTE, simply prefix “with “CTE name” as” to your SELECT statement.

Using CTEs provides an abstraction of the underlying complex logic, resulting in a more readable and modular query.

Let's create our first model called "customerorders.sql" with the query that we’ve just framed.

Please save the model once you are done.

Now, we are ready to execute our first model.

Issue the "dbt run" command in the terminal. This command references the "dbt-project dot yamel" file, and "profile dot yamel" file for project and connection details respectively, and executes the models in the project.

If the execution is successful, you’ll see that a view with the same name as the model file has been created.

Let's verify the object created in Snowflake.

All working well as expected; the business users can now effortlessly utilize their preferred reporting tools like PowerBI to access this data.

 

Before we wrap up, there is one final point worth mentioning.

The default materialization for dbt models is a view, but it can be configured or changed to the table, either at the "dbt-project dot yamel" file or at the model file itself.

Let’s rerun the project after this change.

As expected, the model has been successfully created as a table this time.


That's all for today, in our next video, we'll take a deep dive into dbt models, create dependencies between them, and much more.

So please stay tuned for more exiting videos, and don't forget to like – subscribe - and share your comments. Thanks for watching!


CREATE DATABASE SLEEKMART_OMS;

CREATE SCHEMA L1_LANDING;

CREATE SCHEMA L2_PROCESSING;

CREATE SCHEMA L3_CONSUMPTION;

 

USE database SLEEKMART_OMS;

USE SCHEMA L1_LANDING;


CREATE TABLE IF NOT EXISTS Dates (

Date DATE NOT NULL,

Day VARCHAR(3) NULL,

Month VARCHAR(10) NULL,

Year VARCHAR(4) NULL,

Quarter INT NULL,

DayOfWeek VARCHAR(10) NULL,

WeekOfYear INT NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (Date));


CREATE TABLE IF NOT EXISTS customers (

CustomerID VARCHAR(10),

FirstName VARCHAR(50),

LastName VARCHAR(50),

Email VARCHAR(100),

Phone VARCHAR(100),

Address VARCHAR(100),

City VARCHAR(50),

State VARCHAR(2),

ZipCode VARCHAR(10),

Updated_at TIMESTAMP);


CREATE TABLE IF NOT EXISTS Employees (

EmployeeID INT NOT NULL,

FirstName VARCHAR(100) NULL,

LastName VARCHAR(100) NULL,

Email VARCHAR(200) NULL,

JobTitle VARCHAR(100) NULL,

HireDate DATE NULL,

ManagerID INT NULL,

Address VARCHAR(200) NULL,

City VARCHAR(50) NULL,

State VARCHAR(50) NULL,

ZipCode VARCHAR(10) NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (EmployeeID));


CREATE TABLE IF NOT EXISTS Stores (

StoreID INT NOT NULL,

StoreName VARCHAR(100) NULL,

Address VARCHAR(200) NULL,

City VARCHAR(50) NULL,

State VARCHAR(50) NULL,

ZipCode VARCHAR(10) NULL,

Email VARCHAR(200) NULL,

Phone VARCHAR(50) NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (StoreID));


CREATE TABLE IF NOT EXISTS Suppliers (

SupplierID INT NOT NULL,

SupplierName VARCHAR(100) NULL,

ContactPerson VARCHAR(100) NULL,

Email VARCHAR(200) NULL,

Phone VARCHAR(50) NULL,

Address VARCHAR(50) NULL,

City VARCHAR(50) NULL,

State VARCHAR(10) NULL,

ZipCode VARCHAR(10) NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (SupplierID));


CREATE TABLE IF NOT EXISTS Products (

ProductID INT NOT NULL,

Name VARCHAR(100) NULL,

Category VARCHAR(100) NULL,

RetailPrice DECIMAL(10,2) NULL,

SupplierPrice DECIMAL(10,2) NULL,

SupplierID INT NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (ProductID));


CREATE TABLE IF NOT EXISTS OrderItems (

OrderItemID INT NOT NULL,

OrderID INT NULL,

ProductID INT NULL,

Quantity INT NULL,

UnitPrice DECIMAL(10,2) NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (OrderItemID));


CREATE TABLE IF NOT EXISTS Orders (

OrderID INT NOT NULL,

OrderDate DATE NULL,

CustomerID INT NULL,

EmployeeID INT NULL,

StoreID INT NULL,

Status VARCHAR(10) NULL,

Updated_at TIMESTAMP NULL,

PRIMARY KEY (OrderID));





Comments

  1. Hi Team, Thanks for your great tutorial. However you provided the DDL to create these tables, could you please also provide Insert Statement to ingest the data or .csv files, so that I can ingest those files to respective tables. Do please share the CTE DDL's as well to my email id deepak-kumar-xft-ggn@gmail.com. Thanks for your great work once again!! :)

    ReplyDelete
  2. Brother, pls copy these DDL from here and request Chat GPT for inserts statement.

    ReplyDelete
  3. Can someone please provide me the insert statements (with data).

    ReplyDelete
  4. -- Sample data for Dates table
    INSERT INTO Dates (Date, Day, Month, Year, Quarter, DayOfWeek, WeekOfYear, Updated_at) VALUES
    ('2024-01-01', 'Mon', 'January', '2024', 1, 'Monday', 1, '2024-08-01 10:00:00'),
    ('2024-01-02', 'Tue', 'January', '2024', 1, 'Tuesday', 1, '2024-08-01 10:00:00'),
    ('2024-01-03', 'Wed', 'January', '2024', 1, 'Wednesday', 1, '2024-08-01 10:00:00'),
    ('2024-01-04', 'Thu', 'January', '2024', 1, 'Thursday', 1, '2024-08-01 10:00:00'),
    ('2024-01-05', 'Fri', 'January', '2024', 1, 'Friday', 1, '2024-08-01 10:00:00');

    -- Sample data for customers table
    INSERT INTO customers (CustomerID, FirstName, LastName, Email, Phone, Address, City, State, ZipCode, Updated_at) VALUES
    ('C001', 'John', 'Doe', 'john.doe@example.com', '555-0100', '123 Main St', 'Springfield', 'IL', '62701', '2024-08-01 10:00:00'),
    ('C002', 'Jane', 'Smith', 'jane.smith@example.com', '555-0101', '456 Oak St', 'Springfield', 'IL', '62702', '2024-08-01 10:00:00'),
    ('C003', 'Alice', 'Johnson', 'alice.johnson@example.com', '555-0102', '789 Pine St', 'Springfield', 'IL', '62703', '2024-08-01 10:00:00'),
    ('C004', 'Bob', 'Brown', 'bob.brown@example.com', '555-0103', '101 Maple St', 'Springfield', 'IL', '62704', '2024-08-01 10:00:00'),
    ('C005', 'Charlie', 'Davis', 'charlie.davis@example.com', '555-0104', '202 Birch St', 'Springfield', 'IL', '62705', '2024-08-01 10:00:00');

    ReplyDelete
  5. -- Sample data for Employees table
    INSERT INTO Employees (EmployeeID, FirstName, LastName, Email, JobTitle, HireDate, ManagerID, Address, City, State, ZipCode, Updated_at) VALUES
    (1, 'Tom', 'Hanks', 'tom.hanks@example.com', 'Manager', '2022-01-15', NULL, '101 Maple St', 'Springfield', 'IL', '62701', '2024-08-01 10:00:00'),
    (2, 'Emma', 'Watson', 'emma.watson@example.com', 'Sales Associate', '2023-02-20', 1, '202 Birch St', 'Springfield', 'IL', '62702', '2024-08-01 10:00:00'),
    (3, 'Mark', 'Smith', 'mark.smith@example.com', 'Developer', '2021-03-10', 1, '303 Cedar St', 'Springfield', 'IL', '62703', '2024-08-01 10:00:00'),
    (4, 'Lucy', 'Williams', 'lucy.williams@example.com', 'HR', '2020-04-25', 1, '404 Oak St', 'Springfield', 'IL', '62704', '2024-08-01 10:00:00'),
    (5, 'David', 'Jones', 'david.jones@example.com', 'Support', '2019-05-30', 2, '505 Pine St', 'Springfield', 'IL', '62705', '2024-08-01 10:00:00');

    -- Sample data for Stores table
    INSERT INTO Stores (StoreID, StoreName, Address, City, State, ZipCode, Email, Phone, Updated_at) VALUES
    (1, 'Main Street Store', '111 Main St', 'Springfield', 'IL', '62701', 'mainstore@example.com', '555-0120', '2024-08-01 10:00:00'),
    (2, 'Downtown Store', '222 Elm St', 'Springfield', 'IL', '62702', 'downtownstore@example.com', '555-0121', '2024-08-01 10:00:00'),
    (3, 'Eastside Store', '333 Oak St', 'Springfield', 'IL', '62703', 'eastsidestore@example.com', '555-0122', '2024-08-01 10:00:00'),
    (4, 'Westside Store', '444 Birch St', 'Springfield', 'IL', '62704', 'westsidestore@example.com', '555-0123', '2024-08-01 10:00:00'),
    (5, 'Southside Store', '555 Cedar St', 'Springfield', 'IL', '62705', 'southsidestore@example.com', '555-0124', '2024-08-01 10:00:00');

    -- Sample data for Suppliers table
    INSERT INTO Suppliers (SupplierID, SupplierName, ContactPerson, Email, Phone, Address, City, State, ZipCode, Updated_at) VALUES
    (1, 'ABC Supplies', 'Robert Brown', 'robert.brown@abc.com', '555-0130', '123 Supply St', 'Springfield', 'IL', '62701', '2024-08-01 10:00:00'),
    (2, 'XYZ Corp', 'Susan Green', 'susan.green@xyz.com', '555-0131', '456 Warehouse St', 'Springfield', 'IL', '62702', '2024-08-01 10:00:00'),
    (3, '123 Distributors', 'Nancy White', 'nancy.white@123.com', '555-0132', '789 Distribution St', 'Springfield', 'IL', '62703', '2024-08-01 10:00:00'),
    (4, 'Tech Supplies', 'James Black', 'james.black@tech.com', '555-0133', '101 Tech St', 'Springfield', 'IL', '62704', '2024-08-01 10:00:00'),
    (5, 'Home Supplies', 'Michael Blue', 'michael.blue@home.com', '555-0134', '202 Home St', 'Springfield', 'IL', '62705', '2024-08-01 10:00:00');

    -- Sample data for Products table
    INSERT INTO Products (ProductID, Name, Category, RetailPrice, SupplierPrice, SupplierID, Updated_at) VALUES
    (1, 'Laptop', 'Electronics', 999.99, 800.00, 1, '2024-08-01 10:00:00'),
    (2, 'Smartphone', 'Electronics', 699.99, 500.00, 2, '2024-08-01 10:00:00'),
    (3, 'Tablet', 'Electronics', 499.99, 350.00, 3, '2024-08-01 10:00:00'),
    (4, 'Monitor', 'Electronics', 199.99, 150.00, 4, '2024-08-01 10:00:00'),
    (5, 'Keyboard', 'Electronics', 49.99, 30.00, 5, '2024-08-01 10:00:00');

    -- Sample data for Orders table
    INSERT INTO Orders (OrderID, OrderDate, CustomerID, EmployeeID, StoreID, Status, Updated_at) VALUES
    (1, '2024-07-15', 'C001', 1, 1, 'Shipped', '2024-08-01 10:00:00'),
    (2, '2024-07-16', 'C002', 2, 2, 'Pending', '2024-08-01 10:00:00'),
    (3, '2024-07-17', 'C003', 3, 3, 'Delivered', '2024-08-01 10:00:00'),
    (4, '2024-07-18', 'C004', 4, 4, 'Processing', '2024-08-01 10:00:00'),
    (5, '2024-07-19', 'C005', 5, 5, 'Cancelled', '2024-08-01 10:00:00');

    -- Sample data for OrderItems table
    INSERT INTO OrderItems (OrderItemID, OrderID, ProductID, Quantity, UnitPrice, Updated_at) VALUES
    (1, 1, 1, 1, 999.99, '2024-08-01 10:00:00'),
    (2, 2, 2, 1, 699.99, '2024-08-01 10:00:00'),
    (3, 3, 3, 2, 499.99, '2024-08-01 10:00:00'),
    (4, 4, 4, 1, 199.99, '2024-08-01 10:00:00'),
    (5, 5, 5, 3, 49.99, '2024-08-01 10:00:00');

    ReplyDelete
  6. Orders.CustomerID should be VARCHAR (Customer.CustomerID VARCHAR(10))

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. WITH CUSTOMERORDERS AS (
    SELECT
    c.CustomerID,
    CONCAT(c.firstName, ' ', c.lastName) AS CustomerName,
    COUNT(o.OrderID) AS No_Of_Orders
    FROM L1_LANDING.CUSTOMERS c
    INNER JOIN L1_LANDING.ORDERS o
    ON c.CustomerID = o.CustomerID
    GROUP BY c.CustomerID, CustomerName
    ORDER BY No_Of_Orders DESC
    )

    SELECT CustomerID, CustomerName, No_Of_Orders
    FROM CUSTOMERORDERS

    ReplyDelete
  9. customers_stg.sql

    SELECT
    CustomerID,
    FIrstName,
    lastname,
    Email,
    Phone,
    Address,
    City,
    State,
    ZipCode,
    Updated_at,
    CONCAT(FirstName, ' ', LastName) AS CustomerName
    FROM L1_LANDING.CUSTOMERS c

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. -- Create Employees table
    CREATE TABLE IF NOT EXISTS dbt_tutorial.l1_landing.Employees (
    EmployeeID INT,
    FirstName STRING,
    LastName STRING,
    Email STRING,
    JobTitle STRING,
    HireDate DATE,
    ManagerID INT,
    Address STRING,
    City STRING,
    State STRING,
    ZipCode STRING,
    Updated_at TIMESTAMP
    );

    -- Create Stores table
    CREATE TABLE IF NOT EXISTS dbt_tutorial.l1_landing.Stores (
    StoreID INT,
    StoreName STRING,
    Address STRING,
    City STRING,
    State STRING,
    ZipCode STRING,
    Email STRING,
    Phone STRING,
    Updated_at TIMESTAMP
    );

    -- Create Suppliers table
    CREATE TABLE IF NOT EXISTS dbt_tutorial.l1_landing.Suppliers (
    SupplierID INT,
    SupplierName STRING,
    ContactPerson STRING,
    Email STRING,
    Phone STRING,
    Address STRING,
    City STRING,
    State STRING,
    ZipCode STRING,
    Updated_at TIMESTAMP
    );

    -- Create Products table
    CREATE TABLE IF NOT EXISTS dbt_tutorial.l1_landing.Products (
    ProductID INT,
    Name STRING,
    Category STRING,
    RetailPrice DOUBLE,
    SupplierPrice DOUBLE,
    SupplierID INT,
    Updated_at TIMESTAMP
    );

    -- Create Orders table
    CREATE TABLE IF NOT EXISTS dbt_tutorial.l1_landing.Orders (
    OrderID INT,
    OrderDate DATE,
    CustomerID STRING,
    EmployeeID INT,
    StoreID INT,
    Status STRING,
    Updated_at TIMESTAMP
    );

    -- Create OrderItems table
    CREATE TABLE IF NOT EXISTS dbt_tutorial.l1_landing.OrderItems (
    OrderItemID INT,
    OrderID INT,
    ProductID INT,
    Quantity INT,
    UnitPrice DOUBLE,
    Updated_at TIMESTAMP
    );

    ReplyDelete
  12. -- Sample data for Dates table
    INSERT INTO Dates (Date, Day, Month, Year, Quarter, DayOfWeek, WeekOfYear, Updated_at) VALUES
    ('2024-01-01', 'Mon', 'January', '2024', 1, 'Monday', 1, '2024-08-01 10:00:00'),
    ('2024-01-02', 'Tue', 'January', '2024', 1, 'Tuesday', 1, '2024-08-01 10:00:00'),
    ('2024-01-03', 'Wed', 'January', '2024', 1, 'Wednesday', 1, '2024-08-01 10:00:00'),
    ('2024-01-04', 'Thu', 'January', '2024', 1, 'Thursday', 1, '2024-08-01 10:00:00'),
    ('2024-01-05', 'Fri', 'January', '2024', 1, 'Friday', 1, '2024-08-01 10:00:00');

    -- Sample data for customers table
    INSERT INTO customers (CustomerID, FirstName, LastName, Email, Phone, Address, City, State, ZipCode, Updated_at) VALUES
    ('C001', 'John', 'Doe', 'john.doe@example.com', '555-0100', '123 Main St', 'Springfield', 'IL', '62701', '2024-08-01 10:00:00'),
    ('C002', 'Jane', 'Smith', 'jane.smith@example.com', '555-0101', '456 Oak St', 'Springfield', 'IL', '62702', '2024-08-01 10:00:00'),
    ('C003', 'Alice', 'Johnson', 'alice.johnson@example.com', '555-0102', '789 Pine St', 'Springfield', 'IL', '62703', '2024-08-01 10:00:00'),
    ('C004', 'Bob', 'Brown', 'bob.brown@example.com', '555-0103', '101 Maple St', 'Springfield', 'IL', '62704', '2024-08-01 10:00:00'),
    ('C005', 'Charlie', 'Davis', 'charlie.davis@example.com', '555-0104', '202 Birch St', 'Springfield', 'IL', '62705', '2024-08-01 10:00:00');

    -- Sample data for Employees table
    INSERT INTO dbt_tutorial.l1_landing.Employees (EmployeeID, FirstName, LastName, Email, JobTitle, HireDate, ManagerID, Address, City, State, ZipCode, Updated_at) VALUES
    (1, 'Tom', 'Hanks', 'tom.hanks@example.com', 'Manager', '2022-01-15', NULL, '101 Maple St', 'Springfield', 'IL', '62701', '2024-08-01 10:00:00'),
    (2, 'Emma', 'Watson', 'emma.watson@example.com', 'Sales Associate', '2023-02-20', 1, '202 Birch St', 'Springfield', 'IL', '62702', '2024-08-01 10:00:00'),
    (3, 'Mark', 'Smith', 'mark.smith@example.com', 'Developer', '2021-03-10', 1, '303 Cedar St', 'Springfield', 'IL', '62703', '2024-08-01 10:00:00'),
    (4, 'Lucy', 'Williams', 'lucy.williams@example.com', 'HR', '2020-04-25', 1, '404 Oak St', 'Springfield', 'IL', '62704', '2024-08-01 10:00:00'),
    (5, 'David', 'Jones', 'david.jones@example.com', 'Support', '2019-05-30', 2, '505 Pine St', 'Springfield', 'IL', '62705', '2024-08-01 10:00:00');

    ReplyDelete
  13. -- Sample data for Stores table
    INSERT INTO dbt_tutorial.l1_landing.Stores (StoreID, StoreName, Address, City, State, ZipCode, Email, Phone, Updated_at) VALUES
    (1, 'Main Street Store', '111 Main St', 'Springfield', 'IL', '62701', 'mainstore@example.com', '555-0120', '2024-08-01 10:00:00'),
    (2, 'Downtown Store', '222 Elm St', 'Springfield', 'IL', '62702', 'downtownstore@example.com', '555-0121', '2024-08-01 10:00:00'),
    (3, 'Eastside Store', '333 Oak St', 'Springfield', 'IL', '62703', 'eastsidestore@example.com', '555-0122', '2024-08-01 10:00:00'),
    (4, 'Westside Store', '444 Birch St', 'Springfield', 'IL', '62704', 'westsidestore@example.com', '555-0123', '2024-08-01 10:00:00'),
    (5, 'Southside Store', '555 Cedar St', 'Springfield', 'IL', '62705', 'southsidestore@example.com', '555-0124', '2024-08-01 10:00:00');

    -- Sample data for Suppliers table
    INSERT INTO dbt_tutorial.l1_landing.Suppliers (SupplierID, SupplierName, ContactPerson, Email, Phone, Address, City, State, ZipCode, Updated_at) VALUES
    (1, 'ABC Supplies', 'Robert Brown', 'robert.brown@abc.com', '555-0130', '123 Supply St', 'Springfield', 'IL', '62701', '2024-08-01 10:00:00'),
    (2, 'XYZ Corp', 'Susan Green', 'susan.green@xyz.com', '555-0131', '456 Warehouse St', 'Springfield', 'IL', '62702', '2024-08-01 10:00:00'),
    (3, '123 Distributors', 'Nancy White', 'nancy.white@123.com', '555-0132', '789 Distribution St', 'Springfield', 'IL', '62703', '2024-08-01 10:00:00'),
    (4, 'Tech Supplies', 'James Black', 'james.black@tech.com', '555-0133', '101 Tech St', 'Springfield', 'IL', '62704', '2024-08-01 10:00:00'),
    (5, 'Home Supplies', 'Michael Blue', 'michael.blue@home.com', '555-0134', '202 Home St', 'Springfield', 'IL', '62705', '2024-08-01 10:00:00');

    -- Sample data for Products table
    INSERT INTO dbt_tutorial.l1_landing.Products (ProductID, Name, Category, RetailPrice, SupplierPrice, SupplierID, Updated_at) VALUES
    (1, 'Laptop', 'Electronics', 999.99, 800.00, 1, '2024-08-01 10:00:00'),
    (2, 'Smartphone', 'Electronics', 699.99, 500.00, 2, '2024-08-01 10:00:00'),
    (3, 'Tablet', 'Electronics', 499.99, 350.00, 3, '2024-08-01 10:00:00'),
    (4, 'Monitor', 'Electronics', 199.99, 150.00, 4, '2024-08-01 10:00:00'),
    (5, 'Keyboard', 'Electronics', 49.99, 30.00, 5, '2024-08-01 10:00:00');

    -- Sample data for Orders table
    INSERT INTO dbt_tutorial.l1_landing.Orders (OrderID, OrderDate, CustomerID, EmployeeID, StoreID, Status, Updated_at) VALUES
    (1, '2024-07-15', 'CustomerID', 1, 1, 'Shipped', '2024-08-01 10:00:00'),
    (2, '2024-07-16', 'C002', 2, 2, 'Pending', '2024-08-01 10:00:00'),
    (3, '2024-07-17', 'C003', 3, 3, 'Delivered', '2024-08-01 10:00:00'),
    (4, '2024-07-18', 'C004', 4, 4, 'Processing', '2024-08-01 10:00:00'),
    (5, '2024-07-19', 'C005', 5, 5, 'Cancelled', '2024-08-01 10:00:00');

    -- Sample data for OrderItems table
    INSERT INTO dbt_tutorial.l1_landing.OrderItems (OrderItemID, OrderID, ProductID, Quantity, UnitPrice, Updated_at) VALUES
    (1, 1, 1, 1, 999.99, '2024-08-01 10:00:00'),
    (2, 2, 2, 1, 699.99, '2024-08-01 10:00:00'),
    (3, 3, 3, 2, 499.99, '2024-08-01 10:00:00'),
    (4, 4, 4, 1, 199.99, '2024-08-01 10:00:00'),
    (5, 5, 5, 3, 49.99, '2024-08-01 10:00:00');

    ReplyDelete

Post a Comment

Popular posts from this blog

How to Install Airflow on Windows

Airflow DAGs, Operators, Tasks & Providers