-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtech_subscriptions_data_contract.yml
More file actions
69 lines (66 loc) · 1.74 KB
/
tech_subscriptions_data_contract.yml
File metadata and controls
69 lines (66 loc) · 1.74 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
dataset: datasource/database/schema/tech_subscriptions
variables:
FRESHNESS_HOURS:
default: 24
checks:
- schema:
allow_extra_columns: false
allow_other_column_order: false
- row_count:
threshold:
must_be_greater_than: 0
- freshness:
column: start_date
threshold:
unit: hour
must_be_less_than_or_equal: ${var.FRESHNESS_HOURS}
- failed_rows:
name: "Subscription start_date must not be after end_date"
expression: end_date IS NOT NULL AND start_date > end_date
- failed_rows:
name: "Cancelled or expired subscriptions must have an end_date"
expression: (billing_status IN ('CANCELLED', 'EXPIRED') AND end_date IS NULL)
- failed_rows:
name: "Active subscriptions should not have an end_date in the past"
expression: (billing_status = 'ACTIVE' AND end_date IS NOT NULL AND end_date < ${soda.NOW})
columns:
- name: subscription_id
data_type: varchar
checks:
- missing:
- duplicate:
- name: customer_id
data_type: varchar
checks:
- missing:
- name: plan_id
data_type: varchar
checks:
- missing:
- name: start_date
data_type: date
checks:
- missing:
- name: end_date
data_type: date
- name: billing_status
data_type: varchar
checks:
- missing:
- invalid:
name: "Allowed billing statuses"
valid_values:
- TRIALING
- ACTIVE
- PAST_DUE
- CANCELLED
- EXPIRED
- name: currency
data_type: varchar
checks:
- missing:
- invalid:
name: "Currency must be ISO-4217-like (3 uppercase letters)"
valid_format:
name: ISO-4217 code
regex: "^[A-Z]{3}$"