Skip to content

Commit

Permalink
add env variable example
Browse files Browse the repository at this point in the history
  • Loading branch information
paco-valdez committed Sep 27, 2023
1 parent 30d6159 commit ae4c73b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions model/cubes/defaults.py
Original file line number Diff line number Diff line change
@@ -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'

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% set scheduled_refresh = get_scheduled_refresh() %}

cubes:
- name: line_items
sql_table: ECOM.LINE_ITEMS
Expand Down Expand Up @@ -32,7 +34,7 @@ cubes:

pre_aggregations:
- name: line_items_summary
scheduled_refresh: false
scheduled_refresh: {{ scheduled_refresh }}
measures:
- count
- total_amount
Expand Down

0 comments on commit ae4c73b

Please sign in to comment.