Skip to content

data-engineering-helpers/metric-cli

Repository files navigation

metric-cli

Python package

Purpose :

Deploy dbt metrics (YAML) into a Tableau Pulse's MetricDefinition

Use the dbt source code as the truth to deploy metric on top of dbt models. It has several benefits :

  • light and easy to maintain because it has no additional infrastructure,
  • can integrate to a lot of BI tools, decoupling metric definition from the serving
  • define Tableau Pulse' metrics as code, leveraged by the powerfull dbt lineage

Read the doc

flowchart TD
    yaml@{ shape: docs, label: "dbt metric.yml" }
    subgraph metric-cli
        deploy
        del
        diff
        list
    end 
    Tableau_Pulse
    subgraph Tableau_Pulse
        list_definition
        create_definition
        update_definition
        delete_definition
        definition1@{ shape: notch-rect, label: "Metric Definition" }
    end
    yaml--read-->deploy
    deploy-->match@{ shape: diamond, label: "match 
    metric & definition" }
    match--if not exists-->create_definition
    match--if exists-->update_definition
    match<--get current-->list_definition
    yaml--read-->diff
    del-->delete_definition
    list-->list_definition
    diff-->list_definition

    list_definition-->definition1
    delete_definition-->definition1
    update_definition-->definition1
    create_definition-->definition1
Loading

Features

  • Translate dbt metric into pulse Payload
  • CLI managing authent with environment variables
  • Generate Python client for Pulse API (tableau openapi url)
  • doc with Mkdocs on Githup pages
  • JSON schema validator dbt manifest
  • list all deployed MetricDefinition in Pulse
  • deploy metric instead of create or update : should looks more like terraform
  • diff local dbt metric vs Tableau's state
  • delete a Tableau MetricDefinition
  • import a Tableau Pulse' metric into a dbt metric (YAML)
  • search recursively for all metrics YAML to compile
  • parameterize to inject Tableau's resources (datasource, columns hash)
  • retrieve fields ID and datasource ID from Pulse API
  • check for breaking change or consitency in Pulse's API evolution
  • badge for metric deployed in Tableau Static Badge
  • other metric format : metricflow, LookML (Looker), CubeJS

Contributing

git clone
pip install -e .
pip install dev_requirements.txt
git checkout -b feat/my_feature_branch

do your stuff, then run tests

pytest

Push your work and create a Pull Request

About

Manage relationship between dbt metrics and Tableau Pulse's metric

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages