cube-js / cube_dbt

dbt integration for Cube
7 stars 2 forks source link

Unable to use keyword argument in Jinja for as_dimensions() #8

Open bzenker-amplify opened 3 months ago

bzenker-amplify commented 3 months ago

I am unable to use a python keyword argument (aka named parameter) within a cube_dbt Jinja template.

This argument is noted here, and in the cube documentation, as being able to be defined with a keyword argument: https://github.com/cube-js/cube_dbt/blob/main/src/cube_dbt/model.py#L90

I'll use the following example to explain

{% set model = dbt_model('my_table') %}
cubes:
  - {{ model.as_cube() }}
    dimensions:
      {{ model.as_dimensions(skip=['my_bad_time_column']) }}

Expected Behavior

The runtime compilation would skip ingestion of my_table.my_bad_time_column

Current Behavior

Cube fails to runtime compile its semantic layer, because it attempts to include that column.

RuntimeError: Unknown column type of my_table.my_bad_time_column: timestamp_ntz

Current Workaround

Pass the parameter as a positional argument. This works for me:

{% set model = dbt_model('my_table') %}
cubes:
  - {{ model.as_cube() }}
    dimensions:
      {{ model.as_dimensions(['my_bad_time_column']) }}

Context (Environment)

Running the Docker Image cubejs/cube:v0.35.47 with notable environment variables of

CUBEJS_DEV_MODE=true
CUBEJS_DB_TYPE="snowflake"