question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[SEMANTIC-107] [Bug] <Running Into Compilation Error on Metrics >

See original GitHub issue

Is this a new bug in dbt_metrics?

  • I believe this is a new bug in dbt_metrics
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

The compiler returns `

> " Compilation Error in model key_kpis (models\aggregation\key_kpis.sql) The name argument to ref() must be a string, got <class 'list'>"

when I tried running the metrics on one of my models. image

Expected Behavior

I should be able to see a table from the metrics I have added.

Steps To Reproduce

  1. In my own virtual environment dbt, I add this code snippet to my schema.yml
metrics:
  - name: gross_deposits
    label: Gross Deposits
    model: ref('deposits')
    description: "Sum of amount_usd for Deposits"

    calculation_method: sum
    expression: amount_usd 

    timestamp: transfer_ts
    time_grains: [day, week, month, quarter, year, all_time]

    dimensions:
      - registration_country
    
    window:
      count: 4
      period: week

    config:
      enabled: True
  1. I query it with
 {{ config(
     materialized='table',
   )}}
   
select * 
from {{ metrics.calculate(
    metric('gross_deposits'),
    grain='week',
    dimensions=['registration_country']
) }}

in a separate .sql file.

  1. I use a dbt run on my terminal to run the file.

Relevant log output

No response

Environment

- dbt=1.3.1
- dbt_metrics version: 1.3.2

Which database adapter are you using with dbt?

bigquery

Additional Context

No response

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
oleg-agapovcommented, Dec 5, 2022

Oh, I see. Now it’s clear 😃

I want to run the default calendar, so this is my code

dbt run --s dbt_metrics_default_calendar

Thank you!

1reaction
callum-mcdatacommented, Dec 5, 2022

Hi @oleg-agapov - are you trying to run the default calendar or your custom one?

Per the documentation in the README, you don’t want to include the var value as a ref statement. See below for an example where I’m telling the package to use the model my_custom_calendar instead of the default model.

dbt_metrics_calendar_model: my_custom_calendar

To run it I would then use dbt run --s my_custom_calendar. If I wanted to use the default calendar, I’d use dbt run --s dbt_metrics_default_calendar

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · dbt-labs/dbt_metrics - GitHub
Contribute to dbt-labs/dbt_metrics development by creating an account on GitHub. ... [SEMANTIC-107] [Bug] <Running Into Compilation Error on Metrics > bug ...
Read more >
Bug ID: JDK-8155701 The compiler fails with an AssertionError
AssertionError: typeSig ERROR at com.sun.tools.javac.code. ... Compiling /tmp/javac-bug/Bar.java An exception has occurred in the compiler (1.8.0_77).
Read more >
Workaround for javac compilation order bug in maven
I'm encountering a bug in the Java compiler where the order of files submitted for compilation can cause code not to compile. I've...
Read more >
Bugs in Programming
All these errors are called compile-time errors, because the Java compiler detects them while compiling our programs. We can link and run only...
Read more >
Updating Eclipse from 4.9 to 4.10: false compiler errors - Bugs
The .java file has a main(String[]) class. When I try to Run As, no dropdown occurs but the Error Log shows (maybe that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found