metriql / metriql

The metrics layer for your data. Join us at https://metriql.com/slack
https://metriql.com
Apache License 2.0
298 stars 25 forks source link

Metriql cannot find parent models of dbt metrics #82

Open mjirv opened 2 years ago

mjirv commented 2 years ago

I have a (valid) dbt metric defined as follows:

  - name: orders
    label: Orders
    model: ref('orders')
    description: The number of orders

    type: count

    timestamp: order_date
    time_grains: [day, week, month, quarter, year]

    dimensions:
      - status
      - customer_id

When running metriql serve I get the following error:

May 26, 2022 1:36:06 AM com.metriql.dbt.DbtManifestParser parse
INFO: Parsing 30 nodes, 0 sources and 4 metrics
Exception in thread "main" Unable to find `orders` metric's parent model `ref('orders')`

I have a model named orders, ran dbt compile just before running metriql serve, and confirmed the orders model is in my manifest.json.

Changing quotation styles and including the package name did not help.

Version/environment

This is using Docker with docker pull buremba/metriql:latest

buremba commented 2 years ago

Hmm, I believe that it's because your dbt model doesn't have meta.metriql property and since Metriql ignores these dbt resources, it's not able to resolve the reference. I just added a warning here: https://metriql.com/reference/dataset/

That being said, it seems to be an edge case that we need to think about. What do you think about the best approach? Maybe we can allow other entities to resolve references but don't map them as datasets?

mjirv commented 2 years ago

Oh I see, I didn't realize I needed to add that. Thank you!

To me, it would make sense to parse the dependencies but not expose them, like you say.

FYI that it looks like your warning isn't being rendered correctly. image