Loyalty data#

In this example we will use Python and some simple ML to predict whether a customer will register for a loyalty program. In order to do so, we will use the customers table we created in the previous exercise. Let’s first add information which customer is registered already.

Exercise#

  1. Add data: To proceed with this exercise we first need to know which customers have registered for the loyalty program. For the sake of simplicity, we got this list in form of csv file. You can find it inside seeds folder.

    1. Run seed command to load the csv data into database dbt seed --select loyalty_customers

  2. Add staging model: Create staging dbt model (since it’s very simple, base is not needed) and configs:

    1. Create subfolder loyalty for this new data source in dbt-demo/models/staging/

    2. Add data source defintion into _src_loyalty.yml

    3. Add staging dbt model stg_loyalty_customers.sql

    4. Add model definition _stg_loyalty.yml

  3. Update table customers: Update marts/core/customers.sql file to use this new source and show which customers are registered.

Solution#

2.2

2.3

2.4

3 Update dim customer