diff --git a/model/cubes/defaults.py b/model/cubes/defaults.py new file mode 100644 index 0000000..e411c18 --- /dev/null +++ b/model/cubes/defaults.py @@ -0,0 +1,10 @@ +import os +from cube import context_func + +@context_func +def get_scheduled_refresh(): + name = 'CUSTOM_ENV_PREAGGS_ENABLE' + if name in os.environ: + return str(str(os.environ[name]).lower() == 'true').lower() + return 'false' + diff --git a/model/cubes/line_items.yml b/model/cubes/line_items.yml.jinja similarity index 88% rename from model/cubes/line_items.yml rename to model/cubes/line_items.yml.jinja index 8f66548..ab4eb2d 100644 --- a/model/cubes/line_items.yml +++ b/model/cubes/line_items.yml.jinja @@ -1,3 +1,5 @@ +{% set scheduled_refresh = get_scheduled_refresh() %} + cubes: - name: line_items sql_table: ECOM.LINE_ITEMS @@ -32,7 +34,7 @@ cubes: pre_aggregations: - name: line_items_summary - scheduled_refresh: false + scheduled_refresh: {{ scheduled_refresh }} measures: - count - total_amount