-
Notifications
You must be signed in to change notification settings - Fork 4
/
models.py
102 lines (74 loc) · 2.14 KB
/
models.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import datetime
from typing import Any, Generic, List, Optional, TypeVar
from pydantic import Field
from metaphor.common.models import V1CompatBaseModel
DataT = TypeVar("DataT")
class GenericData(V1CompatBaseModel, Generic[DataT]):
next_cursor: Optional[str] = None
items: List[DataT]
class GenericListResponse(V1CompatBaseModel, Generic[DataT]):
code: str
data: Optional[GenericData[DataT]] = None
class GenericResponse(V1CompatBaseModel, Generic[DataT]):
code: str
data: Optional[DataT] = None
class MetadataSchemaPayload(V1CompatBaseModel):
id: str
name_in_source: Optional[str] = None
name_in_destination: str
class MetadataTablePayload(V1CompatBaseModel):
id: str
parent_id: str
name_in_source: str
name_in_destination: str
class MetadataColumnPayload(V1CompatBaseModel):
id: str
parent_id: str
name_in_source: str
name_in_destination: str
type_in_source: Optional[str] = None
type_in_destination: Optional[str] = None
is_primary_key: bool
is_foreign_key: bool
class GroupPayload(V1CompatBaseModel):
id: str
name: str
created_at: datetime.datetime
class DestinationPayload(V1CompatBaseModel):
id: str
group_id: str
service: str
region: str
time_zone_offset: str
setup_status: str
config: Any = None
class ConnectorStatus(V1CompatBaseModel):
setup_state: str
update_state: str
sync_state: str
is_historical_sync: bool
class ConnectorPayload(V1CompatBaseModel):
id: str
group_id: str
service: str
paused: bool
schema_: str = Field(alias="schema")
succeeded_at: Optional[datetime.datetime] = None
sync_frequency: int
connected_by: Optional[str] = None
service_version: int
created_at: datetime.datetime
failed_at: Optional[datetime.datetime] = None
status: ConnectorStatus
config: Any = None
def __hash__(self):
return hash(self.id)
class SourceMetadataPayload(V1CompatBaseModel):
id: str
name: str
type: str
description: Optional[str] = None
icon_url: Optional[str] = None
class UserPayload(V1CompatBaseModel):
id: str
email: str