This project dives into the advanced usage of dbt (data build tool) and Snowflake, a cloud data platform, to perform Recency, Frequency, Monetary (RFM) analysis on e-commerce data. By leveraging Snowpark, Snowflake's powerful library for data operations, we aim to enhance the capabilities of our data transformation processes.
- RFM Analysis with DBT: A comprehensive model in dbt to transform data for RFM analysis.
- Snowflake and Snowpark Integration: A deep dive into Snowflake's Snowpark library, integrating its functionality into our dbt models.
- Data Management with SnowSQL: Step-by-step data ingestion procedure in Snowflake using SnowSQL commands
-
DBT: A command-line tool that enables data analysts and engineers to transform data in the warehouse more effectively.
- Installation: Follow the official guide for installation instructions.
-
Snowflake Account: Ensure you have an active account and the necessary permissions on Snowflake.
- Sign up: Visit Snowflake's official website.
-
SnowSQL: Snowflake's command-line client.
- Installation: Visit SnowSQL's official documentation for installation steps.
-
Repository Setup:
git clone [URL_OF_YOUR_GITHUB_REPOSITORY] dbt_snowflake_project cd dbt_snowflake_project -
Snowflake Connection:
- Set up your Snowflake connection credentials for dbt in
~/.dbt/profiles.yml. - Ensure the necessary permissions for data access.
- Set up your Snowflake connection credentials for dbt in
-
Data Loading using SnowSQL:
- Navigate to the directory containing the Snowflake script:
snowsql -f snowflake_scripts/data_upload.sql
- This script handles various Snowflake operations, such as setting up the working environment, staging CSV data, loading it to tables, and performing clean-up operations.
- Navigate to the directory containing the Snowflake script:
-
DBT Model Execution:
dbt run --models rfm_analysis
-
RFM Analysis:
- Our dbt model extracts insights from the
invoicesanditemstables. - The aim is to evaluate customers' value using the RFM methodology, which considers how recently a customer has purchased (Recency), how often they purchase (Frequency), and how much the customer spends (Monetary).
- Our dbt model extracts insights from the
-
Snowflake Script Operations:
- Login and environment setup within Snowflake.
- Data staging and ingestion from
upload.csv. - Verification of data population within Snowflake tables.
- Snowpark Guide: Explore the capabilities of Snowflake's Snowpark and its usage in our models.