cube-js / cube-js/cube_dbt

Unable to use keyword argument in Jinja for as_dimensions()

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
17
Forks
6
PR merge metrics
No merged PRs in 30d

Description

I am unable to use a python [keyword argument](https://docs.python.org/3/glossary.html#term-argument) (aka named parameter) within a cube_dbt Jinja template.

This argument is noted here, and in the [cube documentation](https://cube.dev/docs/reference/python/cube_dbt#modelas_dimensions), 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"
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.