forked from hotgluexyz/tap-canvas-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
streams.py
81 lines (72 loc) · 1.91 KB
/
streams.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
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
70
71
72
73
74
75
76
77
78
79
80
81
"""Stream type classes for tap-canvas-catalog."""
from __future__ import annotations
from pathlib import Path
from typing import Any
from singer_sdk import typing as th # JSON Schema typing helpers
from tap_canvas_catalog.client import CanvasCatalogStream
class UsersStream(CanvasCatalogStream):
name = "users"
path = "/integrations/hotglue/sources/users"
primary_keys = ["id"]
records_jsonpath = "$.users[*]"
replication_key = "updated_at"
def get_url_params(
self,
context: dict | None,
next_page_token: Any | None,
) -> dict[str, Any]:
params = super().get_url_params(context, next_page_token)
params["account_id"] = self.config.get("account_id")
# log params
self.logger.info(f"get_url_params: {params}")
return params
schema = th.PropertiesList(
th.Property(
"id",
th.IntegerType,
),
th.Property(
"root_account_id",
th.IntegerType,
),
th.Property(
"canvas_user_id",
th.IntegerType,
),
th.Property(
"canvas_root_account_uuid",
th.StringType,
),
th.Property(
"user_name",
th.StringType,
),
th.Property(
"first_name",
th.StringType,
),
th.Property(
"last_name",
th.StringType,
),
th.Property(
"email_address",
th.StringType,
),
th.Property(
"custom_fields",
th.CustomType({"type": ["object", "string"]}),
),
th.Property(
"created_at",
th.DateTimeType,
),
th.Property(
"updated_at",
th.DateTimeType,
),
th.Property(
"time_zone",
th.DateTimeType,
),
).to_dict()