Closed SkinnyPigeon closed 1 year ago
As an update, if we do the following, the cube compiles:
{% set model = dbt_model('delivery_base') %}
cubes:
- name: {{ model.name }}
description: {{ model.description }}
sql_table : {{ model.sql_table }}
However, if we then add in the dimensions, we get an error: dimensions must be defined as an array
:
{% set model = dbt_model('delivery_base') %}
cubes:
- name: {{ model.name }}
description: {{ model.description }}
sql_table : {{ model.sql_table }}
dimensions:
{{ model.as_dimensions() }}
The weird thing is that running this script succeeds in creating the correctly formatted file:
from cube_dbt import Dbt
dbt = Dbt.from_file("./manifest.json")
def dbt_model(name):
return dbt.model(name)
model = dbt_model("delivery_base")
output = f"""
cubes:
- { model.as_cube() }
dimensions:
{ model.as_dimensions() }
"""
with open("./model/cubes/delivery_base.yml", "w") as f:
f.write(output)
Hi @SkinnyPigeon 👋 Thanks for a very detailed report!
Could you please check if upgrading to cube_dbt==0.6.0
changes anything for you? We've made a few fixes related to Jinja escaping. (If you don't have a version in your requirements.txt
file, the package would update automatically, just re-run the build or go to a fresh dev mode session.)
dimensions must be defined as an array
I'm almost 100% sure that this error would be gone after updating.
The description and sql_table values of the string are indented by an extra 4 spaces than is needed.
I'm not sure about this one but let's see if anything changes after the update.
This is completely fixed. Thanks so much for the super quick turnaround on this! I have no idea how you guys manage to be so productive!
{% set model = dbt_model('delivery_base')%}
cubes:
- {{ model.as_cube() }}
dimensions:
{{ model.as_dimensions() }}
measures:
- name: count
type: count
When using the Jinja templating, we are experiencing an issue with the indentation. The
description
andsql_table
values of the string are indented by an extra 4 spaces than is needed.We have checked this by printing out the model and stripping out the additional spaces
model/globals.py
model/cubes/deliveries.yml