Migration Guide - Removing yield
Usage (fivetran-connector-sdk
v2.0.0+)
With the release of version 2.0.0 for fivetran-connector-sdk
pypi package, you no longer need to use yield
with Connector SDK operations that was required in older versions. This update simplifies your code and removes generator-based patterns. You're still free to use generators elsewhere in your code where appropriate, but they're no longer needed for SDK operations.
While the yield
keyword can still be used in your Connector SDK code, it is no longer required. This change is part of our ongoing effort to streamline the Connector SDK workflow.
Background
Prior to version 2.0.0 of the fivetran-connector-sdk
PyPI package, data operations such as upsert
and checkpoint
had to be returned using the yield
keyword.
Code example using yield
(pre-2.0.0 fivetran-connector-sdk
)
from fivetran_connector_sdk import Operations as op
def update(configuration: dict, state: dict):
# Call the helper function to upsert users
yield from upsert_users(state)
def upsert_users(state: dict):
# Sample hardcoded user data
data = [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"},
{"id": 3, "name": "Charlie"},
]
# Yield one upsert operation per user
for row in data:
yield op.upsert("users", row)
# Save the progress with a checkpoint
yield op.checkpoint(state)
In this version, yield
was required to perform operations like upsert
, delete
, checkpoint
, etc.
Updated code example without yield
(fivetran-connector-sdk
v2.0.0+)
from fivetran_connector_sdk import Operations as op
def update(configuration: dict, state: dict):
# Call the helper function to upsert users
upsert_users(state)
def upsert_users(state: dict):
# Sample hardcoded user data
data = [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"},
{"id": 3, "name": "Charlie"},
]
# Perform one upsert operation per user
for row in data:
op.upsert("users", row)
# Save the progress with a checkpoint
op.checkpoint(state)
Now you can simply call data operations directly, without using yield
.
Why this matters
- Simpler syntax – easier to read and maintain
- Better performance – no generator overhead
- Cleaner stack traces – easier debugging
What you need to do
- Upgrade to version 2.0.0 or later
- Identify and remove any Connector SDK related usages of
yield
in your code - Replace the related
yield from
statements with direct function calls - Run
fivetran debug
to verify everything works as expected - Run
fivetran deploy
command to deploy your updated connector code
Related links
- Changelog for version 2.0.0: Fivetran Connector SDK Changelog
- Fivetran Connector SDK code examples