Issues with saved_queries and exports in semantic model configuration

The problem I’m having

I am trying to create saved_query items with exports using the latest doc

I keep my semantic models and metrics in the same yml named the same as the model its based on. I tried adding a new row and “saved_queries:” and then proceeded to use my simplest metric query (which ive successfully hit from the graphql endpoint many times)

I was seeing strange behavior on build (i do have the dbt_INCLUDE_SAVED_QUERY = TRUE) where the models would build almost instantly and the export name would show up as a one of the items in the build queue and would just spin forever until i cancelled it. it didnt matter whether it was a table or view, whether i put it in a separate “saved_queries.yml” or changed the header from “saved_queries” to “saved_query”. I see conflicting usage in the dbt semantic layer and metric flow githubs.

The context of why I’m trying to do this

I switched from a dbt core provider that had easy integration to metabase and tableau and this saved queries will allow us to expose queries natively in the databricks warehouse so bi tools downstream can still be somewhat aware of metrics

What I’ve already tried

using saved_query singular or saved_queries plural, running from a dedicated yml file, adding it to my semantic and metrics config yml files, just doing the saved query with no export. looking through the following github items

saved_query:

  • name: app_downloads_os_month
    description: App downloads sliced by os
    query_params:
    metrics:
    - app_downloads
    group_by:
    - TimeDimension(‘metric_time’,‘month’)
    exports:
    • name: brm_app_downloads
      config:
      export_as: table

OR

saved_queries:

  • name: app_downloads_os_month
    description: App downloads sliced by os
    query_params:
    metrics:
    - app_downloads
    group_by:
    - TimeDimension(‘metric_time’,‘month’)
    exports:
    • name: brm_app_downloads
      config:
      export_as: table

Would be really nice if it would error out instead of spinning. it doesnt even kick off a query in my warehouse but it looks like its trying to from the build logs in dbt cloud. Even when i kill cancel the build, the spinner next to that export spins forever even though nothing is running on the warehouse.

1 Like