how do I know that synchronization is complete whe...
# ask-ai
t
how do I know that synchronization is complete when I programmatically create one @kapa.ai
k
To determine if a synchronization (sync) is complete when you programmatically trigger one in Airbyte, you need to monitor the status of the sync job after triggering it. Here are the main approaches based on the knowledge sources: ### 1. Using the Airbyte API After triggering a sync via the Airbyte API, you receive a job ID in the response. You should then poll the job status endpoint using this job ID until the status is no longer "running". When the status changes to "succeeded", the sync is complete. Here’s a simplified workflow: 1. Trigger the sync and get the job ID. 2. Poll the job status endpoint every few seconds. 3. When the status is "succeeded", the sync is complete. Example (C# pseudocode from the docs):
Copy code
csharp // Trigger a job and get jobId // ...  // Poll for status while(jobStatus == "running") {     // Get status of the job     // ...     // Wait 10 seconds     Thread.Sleep(10000); }  // When jobStatus is not "running", check if it's "succeeded" if (jobStatus == "succeeded") {     Console.WriteLine("Sync complete!"); }
You can also print or log additional details such as rows/bytes synced, start time, and duration when the job finishes [Create and Monitor a Data Pipeline Using the Airbyte API](https://airbyte.com/tutorials/create-and-monitor-a-data-pipeline-using-the-airbyte-api). ### 2. Using PyAirbyte If you use PyAirbyte, after triggering a sync, you can check the returned status. If the status contains "SUCCEEDED", the sync is complete. You can also access details like records synced, bytes synced, and job URL for further verification [Using PyAirbyte as a data orchestrator for hosted Airbyte connections](https://airbyte.com/tutorials/using-pyairbyte-as-a-data-orchestrator-for-hosted-airbyte-connections). ### 3. Using Airflow When orchestrating Airbyte syncs with Airflow, you can use the
AirbyteJobSensor
to wait for the sync to complete. The DAG will only proceed to the next task once the sync is finished [How to use Airflow and Airbyte together](https://airbyte.com/tutorials/how-to-use-airflow-and-airbyte-together). --- Summary: You know a sync is complete when the job status changes to "succeeded" (or "SUCCEEDED") after polling the job status endpoint or using orchestration tools that wait for job completion. Always check the returned status and, if needed, review the job details for confirmation.