Build a dbt project that analyzes customer distribution and revenue by state with market performance metrics
harbor run -t snowflake-labs/dbt-customer-geographicharbor download snowflake-labs/dbt-customer-geographicBuild a dbt project that analyzes customer distribution and revenue by state.
/app/dbt_project (create project here)/app/dbt_project (create project here)geographic_analyticsThis task supports both DuckDB and Snowflake. Run echo $DB_TYPE in a shell BEFORE you write any code or spawn any subagents — the live env determines which backend the verifier runs against. Do NOT assume a default from this prose. Both /app/dbt_models_duckdb/ and /app/dbt_models_snowflake/ exist on disk; the verifier only checks the project matching the live $DB_TYPE.
DB_TYPE=duckdb$DUCKDB_PATH (default: /app/database/retail.duckdb)DB_TYPE=snowflakeSNOWFLAKE_ACCOUNTSNOWFLAKE_USERSNOWFLAKE_PASSWORDSNOWFLAKE_DATABASE - The clone database to useSNOWFLAKE_SCHEMASNOWFLAKE_WAREHOUSESNOWFLAKE_ROLE (optional)Note: For Snowflake, the entrypoint automatically creates a clone database and sets SNOWFLAKE_DATABASE. The clone is destroyed when the task completes.
You must configure dbt to connect to the database:
profiles.yml in the dbt project directory with profile name retail_dw_masterDBT_PROFILES_DIR environment variable to the directory containing profiles.ymlConfigure with type: duckdb and the database path from $DUCKDB_PATH. Use schema geographic_analytics.
Configure with type: snowflake using password authentication:
The database contains the following tables:
CUSTOMER.CUSTOMER_ADDRESSES - Customer address records. Explore the table to understand available columns including address_id, customer_id, state_province, and shipping flags.
ORDERS.ORDERS - Order records. Explore the table to understand available columns including order_id, customer_id, status, and monetary amounts.
Important: Use the CUSTOMER.CUSTOMER_ADDRESSES table for address data (not RAW_SFDC or other schemas).
Only include orders with completed transaction statuses (COMPLETED, DELIVERED, SHIPPED). Use only default shipping addresses (is_default_shipping = true).
Create a dbt project with staging and marts layers.
Create staging models:
Define sources in sources.yml.
Create fct_state_customers.sql that:
The final fct_state_customers table must have: