Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dbt Core): Bypass metric evaluation if final SQL is provided #305

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

Vitor-Avila
Copy link
Contributor

The CLI currently uses MetricFlow to retrieve the syntax for a metric. This current process has two issues:

  • The mf command can take a few minutes for each metric (causing a full sync to take a long time)
  • The mf command might return a SQL query with un-necessary JOINs that is not compatible with dataset metrics in Superset.

To workaround this issue, this PR adds support for specifying the metric SQL syntax that should be used in Superset directly in metric.meta.superset.expression. In this case, since the metric won't be evaluated it's also required to specify the metric.meta.superset.model (so that the CLI knows which dataset to associate the metric):

metrics:
  - name: test_distinct
    description: test
    type: simple  # Will be ignored in this case
    label: Test
    type_params:
      measure: distinct_orders  # Will also be ignored
    meta:
      superset:
        expression: COUNT(DISTINCT order_id)
        model: model.vec_sales.vehicle_sales

@Vitor-Avila Vitor-Avila force-pushed the support-direct-metric-expression branch from 2a83b39 to 53e3c47 Compare June 24, 2024 13:59
@Vitor-Avila Vitor-Avila merged commit 2308536 into main Jun 28, 2024
5 checks passed
@Vitor-Avila Vitor-Avila deleted the support-direct-metric-expression branch June 28, 2024 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants