Skip to content

Commit f60b072

Browse files
authored
Add meta config to dimensions, entities, and measures (#182)
1 parent 59d6420 commit f60b072

File tree

2 files changed

+58
-16
lines changed

2 files changed

+58
-16
lines changed

schemas/latest/dbt_yml_files-latest.json

+34-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@
448448
}
449449
},
450450
"additionalProperties": false
451-
},
451+
},
452452
"versions": {
453453
"type": "array",
454454
"items": {
@@ -1562,6 +1562,17 @@
15621562
},
15631563
"type_params": {
15641564
"$ref": "#/$defs/dimension_type_params"
1565+
},
1566+
"config": {
1567+
"type": "object",
1568+
"properties": {
1569+
"meta": {
1570+
"type": "object",
1571+
"propertyNames": {
1572+
"type": "string"
1573+
}
1574+
}
1575+
}
15651576
}
15661577
},
15671578
"additionalProperties": false
@@ -1652,6 +1663,17 @@
16521663
"string",
16531664
"boolean"
16541665
]
1666+
},
1667+
"config": {
1668+
"type": "object",
1669+
"properties": {
1670+
"meta": {
1671+
"type": "object",
1672+
"propertyNames": {
1673+
"type": "string"
1674+
}
1675+
}
1676+
}
16551677
}
16561678
},
16571679
"additionalProperties": false
@@ -1842,6 +1864,17 @@
18421864
},
18431865
"non_additive_dimension": {
18441866
"$ref": "#/$defs/non_additive_dimension"
1867+
},
1868+
"config": {
1869+
"type": "object",
1870+
"properties": {
1871+
"meta": {
1872+
"type": "object",
1873+
"propertyNames": {
1874+
"type": "string"
1875+
}
1876+
}
1877+
}
18451878
}
18461879
},
18471880
"additionalProperties": false

tests/latest/valid/dbt_yml_files.yml

+24-15
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ models:
3030
group: analytics
3131
latest_version: 2
3232
config:
33-
contract:
33+
contract:
3434
enforced: true
3535
event_time: "created_at"
3636
columns:
3737
- name: id
3838
description: "The primary key for this table"
3939
data_type: int
40-
constraints:
40+
constraints:
4141
- type: not_null
4242
- type: unique
4343
- type: check
@@ -69,7 +69,7 @@ models:
6969
- type: unique
7070
columns: [ color, date_day ]
7171
name: strange_uniqueness_requirement
72-
72+
7373
- name: my_materialized_view
7474
config:
7575
materialized: materialized_view
@@ -89,7 +89,7 @@ unit_tests:
8989
- {id: 1, code: 'abc'}
9090
- {id: 2, code: 'def'}
9191
model: my_first_dbt_model
92-
92+
9393
- name: my_second_unit_test
9494
expect:
9595
rows:
@@ -100,13 +100,13 @@ unit_tests:
100100
tags: ['tag_1', 'tag_2']
101101
description: This checks the validity of the model
102102
overrides:
103-
macros:
103+
macros:
104104
is_incremental: true
105105
env_vars:
106106
my_first_var: 12345
107107
vars:
108108
my_second_var: 689
109-
109+
110110
- name: my_inline_csv_unit_test
111111
given:
112112
- input: ref('model_b')
@@ -147,7 +147,7 @@ snapshots:
147147
group: analytics
148148
description: slowly changing dimension
149149
columns:
150-
- name: id
150+
- name: id
151151
description: cool column, eh?
152152

153153
- name: yaml_defined_snapshot
@@ -159,7 +159,7 @@ snapshots:
159159
strategy: timestamp
160160
updated_at: updated_at
161161

162-
# model groups
162+
# model groups
163163

164164
groups:
165165
- name: analytics
@@ -177,9 +177,15 @@ semantic_models:
177177
- name: customer
178178
expr: customer_id
179179
type: primary
180+
config:
181+
meta:
182+
contains_pii: false
180183
dimensions:
181184
- name: customer_name
182185
type: categorical
186+
config:
187+
meta:
188+
contains_pii: true
183189
- name: customer_type
184190
type: categorical
185191
- name: first_ordered_at
@@ -194,6 +200,9 @@ semantic_models:
194200
- name: count_lifetime_orders
195201
description: Total count of orders per customer.
196202
agg: sum
203+
config:
204+
meta:
205+
contains_pii: false
197206
- name: lifetime_spend_pretax
198207
description: Customer lifetime spend before taxes.
199208
agg: sum
@@ -218,7 +227,7 @@ metrics:
218227
label: New Customers
219228
type: simple
220229
type_params:
221-
measure:
230+
measure:
222231
name: customers_with_orders
223232
filter: |
224233
{{ Dimension('customer__customer_type') }} = 'new'
@@ -263,11 +272,11 @@ metrics:
263272
{{ Dimension('order__is_food_order') }} = True
264273
265274
- name: cumulative_order_total_l1m
266-
label: Cumulative Order total (L1M)
275+
label: Cumulative Order total (L1M)
267276
description: Trailing 1-month cumulative order amount
268277
type: cumulative
269278
type_params:
270-
measure:
279+
measure:
271280
name: order_total
272281
fill_nulls_with: 0
273282
window: 1 month
@@ -281,11 +290,11 @@ metrics:
281290
calculation: conversions
282291
base_measure:
283292
name: visits
284-
conversion_measure:
293+
conversion_measure:
285294
name: buys
286295
fill_nulls_with: 0
287296
entity: user
288-
window: 7 days
297+
window: 7 days
289298

290299
saved_queries:
291300
- name: test_saved_query
@@ -310,7 +319,7 @@ saved_queries:
310319
sources:
311320
- name: some_source_name
312321
loaded_at_field: _etl_loaded_at
313-
freshness:
322+
freshness:
314323
error_after:
315324
count: 2
316325
period: day
@@ -330,4 +339,4 @@ sources:
330339

331340
data_tests:
332341
- name: my_cool_custom_test
333-
description: "This checks that all numbers are positive, if it fails you should talk to data engineering"
342+
description: "This checks that all numbers are positive, if it fails you should talk to data engineering"

0 commit comments

Comments
 (0)