-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
34 lines (23 loc) · 1.03 KB
/
main.py
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
from tracker_exporter.models.issue import TrackerIssue
from tracker_exporter.utils.helpers import to_snake_case, validate_resource
from tracker_exporter import configure_sentry, run_etl
from yandex_tracker_client.collections import Issues
class CustomIssueFieldsMixin:
"""
Additional custom fields for Yandex Tracker issue.
Must be created in the Clickhouse issue table.
"""
def __init__(self, issue: Issues) -> None:
self.foo_custom_field = to_snake_case(validate_resource(issue, "fooCustomField"))
self.bar_custom_field = validate_resource(issue, "barCustomField")
self.baz = True if "baz" in issue.tags else False
class ExtendedTrackerIssue(CustomIssueFieldsMixin, TrackerIssue):
"""Extended Yandex Tracker issue model with custom fields."""
def __init__(self, issue: Issues) -> None:
super().__init__(issue)
def main() -> None:
"""Entry point."""
run_etl(ignore_exceptions=False, issue_model=ExtendedTrackerIssue)
if __name__ == "__main__":
configure_sentry()
main()