Skip to content

Fix update_configuration_during_sync example to work with fivetran debug - #618

Merged
fivetran-clgritton merged 3 commits into
fivetran:mainfrom
fivetran-clgritton:add-local-debug-guard
Aug 19, 2026
Merged

Fix update_configuration_during_sync example to work with fivetran debug#618
fivetran-clgritton merged 3 commits into
fivetran:mainfrom
fivetran-clgritton:add-local-debug-guard

Conversation

@fivetran-clgritton

@fivetran-clgritton fivetran-clgritton commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Jira ticket

Closes <no Jira ticket — small fix found while debugging this example locally; happy to link one if required for merge>

Description of Change

The update_configuration_during_sync example is documented as "not meant for production use," but it also didn't actually run via fivetran debug as shipped, which is confusing for anyone using it to learn the pattern locally.

update_configuration() unconditionally PATCHes https://api.fivetran.com/v1/connections/{FIVETRAN_CONNECTION_ID}. During fivetran debug, FIVETRAN_CONNECTION_ID is a placeholder (test_connection_id) and there's no real API key to authenticate with, so this call always fails with an uncaught response.raise_for_status(), crashing the whole sync before any data is upserted.

The SDK exposes FIVETRAN_DEPLOYMENT_MODEL at runtime, set to local_debug during fivetran debug (vs. managed_cloud/hybrid_cloud in production — see the Environment Variables reference). This adds a check for that value in update_configuration(): when running locally, it skips the live REST API call and logs only the config key names it would have updated (never the values, since config holds username/password/fivetran_api_key/token). Production behavior (managed_cloud/hybrid_cloud) is unchanged.

Also added a short note to the README's Authentication section explaining this behavior, since it wasn't otherwise documented.

Testing

  • Tested the connector with fivetran debug command — ran end-to-end against the fivetran-api-playground mock server after fivetran reset, sync succeeded with 20 upserts into the user table on each run.
  • Confirmed no secret values appear in logs — the local-debug log line prints only config key names (['username', 'password', 'fivetran_api_key', 'token']), not values.
  • black --check --diff --line-length 99 and flake8 both pass clean on the changed file.

Checklist

  • Tested the connector with fivetran debug command.
  • Added/Updated example-specific README.md file, see the README template for the required structure and guidelines.
  • Followed Python Coding Standards, refer here

🤖 Generated with Claude Code

…uring local debug

The SDK sets FIVETRAN_DEPLOYMENT_MODEL="local_debug" during `fivetran debug`
(vs. "managed_cloud"/"hybrid_cloud" in production), and injects placeholder
values for FIVETRAN_CONNECTION_ID. Without a guard, update_configuration()
always tries to PATCH https://api.fivetran.com/v1/connections/test_connection_id,
which fails immediately since there's no real connection or API key locally.
This crashes the whole sync via the uncaught response.raise_for_status(),
before any data is upserted.

This example is documented as "not meant for production use," but it also
didn't actually run via `fivetran debug` as shipped, which is confusing for
anyone trying to learn from it locally. This adds a check for
FIVETRAN_DEPLOYMENT_MODEL == "local_debug" that skips the live REST call and
logs the would-be payload instead, so the example runs end-to-end with
`fivetran debug` against the fivetran-api-playground mock server.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fivetran-clgritton and others added 2 commits August 18, 2026 13:45
payload contains the full config (username, password, fivetran_api_key,
token) via secrets_list. Logging it directly with log.info would have
written credentials to the sync log. Log only the config key names being
updated instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CI runs black --check --diff --line-length 99 on PRs; the multi-line f-string
in the previous commit exceeded the line length. Wrapped per black's output.
Verified: black --check and flake8 both pass clean on this file, and
fivetran debug still succeeds end-to-end afterward.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@fivetran-rishabhghosh
fivetran-rishabhghosh requested review from fivetran-JenasVimal and fivetran-sahilkhirwal and removed request for a team August 18, 2026 20:27
@fivetran-clgritton
fivetran-clgritton merged commit 042f7e2 into fivetran:main Aug 19, 2026
4 checks passed
@fivetran-clgritton
fivetran-clgritton deleted the add-local-debug-guard branch September 2, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants