Skip to content

prefect_hightouch.api_client.models.sync

Sync

Bases: BaseModel

Syncs define how data from models are mapped to destinations. Each time a sync runs, Hightouch calculates the rows that have changed since the last run, and syncs them to Sync's destination.

Attributes:
    configuration (SyncConfiguration): The sync's configuration. This specifies how data is mapped, among other
        configuration.

        The schema depends on the destination.

        Consumers should NOT make assumptions on the contents of the
        configuration. It may change as Hightouch updates its internal code.
    created_at (datetime.datetime): The timestamp when the sync was created
    destination_id (str): The id of the Destination that sync is connected to
    disabled (bool): Whether the sync has been disabled by the user.
    id (str): The sync's id
    last_run_at (datetime.datetime): The timestamp of the last sync run
    model_id (str): The id of the Model that sync is connected to
    primary_key (str): The primary key that sync uses to identify data from source
    referenced_columns (List[str]): The reference column that sync depends on to sync data from source
    schedule (SyncSchedule): The scheduling configuration. It can be triggerd based on several ways:

        Interval: the sync will be trigged based on certain interval(minutes/hours/days/weeks)

        Cron: the sync will be trigged based on cron expression https://en.wikipedia.org/wiki/Cron.

        Visual: the sync will be trigged based a visual cron configuration on UI

        DBT-cloud: the sync will be trigged based on a dbt cloud job
    slug (str): The sync's slug
    status (SyncStatus):
    updated_at (datetime.datetime): The timestamp when the sync was last updated
    workspace_id (str): The id of the workspace that the sync belongs to
Source code in prefect_hightouch/api_client/models/sync.py
 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
class Sync(BaseModel):
    """Syncs define how data from models are mapped to destinations. Each time a
    sync runs, Hightouch calculates the rows that have changed since the last
    run, and syncs them to Sync's destination.

        Attributes:
            configuration (SyncConfiguration): The sync's configuration. This specifies how data is mapped, among other
                configuration.

                The schema depends on the destination.

                Consumers should NOT make assumptions on the contents of the
                configuration. It may change as Hightouch updates its internal code.
            created_at (datetime.datetime): The timestamp when the sync was created
            destination_id (str): The id of the Destination that sync is connected to
            disabled (bool): Whether the sync has been disabled by the user.
            id (str): The sync's id
            last_run_at (datetime.datetime): The timestamp of the last sync run
            model_id (str): The id of the Model that sync is connected to
            primary_key (str): The primary key that sync uses to identify data from source
            referenced_columns (List[str]): The reference column that sync depends on to sync data from source
            schedule (SyncSchedule): The scheduling configuration. It can be triggerd based on several ways:

                Interval: the sync will be trigged based on certain interval(minutes/hours/days/weeks)

                Cron: the sync will be trigged based on cron expression https://en.wikipedia.org/wiki/Cron.

                Visual: the sync will be trigged based a visual cron configuration on UI

                DBT-cloud: the sync will be trigged based on a dbt cloud job
            slug (str): The sync's slug
            status (SyncStatus):
            updated_at (datetime.datetime): The timestamp when the sync was last updated
            workspace_id (str): The id of the workspace that the sync belongs to
    """

    configuration: SyncConfiguration = None
    created_at: datetime.datetime = None
    destination_id: str = None
    disabled: bool = None
    id: str = None
    last_run_at: datetime.datetime = None
    model_id: str = None
    primary_key: str = None
    referenced_columns: List[str] = None
    schedule: SyncSchedule = None
    slug: str = None
    status: SyncStatus = None
    updated_at: datetime.datetime = None
    workspace_id: str = None
    additional_properties: Dict[str, Any] = Field(default_factory=dict)

    def to_dict(self) -> Dict[str, Any]:
        configuration = self.configuration.to_dict()

        created_at = self.created_at.isoformat()

        destination_id = self.destination_id
        disabled = self.disabled
        id = self.id
        last_run_at = self.last_run_at.isoformat()

        model_id = self.model_id
        primary_key = self.primary_key
        referenced_columns = self.referenced_columns

        schedule = self.schedule.to_dict()

        slug = self.slug
        status = self.status.value

        updated_at = self.updated_at.isoformat()

        workspace_id = self.workspace_id

        field_dict: Dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "configuration": configuration,
                "createdAt": created_at,
                "destinationId": destination_id,
                "disabled": disabled,
                "id": id,
                "lastRunAt": last_run_at,
                "modelId": model_id,
                "primaryKey": primary_key,
                "referencedColumns": referenced_columns,
                "schedule": schedule,
                "slug": slug,
                "status": status,
                "updatedAt": updated_at,
                "workspaceId": workspace_id,
            }
        )

        return field_dict

    @classmethod
    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
        if src_dict is None or src_dict is UNSET:
            return {}
        d = {k: v if v is not None else UNSET for k, v in src_dict.items()}
        configuration = SyncConfiguration.from_dict(d.pop("configuration"))

        created_at = isoparse(d.pop("createdAt"))

        destination_id = d.pop("destinationId")

        disabled = d.pop("disabled")

        id = d.pop("id")

        last_run_at = isoparse(d.pop("lastRunAt"))

        model_id = d.pop("modelId")

        primary_key = d.pop("primaryKey")

        referenced_columns = cast(List[str], d.pop("referencedColumns"))

        schedule = SyncSchedule.from_dict(d.pop("schedule"))

        slug = d.pop("slug")

        status = SyncStatus(d.pop("status"))

        updated_at = isoparse(d.pop("updatedAt"))

        workspace_id = d.pop("workspaceId")

        sync = cls(
            configuration=configuration,
            created_at=created_at,
            destination_id=destination_id,
            disabled=disabled,
            id=id,
            last_run_at=last_run_at,
            model_id=model_id,
            primary_key=primary_key,
            referenced_columns=referenced_columns,
            schedule=schedule,
            slug=slug,
            status=status,
            updated_at=updated_at,
            workspace_id=workspace_id,
        )

        sync.additional_properties = d
        return sync

    @property
    def additional_keys(self) -> List[str]:
        return list(self.additional_properties.keys())

    def __getitem__(self, key: str) -> Any:
        return self.additional_properties.get(key)

    def __setitem__(self, key: str, value: Any) -> None:
        self.additional_properties[key] = value

    def __delitem__(self, key: str) -> None:
        del self.additional_properties[key]

    def __contains__(self, key: str) -> bool:
        return key in self.additional_properties

additional_keys: List[str] property

additional_properties: Dict[str, Any] = Field(default_factory=dict) class-attribute instance-attribute

configuration: SyncConfiguration = None class-attribute instance-attribute

created_at: datetime.datetime = None class-attribute instance-attribute

destination_id: str = None class-attribute instance-attribute

disabled: bool = None class-attribute instance-attribute

id: str = None class-attribute instance-attribute

last_run_at: datetime.datetime = None class-attribute instance-attribute

model_id: str = None class-attribute instance-attribute

primary_key: str = None class-attribute instance-attribute

referenced_columns: List[str] = None class-attribute instance-attribute

schedule: SyncSchedule = None class-attribute instance-attribute

slug: str = None class-attribute instance-attribute

status: SyncStatus = None class-attribute instance-attribute

updated_at: datetime.datetime = None class-attribute instance-attribute

workspace_id: str = None class-attribute instance-attribute

from_dict classmethod

Source code in prefect_hightouch/api_client/models/sync.py
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
    if src_dict is None or src_dict is UNSET:
        return {}
    d = {k: v if v is not None else UNSET for k, v in src_dict.items()}
    configuration = SyncConfiguration.from_dict(d.pop("configuration"))

    created_at = isoparse(d.pop("createdAt"))

    destination_id = d.pop("destinationId")

    disabled = d.pop("disabled")

    id = d.pop("id")

    last_run_at = isoparse(d.pop("lastRunAt"))

    model_id = d.pop("modelId")

    primary_key = d.pop("primaryKey")

    referenced_columns = cast(List[str], d.pop("referencedColumns"))

    schedule = SyncSchedule.from_dict(d.pop("schedule"))

    slug = d.pop("slug")

    status = SyncStatus(d.pop("status"))

    updated_at = isoparse(d.pop("updatedAt"))

    workspace_id = d.pop("workspaceId")

    sync = cls(
        configuration=configuration,
        created_at=created_at,
        destination_id=destination_id,
        disabled=disabled,
        id=id,
        last_run_at=last_run_at,
        model_id=model_id,
        primary_key=primary_key,
        referenced_columns=referenced_columns,
        schedule=schedule,
        slug=slug,
        status=status,
        updated_at=updated_at,
        workspace_id=workspace_id,
    )

    sync.additional_properties = d
    return sync

to_dict

Source code in prefect_hightouch/api_client/models/sync.py
 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
def to_dict(self) -> Dict[str, Any]:
    configuration = self.configuration.to_dict()

    created_at = self.created_at.isoformat()

    destination_id = self.destination_id
    disabled = self.disabled
    id = self.id
    last_run_at = self.last_run_at.isoformat()

    model_id = self.model_id
    primary_key = self.primary_key
    referenced_columns = self.referenced_columns

    schedule = self.schedule.to_dict()

    slug = self.slug
    status = self.status.value

    updated_at = self.updated_at.isoformat()

    workspace_id = self.workspace_id

    field_dict: Dict[str, Any] = {}
    field_dict.update(self.additional_properties)
    field_dict.update(
        {
            "configuration": configuration,
            "createdAt": created_at,
            "destinationId": destination_id,
            "disabled": disabled,
            "id": id,
            "lastRunAt": last_run_at,
            "modelId": model_id,
            "primaryKey": primary_key,
            "referencedColumns": referenced_columns,
            "schedule": schedule,
            "slug": slug,
            "status": status,
            "updatedAt": updated_at,
            "workspaceId": workspace_id,
        }
    )

    return field_dict