Skip to content

tjhoranumass/dbt-visualization-project

Repository files navigation

DBT Visualization Project

This DBT project is designed to model and transform e-commerce sales data into useful business insights. The project includes raw data ingestion, staging models, and marts for reporting purposes. The transformed data is then used for visualization and analysis.

Project Structure

The project is organized into several key directories:

dbt_project.yml # Main DBT project configuration file models/ staging/ stg_sales.sql # Staging model for sales data stg_customers.sql # Staging model for customer data stg_products.sql # Staging model for product data marts/ sales_reporting/ orders_by_day.sql # Mart for orders aggregated by day customer_lifetime_value.sql # Mart for customer lifetime value product_performance.sql # Mart for product performance analysis monthly_revenue_orders.sql # Mart for monthly revenue and orders snapshots/ sales_snapshots.sql # Snapshot model for tracking changes in sales data macros/ audit_macros.sql # Custom macros for data quality checks seeds/ customer_dim.csv # Static seed data for customer dimension product_dim.csv # Static seed data for product dimension

vbnet Always show details

Copy code

How to Run the Pipeline

To run the DBT pipeline, follow these steps:

  1. Set Up the Profile:

    • Ensure that your DBT profile is correctly configured in the profiles.yml file. It should contain the correct credentials to connect to your PostgreSQL database.
  2. Run the Pipeline: Use the following command to execute the pipeline and build all models:

    dbt run

    This command will run all transformations from the staging models to the marts.

  3. Test the Pipeline: You can run tests to ensure the pipeline's integrity:

    dbt test

    This will run any schema.yml tests defined for your models, such as checking for uniqueness or null values.

  4. Snapshot Process: If your project includes snapshots for tracking changes over time (like for sales data), run the following command:

    dbt snapshot

    Snapshots help you maintain historical records of your data by capturing the state of specific tables at each point in time.

Visualization with Python

dbt_project/
│
├── models/
│   └── marts/
│       └── sales_reporting/
│           └── customer_lifetime_value.sql
│           └── orders_by_day.sql
│           └── product_performance.sql
│
├── flask_app/
│   └── app.py            # Main Flask server file
│   └── templates/        # HTML templates
│       └── index.html    # Home page with visualizations
│
├── requirements.txt      # Add Flask and DBT dependencies here
└── README.md

Additional Notes

  • Ensure you restart your DBT environment and refresh connections if you make significant changes to the database or models.
  • You can customize the marts and staging models further to fit specific business requirements.

For more information, refer to the DBT documentation. """

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors