1. Integrations
  2. Stitch in Mage

Configuration

Here are the following keyword arguments that can be used for configuration:

Keyword argumentDescriptionSample value
access_tokenStitch API acess tokenabc123

Example code

Trigger sync with source_id.

from mage_ai.services.stitch.stitch import StitchClient


client = StitchClient(config=dict(access_token='access_token'))

sources = client.list_sources()
source_id = sources[0]['id'] # Get source id

client.start_replication_job(source_id) # Start replication job

Sample output:

Start replication job for source 11111. Job name: 111111.222222.sync.abcd1234-a96e-4b48-a10c-9de147a72d64.
Polling Stitch extraction status for source 11111. Current status: running.
Polling Stitch extraction status for source 11111. Current status: running.
Polling Stitch extraction status for source 11111. Current status: running.
Extraction for source 11111 completed.
Finish loading data for all streams: ['stream_1', 'stream_2'].