Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbt_salesforce_analytics_vault

A dbt package that builds a Data Vault 2.0 model of your Salesforce data. It takes the raw Salesforce tables delivered by the Fivetran Salesforce connector, turns them into a raw vault (hubs, links, satellites) using Scalefree's datavault4dbt macros, and then exposes analytics-ready delivery models on top.

Supported platforms:

Currently supported platforms are all databases that the Fivetran Salesforce Connector can write to and datavault4dbt supports.

Layers

The models are organized into three layers:

Folder Layer What it does
models/01_stage Staging Wraps the Fivetranstg_salesforce__* models and computes hash keys / hashdiffs.
models/02_raw_vault Raw Vault The Data Vault: hubs, links and satellites.
models/03_information_delivery Information Delivery Analytics-ready views on top of the data vault (e.g.salesforce__opportunity_enhanced, salesforce__owner_performance, salesforce__daily_activity, salesforce__sales_snapshot).

Entities modeled

Account, Contact, Event, Lead, Opportunity, Opportunity Line Item, Order, Product, Task, User and User Role.

The diagram below shows the resulting raw vault — hubs, links and satellites per entity. It was drawn with Visual Data Vault, Scalefree's browser-based editor for Data Vault diagrams. Click the image for the full-resolution version.

Salesforce Data Vault model, drawn in Visual Data Vault

Naming conventions

  • _h = hub, _l = link, _hl = hierarchical link.
  • Satellites come in two flavours:
    • v0 = raw, fully historized satellite; v1 = current-record view.
    • n = business (non-PII) attributes; p = personal (PII) attributes.

Requirements

  • dbt (tested with dbt-core 1.11 / dbt-bigquery 1.11).
  • Salesforce data landed by the Fivetran Salesforce connector.

Dependencies

Declared in packages.yml:

Package Role
dbt-labs/dbt_utils Utility macros / tests.
ScalefreeCOM/datavault4dbt Data Vault macros.
fivetran/salesforce Upstream Salesforce staging models.

Getting started

  1. Install dependencies:
    dbt deps
  2. Configure a profile named dbt_salesforce_analytics_vault in your profiles.yml.
  3. Point the fivetran/salesforce package at the dataset(s) where Fivetran lands your Salesforce tables (see that package's documentation for its variables).
  4. Build the models:
    dbt build

Opening this model in turbovault-engine

This package ships its Data Vault metadata as a turbovault-engine JSON export: docs/dbt_salesforce_analytics_vault_export.json. turbovault-engine is Scalefree's CLI-first generator that turns source metadata into a production-ready datavault4dbt project; it accepts its own JSON exports as input, so the model can be re-imported, inspected, extended and regenerated:

  1. Install the engine:
    pip install turbovault-engine
  2. Initialize a workspace (once per directory):
    turbovault workspace init
  3. Import this package's export as a project (run from the package root so the relative path resolves):
    turbovault project init --name salesforce_dv \
      --source docs/dbt_salesforce_analytics_vault_export.json
  4. Inspect and edit sources, stages, hubs, links and satellites in the web UI:
    turbovault serve
  5. Regenerate dbt models after changes:
    turbovault generate --project salesforce_dv --output ./generated

See the turbovault-engine README for all options, and Scalefree's TurboVault page for background.

About

Pre-modelled Data Vault for main Salesforce entities as distributed by Fivetran, implemented as dbt package. Created by Scalefree International GmbH.

Topics

Resources

Stars

20 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors