prefect_hightouch.syncs
flows
This is a module containing flows used for interacting with syncs.
trigger_sync_run_and_wait_for_completion
async
Flow that triggers a sync run and waits for the triggered run to complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
sync_id |
str
|
Sync ID used in formatting the endpoint URL. |
required |
full_resync |
bool
|
Whether to resync all the rows in the query (i.e. ignoring previously synced rows). |
False
|
max_wait_seconds |
int
|
Maximum number of seconds to wait for the entire flow to complete. |
900
|
poll_frequency_seconds |
int
|
Number of seconds to wait in between checks for run completion. |
10
|
Returns:
Type | Description |
---|---|
Sync
|
|
Examples:
Trigger a Hightouch sync run and wait for completion as a stand alone flow.
import asyncio
from prefect_hightouch import HightouchCredentials
from prefect_hightouch.syncs import trigger_sync_run_and_wait_for_completion
asyncio.run(
trigger_sync_run_and_wait_for_completion(
hightouch_credentials=HightouchCredentials(
token="1abc0d23-1234-1a2b-abc3-12ab456c7d8e"
),
sync_id=12345,
full_resync=True,
max_wait_seconds=1800,
poll_frequency_seconds=5,
)
)
Trigger a Hightouch sync run and wait for completion as a subflow.
from prefect import flow
from prefect_hightouch import HightouchCredentials
from prefect_hightouch.syncs import trigger_sync_run_and_wait_for_completion
@flow
def sync_flow():
hightouch_credentials = HightouchCredentials.load("hightouch-token")
sync_metadata = trigger_sync_run_and_wait_for_completion(
hightouch_credentials=hightouch_credentials,
sync_id=12345,
full_resync=True,
max_wait_seconds=1800,
poll_frequency_seconds=10,
)
return sync_metadata
sync_flow()
Source code in prefect_hightouch/syncs/flows.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 |
|
wait_for_sync_run_completion
async
Flow that waits for the triggered sync run to complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
sync_id |
str
|
Sync ID used in formatting the endpoint URL. |
required |
max_wait_seconds |
int
|
Maximum number of seconds to wait for the entire flow to complete. |
900
|
poll_frequency_seconds |
int
|
Number of seconds to wait in between checks for run completion. |
10
|
Returns:
Type | Description |
---|---|
SyncStatus
|
|
Sync
|
|
Examples:
Wait for completion as a subflow.
from prefect import flow
from prefect_hightouch import HightouchCredentials
from prefect_hightouch.syncs import wait_for_sync_run_completion
@flow
def wait_flow():
hightouch_credentials = HightouchCredentials.load("hightouch-token")
sync_status, sync_metadata = wait_for_sync_run_completion(
hightouch_credentials=hightouch_credentials,
sync_id=12345,
max_wait_seconds=1800,
poll_frequency_seconds=20,
)
return sync_metadata
wait_flow()
Source code in prefect_hightouch/syncs/flows.py
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
generated
This is a module containing tasks, auto-generated from the Hightouch REST schema, used for interacting with syncs.
get_sync
async
Retrieve sync from sync ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
sync_id |
float
|
Sync ID used in formatting the endpoint URL. |
required |
Returns:
Type | Description |
---|---|
Sync
|
|
API Endpoint:
/syncs/{sync_id}
API Responses:
Response | Description |
---|---|
200 | Ok. |
401 | Unauthorized. |
404 | Not found. |
Source code in prefect_hightouch/syncs/generated.py
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 |
|
list_sync
async
List all the syncs in the current workspace.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
slug |
Optional[str]]
|
Filter based on slug. |
required |
model_id |
Optional[float]]
|
Filter based on modelId. |
required |
after |
Optional[datetime.datetime]]
|
Select syncs that were run after given time. |
required |
before |
Optional[datetime.datetime]]
|
Select syncs that were run before given time. |
required |
limit |
Optional[float]]
|
Limit the number of object it returns. Default is 100. |
required |
order_by |
Optional[models.list_sync_order_by.ListSyncOrderBy]]
|
Specify the order. |
required |
Returns:
Type | Description |
---|---|
List[Sync]
|
|
API Endpoint:
/syncs
API Responses:
Response | Description |
---|---|
200 | Ok. |
400 | Bad request. |
401 | Unauthorized. |
422 | Validation Failed. |
Source code in prefect_hightouch/syncs/generated.py
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 |
|
list_sync_runs
async
List all sync runs under a sync.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
sync_id |
float
|
Sync ID used in formatting the endpoint URL. |
required |
run_id |
Optional[float]]
|
Query for specific run id. |
required |
limit |
Optional[float]]
|
Limit the number of object it returns. Default is 5. |
required |
offset |
Optional[float]]
|
Setting offset from result(for pagination). |
required |
after |
Optional[datetime.datetime]]
|
Select sync runs that are started after given timestamp. |
required |
before |
Optional[datetime.datetime]]
|
Select sync runs that are started before certain timestamp. |
required |
within |
Optional[float]]
|
Select sync runs that are started within last given minutes. |
required |
order_by |
Optional[models.list_sync_runs_order_by.ListSyncRunsOrderBy]]
|
Specify the order. |
required |
Returns:
Type | Description |
---|---|
List[SyncRun]
|
|
API Endpoint:
/syncs/{sync_id}/runs
API Responses:
Response | Description |
---|---|
200 | Ok. |
400 | Bad request. |
401 | Unauthorized. |
422 | Validation Failed. |
Source code in prefect_hightouch/syncs/generated.py
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 186 187 188 189 190 191 192 193 194 195 |
|
trigger_run
async
Trigger a new run for the given sync. If a run is already in progress, this queues a sync run that will get executed immediately after the current run completes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
sync_id |
str
|
Sync ID used in formatting the endpoint URL. |
required |
json_body |
TriggerRunInput
|
The input of a trigger action to run syncs. |
required |
Returns:
Type | Description |
---|---|
TriggerRunOutput
|
|
API Endpoint:
/syncs/{sync_id}/trigger
API Responses:
Response | Description |
---|---|
200 | Ok. |
400 | Bad request. |
401 | Unauthorized. |
422 | Validation Failed. |
Source code in prefect_hightouch/syncs/generated.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
trigger_run_custom
async
Trigger a new run globally based on sync id or sync slug If a run is already in progress, this queues a sync run that will get executed immediately after the current run completes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hightouch_credentials |
HightouchCredentials
|
Credentials to use for authentication with Hightouch. |
required |
json_body |
TriggerRunCustomInput
|
The input of a trigger action to run syncs based on sync ID, slug or other filters. |
required |
Returns:
Type | Description |
---|---|
TriggerRunOutput
|
|
API Endpoint:
/syncs/trigger
API Responses:
Response | Description |
---|---|
200 | Ok. |
400 | Bad request. |
401 | Unauthorized. |
422 | Validation Failed. |
Source code in prefect_hightouch/syncs/generated.py
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 |
|