-
Notifications
You must be signed in to change notification settings - Fork 30
/
get_plan_columns.sql
35 lines (29 loc) · 1.59 KB
/
get_plan_columns.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{% macro get_plan_columns() %}
{% set columns = [
{"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()},
{"name": "active", "datatype": "boolean"},
{"name": "aggregate_usage", "datatype": dbt_utils.type_string()},
{"name": "amount", "datatype": dbt_utils.type_int()},
{"name": "billing_scheme", "datatype": dbt_utils.type_string()},
{"name": "created", "datatype": dbt_utils.type_timestamp()},
{"name": "currency", "datatype": dbt_utils.type_string()},
{"name": "id", "datatype": dbt_utils.type_string()},
{"name": "interval_count", "datatype": dbt_utils.type_int()},
{"name": "is_deleted", "datatype": "boolean"},
{"name": "livemode", "datatype": "boolean"},
{"name": "metadata", "datatype": dbt_utils.type_string()},
{"name": "nickname", "datatype": dbt_utils.type_string()},
{"name": "product_id", "datatype": dbt_utils.type_string()},
{"name": "tiers_mode", "datatype": dbt_utils.type_string()},
{"name": "transform_usage_divide_by", "datatype": dbt_utils.type_int()},
{"name": "transform_usage_round", "datatype": dbt_utils.type_string()},
{"name": "trial_period_days", "datatype": dbt_utils.type_int()},
{"name": "usage_type", "datatype": dbt_utils.type_string()}
] %}
{% if target.type in ('bigquery', 'spark', 'databricks') %}
{{ columns.append( {"name": 'interval', "datatype": dbt_utils.type_string(), "quote": True, "alias": "plan_interval" } ) }}
{% else %}
{{ columns.append( {"name": "interval", "datatype": dbt_utils.type_string(), "alias": "plan_interval"} ) }}
{% endif %}
{{ return(columns) }}
{% endmacro %}