From 8fe56dbc2816369eedac24f8507bdd6133655703 Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Thu, 6 Aug 2026 16:54:37 +0530 Subject: [PATCH 01/14] initial commit --- .../error_and_warning_operations/README.md | 65 +++++++ .../error_and_warning_operations/connector.py | 180 ++++++++++++++++++ .../mock_weather.csv | 8 + 3 files changed, 253 insertions(+) create mode 100644 examples/common_patterns/error_and_warning_operations/README.md create mode 100644 examples/common_patterns/error_and_warning_operations/connector.py create mode 100644 examples/common_patterns/error_and_warning_operations/mock_weather.csv diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md new file mode 100644 index 000000000..ca5facc97 --- /dev/null +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -0,0 +1,65 @@ +# Error and warning operations connector example + +## Connector overview +This connector demonstrates how to use `op.warning()` for recoverable row-level problems and `op.error()` for a terminal data-integrity problem in one sync run. + +The source is a local `mock_weather.csv` file with columns `zipcode`, `city`, `weather`, and `date`. The connector writes to the `weather` table with `zipcode` as the primary key. + +## Requirements +- [Supported Python versions](https://github.com/fivetran/connector_sdk/blob/main/README.md#requirements) +- Operating system: + - Windows: 10 or later (64-bit only) + - macOS: 13 (Ventura) or later (Apple Silicon [arm64] or Intel [x86_64]) + - Linux: Distributions such as Ubuntu 20.04 or later, Debian 10 or later, or Amazon Linux 2 or later (arm64 or x86_64) + +## Getting started +Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connector-sdk/setup-guide) to get started. + +To initialize a new Connector SDK project using this connector as a starting point, run: + +```bash +fivetran init --template examples/common_patterns/error_and_warning_operations +``` + +## Features +- Shows two warning scenarios where sync can continue +- Shows one fatal primary-key validation error where sync stops +- Uses a small local CSV file for deterministic, repeatable behavior + +## Pagination +Not applicable. This connector reads a local CSV file. + +## Data handling +The connector processes rows from `mock_weather.csv` and applies these checks in order: + +1. If `city` is empty, it emits warning 1 and skips the row. +2. If `date` is present but not in `YYYY-MM-DD` format, it emits warning 2 and skips the row. +3. If `zipcode` (primary key) is empty, it emits a terminal error and exits immediately. + +Valid rows are upserted into `weather`. + +## Error handling +The connector uses: + +- `op.warning()` for recoverable row-level quality issues +- `op.error()` when primary key identity is missing and data can no longer be safely written + +`op.error()` terminates the sync immediately. + +## Tables created + +```json +{ + "table": "weather", + "primary_key": ["zipcode"], + "columns": { + "zipcode": "STRING", + "city": "STRING", + "weather": "STRING", + "date": "NAIVE_DATE" + } +} +``` + +## Additional considerations +The examples provided are intended to help you effectively use Fivetran's Connector SDK. While we've tested the code, Fivetran cannot be held responsible for any unexpected or negative consequences that may arise from using these examples. For inquiries, please reach out to our Support team. diff --git a/examples/common_patterns/error_and_warning_operations/connector.py b/examples/common_patterns/error_and_warning_operations/connector.py new file mode 100644 index 000000000..9887173ed --- /dev/null +++ b/examples/common_patterns/error_and_warning_operations/connector.py @@ -0,0 +1,180 @@ +""" +This example demonstrates op.warning() and op.error() in one deterministic flow. +It emits two warnings and then one terminal error for an empty primary key. +""" + +# For reading mock weather records from a CSV file +import csv + +# For parsing optional date values +from datetime import datetime + +# For resolving local file paths relative to this connector file +from pathlib import Path + +# Import required classes from fivetran_connector_sdk +from fivetran_connector_sdk import Connector + +# For enabling Logs in your connector code +from fivetran_connector_sdk import Logging as log + +# For supporting Data operations like Upsert(), Update(), Delete() and checkpoint() +from fivetran_connector_sdk import Operations as op + +__TABLE_NAME = "weather" +__MOCK_CSV_PATH = Path(__file__).with_name("mock_weather.csv") +__DATE_FORMAT = "%Y-%m-%d" + + +def schema(configuration: dict): + """ + Define the schema function which lets you configure the schema your connector delivers. + See the technical reference documentation for more details on the schema function: + https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-code/connector-sdk-methods#schema + Args: + configuration: a dictionary that holds the configuration settings for the connector. + """ + return [ + { + "table": __TABLE_NAME, + "primary_key": ["zipcode"], + "columns": { + "zipcode": "STRING", + "city": "STRING", + "weather": "STRING", + "date": "NAIVE_DATE", + }, + } + ] + + +def validate_configuration(configuration: dict): + """ + Validate the configuration dictionary to ensure it contains all required parameters. + This example does not require any configuration values. + Args: + configuration: a dictionary that holds the configuration settings for the connector. + """ + return + + +def is_valid_optional_date(date_value: str): + """ + Validate optional date values from source rows. + Args: + date_value: Date value from source row. + Returns: + True when date is empty or in YYYY-MM-DD format; otherwise False. + """ + if not date_value: + return True + + try: + datetime.strptime(date_value, __DATE_FORMAT) + return True + except ValueError: + return False + + +def read_mock_weather_rows(): + """ + Read source-like weather rows from mock CSV. + Returns: + List of row dictionaries loaded from mock_weather.csv. + """ + if not __MOCK_CSV_PATH.exists(): + op.error(message=f"Mock CSV file was not found: {__MOCK_CSV_PATH.name}") + return [] + + with __MOCK_CSV_PATH.open("r", encoding="utf-8", newline="") as csv_file: + reader = csv.DictReader(csv_file) + return list(reader) + + +def update(configuration: dict, state: dict): + """ + Define the update function, which is a required function, and is called by Fivetran during each sync. + See the technical reference documentation for more details on the update function + https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-code/connector-sdk-methods#update + Args: + configuration: A dictionary containing connection details + state: A dictionary containing state information from previous runs + The state dictionary is empty for the first sync or for any full re-sync + """ + log.warning("Example: COMMON PATTERNS : ERROR AND WARNING OPERATIONS") + + validate_configuration(configuration=configuration) + source_rows = read_mock_weather_rows() + + for row in source_rows: + zipcode = str(row.get("zipcode", "")).strip() + city = str(row.get("city", "")).strip() + weather = str(row.get("weather", "")).strip() + date_value = str(row.get("date", "")).strip() + + # Warning 1: + # Empty city is a recoverable row-level issue, so this row is skipped. + if not city: + op.warning( + message=(f"Warning 1 of 2: city is empty for zipcode '{zipcode}'. " "Row skipped.") + ) + continue + + # Warning 2: + # Invalid optional date format is non-fatal, so this row is skipped. + if not is_valid_optional_date(date_value=date_value): + op.warning( + message=( + f"Warning 2 of 2: invalid optional date format for zipcode '{zipcode}'. " + f"Expected YYYY-MM-DD, got '{date_value}'. Row skipped." + ) + ) + continue + + # Final terminal error: + # Empty primary key means record identity is invalid, so sync must stop. + if not zipcode: + op.error( + message=( + "Primary key 'zipcode' is empty in source data. " + "Stopping sync to avoid writing non-identifiable rows." + ) + ) + return + + output_record = { + "zipcode": zipcode, + "city": city, + "weather": weather, + "date": date_value, + } + + # The 'upsert' operation is used to insert or update data in the destination table. + # The first argument is the name of the destination table. + # The second argument is a dictionary containing the record to be upserted. + op.upsert(table=__TABLE_NAME, data=output_record) + + # Save the progress by checkpointing the state. This is important for ensuring that the sync process can resume + # from the correct position in case of next sync or interruptions. + # You should checkpoint even if you are not using incremental sync, as it tells Fivetran it is safe to write to destination. + # For large datasets, checkpoint regularly (e.g., every N records) not only at the end. + # Learn more about how and where to checkpoint by reading our best practices documentation + # (https://fivetran.com/docs/connector-sdk/best-practices#optimizingperformancewhenhandlinglargedatasets). + op.checkpoint(state=state) + + +# Create the connector object using the schema and update functions +connector = Connector(update=update, schema=schema) + +# Check if the script is being run as the main module. +# This is Python's standard entry method allowing your script to be run directly from the command line or IDE 'run' button. +# +# IMPORTANT: The recommended way to test your connector is using the Fivetran debug command: +# fivetran debug +# +# This local testing block is provided as a convenience for quick debugging during development, +# such as using IDE debug tools (breakpoints, step-through debugging, etc.). +# Note: This method is not called by Fivetran when executing your connector in production. +# Always test using 'fivetran debug' prior to finalizing and deploying your connector. +if __name__ == "__main__": + connector.debug() diff --git a/examples/common_patterns/error_and_warning_operations/mock_weather.csv b/examples/common_patterns/error_and_warning_operations/mock_weather.csv new file mode 100644 index 000000000..3de61b734 --- /dev/null +++ b/examples/common_patterns/error_and_warning_operations/mock_weather.csv @@ -0,0 +1,8 @@ +zipcode,city,weather,date +02108,Boston,Sunny,2026-08-01 +30301,Atlanta,Humid,2026-08-02 +94105,,Windy,2026-08-02 +10001,New York,Rainy,2026/08/03 +73301,Austin,Hot, +60601,Chicago,Clear,2026-08-04 +,Chicago,Cloudy,2026-08-04 From 09004529921009f8e4fb15f1a5f076223bb5b6cf Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Thu, 6 Aug 2026 16:56:40 +0530 Subject: [PATCH 02/14] Add warning/error operations weather example --- examples/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/README.md b/examples/README.md index a73ef38c5..7b200b7e4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -102,6 +102,7 @@ These examples demonstrate common patterns and best practices for building conne ### Error handling and resilience - [error_handling](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/errors) - This example shows how to handle errors throughout the Connector SDK process and is driven by the configuration.json error_simulation_type value. +- [error_and_warning_operations](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/error_and_warning_operations) - This example shows a deterministic flow with two row-level warnings and one terminal primary-key error using a mock weather CSV source. - [update_and_delete](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/update_and_delete) - This example shows how to handle composite primary keys while using update and delete operations with a PostgreSQL database as the data source. From 8a1d0aa83e25d3809406c9b5ddaf7e2221b4a619 Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Thu, 6 Aug 2026 17:07:56 +0530 Subject: [PATCH 03/14] Refine warning/error example descriptions --- examples/README.md | 2 +- examples/common_patterns/error_and_warning_operations/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/README.md b/examples/README.md index 7b200b7e4..27704084a 100644 --- a/examples/README.md +++ b/examples/README.md @@ -102,7 +102,7 @@ These examples demonstrate common patterns and best practices for building conne ### Error handling and resilience - [error_handling](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/errors) - This example shows how to handle errors throughout the Connector SDK process and is driven by the configuration.json error_simulation_type value. -- [error_and_warning_operations](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/error_and_warning_operations) - This example shows a deterministic flow with two row-level warnings and one terminal primary-key error using a mock weather CSV source. +- [error_and_warning_operations](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/error_and_warning_operations) - This example demonstrates the `warning()` and `error()` operations with a mock weather CSV source. - [update_and_delete](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/update_and_delete) - This example shows how to handle composite primary keys while using update and delete operations with a PostgreSQL database as the data source. diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index ca5facc97..20fc73875 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -18,7 +18,7 @@ Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connector-sdk To initialize a new Connector SDK project using this connector as a starting point, run: ```bash -fivetran init --template examples/common_patterns/error_and_warning_operations +fivetran init --template examples/common_patterns/error_and_warning_operations ``` ## Features From fba5412efd2d945686e023c34856f1b9d523a941 Mon Sep 17 00:00:00 2001 From: Dejan Tucakov Date: Thu, 6 Aug 2026 15:07:08 +0200 Subject: [PATCH 04/14] Apply suggestions from code review --- .../common_patterns/error_and_warning_operations/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index 20fc73875..cc6ad044b 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -36,7 +36,7 @@ The connector processes rows from `mock_weather.csv` and applies these checks in 2. If `date` is present but not in `YYYY-MM-DD` format, it emits warning 2 and skips the row. 3. If `zipcode` (primary key) is empty, it emits a terminal error and exits immediately. -Valid rows are upserted into `weather`. +Valid rows are upserted into `WEATHER`. ## Error handling The connector uses: @@ -47,7 +47,7 @@ The connector uses: `op.error()` terminates the sync immediately. ## Tables created - +The connector creates the `WEATHER` table. ```json { "table": "weather", From 9208b3c2c9d82b6385106daa861e7dd3f839a4da Mon Sep 17 00:00:00 2001 From: Dejan Tucakov Date: Thu, 6 Aug 2026 15:21:01 +0200 Subject: [PATCH 05/14] Fix formatting for example order Correct formatting for error handling example link in README. --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 27704084a..238383410 100644 --- a/examples/README.md +++ b/examples/README.md @@ -101,8 +101,8 @@ These examples demonstrate common patterns and best practices for building conne ### Error handling and resilience -- [error_handling](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/errors) - This example shows how to handle errors throughout the Connector SDK process and is driven by the configuration.json error_simulation_type value. - [error_and_warning_operations](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/error_and_warning_operations) - This example demonstrates the `warning()` and `error()` operations with a mock weather CSV source. +- [error_handling](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/errors) - This example shows how to handle errors throughout the Connector SDK process and is driven by the `configuration.json` `error_simulation_type` value. - [update_and_delete](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/update_and_delete) - This example shows how to handle composite primary keys while using update and delete operations with a PostgreSQL database as the data source. From 3dccf5a51eaaad24245d6b2f90862917845c8e35 Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Thu, 6 Aug 2026 19:20:27 +0530 Subject: [PATCH 06/14] Added a few more changes --- .../error_and_warning_operations/README.md | 9 ++++++--- .../error_and_warning_operations/configuration.json | 1 + .../error_and_warning_operations/connector.py | 9 +++++++-- .../error_and_warning_operations/mock_weather.csv | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 examples/common_patterns/error_and_warning_operations/configuration.json diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index cc6ad044b..fef4e585c 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -1,7 +1,7 @@ # Error and warning operations connector example ## Connector overview -This connector demonstrates how to use `op.warning()` for recoverable row-level problems and `op.error()` for a terminal data-integrity problem in one sync run. +This connector demonstrates how to use [`op.warning()`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#warning) for recoverable row-level problems and [`op.error()`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#error) for a terminal data-integrity problem in one sync run. The source is a local `mock_weather.csv` file with columns `zipcode`, `city`, `weather`, and `date`. The connector writes to the `weather` table with `zipcode` as the primary key. @@ -41,8 +41,11 @@ Valid rows are upserted into `WEATHER`. ## Error handling The connector uses: -- `op.warning()` for recoverable row-level quality issues -- `op.error()` when primary key identity is missing and data can no longer be safely written +- [`op.warning(message="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#warning) for recoverable row-level quality issues. + - `message` (str): non-empty warning text shown in the dashboard. In this example, it is used for empty `city` and invalid `date` format rows that are skipped. +- [`op.error(message="...", trace="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#error) when primary key identity is missing and data can no longer be safely written. + - `message` (str): non-empty fatal error text shown in the dashboard. + - `trace` (str, optional): extra debug context such as failed check name, row number, and row values. `op.error()` terminates the sync immediately. diff --git a/examples/common_patterns/error_and_warning_operations/configuration.json b/examples/common_patterns/error_and_warning_operations/configuration.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/examples/common_patterns/error_and_warning_operations/configuration.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/examples/common_patterns/error_and_warning_operations/connector.py b/examples/common_patterns/error_and_warning_operations/connector.py index 9887173ed..60315e10f 100644 --- a/examples/common_patterns/error_and_warning_operations/connector.py +++ b/examples/common_patterns/error_and_warning_operations/connector.py @@ -5,12 +5,14 @@ # For reading mock weather records from a CSV file import csv +import trace # For parsing optional date values from datetime import datetime # For resolving local file paths relative to this connector file from pathlib import Path +from threading import enumerate # Import required classes from fivetran_connector_sdk from fivetran_connector_sdk import Connector @@ -67,7 +69,7 @@ def is_valid_optional_date(date_value: str): True when date is empty or in YYYY-MM-DD format; otherwise False. """ if not date_value: - return True + return False try: datetime.strptime(date_value, __DATE_FORMAT) @@ -106,7 +108,9 @@ def update(configuration: dict, state: dict): validate_configuration(configuration=configuration) source_rows = read_mock_weather_rows() + row_number = 0 for row in source_rows: + row_number += 1 zipcode = str(row.get("zipcode", "")).strip() city = str(row.get("city", "")).strip() weather = str(row.get("weather", "")).strip() @@ -138,7 +142,8 @@ def update(configuration: dict, state: dict): message=( "Primary key 'zipcode' is empty in source data. " "Stopping sync to avoid writing non-identifiable rows." - ) + ), + trace=("Empty zipcode check , at {row_number}."), ) return diff --git a/examples/common_patterns/error_and_warning_operations/mock_weather.csv b/examples/common_patterns/error_and_warning_operations/mock_weather.csv index 3de61b734..0087208cb 100644 --- a/examples/common_patterns/error_and_warning_operations/mock_weather.csv +++ b/examples/common_patterns/error_and_warning_operations/mock_weather.csv @@ -3,6 +3,6 @@ zipcode,city,weather,date 30301,Atlanta,Humid,2026-08-02 94105,,Windy,2026-08-02 10001,New York,Rainy,2026/08/03 -73301,Austin,Hot, +73301,Austin,Hot,2026-08-04 60601,Chicago,Clear,2026-08-04 ,Chicago,Cloudy,2026-08-04 From 22ee8b7ea3141032e245dfd2b9587c5579984b3b Mon Sep 17 00:00:00 2001 From: Jenas Anton Vimal Date: Thu, 6 Aug 2026 19:25:36 +0530 Subject: [PATCH 07/14] Update examples/README.md --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 238383410..03848b670 100644 --- a/examples/README.md +++ b/examples/README.md @@ -102,7 +102,7 @@ These examples demonstrate common patterns and best practices for building conne ### Error handling and resilience - [error_and_warning_operations](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/error_and_warning_operations) - This example demonstrates the `warning()` and `error()` operations with a mock weather CSV source. -- [error_handling](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/errors) - This example shows how to handle errors throughout the Connector SDK process and is driven by the `configuration.json` `error_simulation_type` value. +- [error_handling](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/errors) - This example shows how to handle errors throughout the Connector SDK process and is driven by the configuration.json error_simulation_type value. - [update_and_delete](https://github.com/fivetran/connector_sdk/tree/main/examples/common_patterns/update_and_delete) - This example shows how to handle composite primary keys while using update and delete operations with a PostgreSQL database as the data source. From cc0c315aa6a7470eaf17d63f8e4681ca3ba4851e Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Thu, 6 Aug 2026 20:02:53 +0530 Subject: [PATCH 08/14] added f to the log --- .../common_patterns/error_and_warning_operations/connector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common_patterns/error_and_warning_operations/connector.py b/examples/common_patterns/error_and_warning_operations/connector.py index 60315e10f..23aa29f44 100644 --- a/examples/common_patterns/error_and_warning_operations/connector.py +++ b/examples/common_patterns/error_and_warning_operations/connector.py @@ -143,7 +143,7 @@ def update(configuration: dict, state: dict): "Primary key 'zipcode' is empty in source data. " "Stopping sync to avoid writing non-identifiable rows." ), - trace=("Empty zipcode check , at {row_number}."), + trace=(f"Empty zipcode check at row {row_number}."), ) return From f5e864805a8a778d2bfb2b356d6f2d136d894ffb Mon Sep 17 00:00:00 2001 From: Jenas Anton Vimal Date: Fri, 7 Aug 2026 16:24:07 +0530 Subject: [PATCH 09/14] Update examples/common_patterns/error_and_warning_operations/README.md --- examples/common_patterns/error_and_warning_operations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index fef4e585c..f0344fcc1 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -42,7 +42,7 @@ Valid rows are upserted into `WEATHER`. The connector uses: - [`op.warning(message="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#warning) for recoverable row-level quality issues. - - `message` (str): non-empty warning text shown in the dashboard. In this example, it is used for empty `city` and invalid `date` format rows that are skipped. + - `message` (string): non-empty warning text shown in the dashboard. In this example, it is used for empty `city` and invalid `date` format rows that are skipped. - [`op.error(message="...", trace="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#error) when primary key identity is missing and data can no longer be safely written. - `message` (str): non-empty fatal error text shown in the dashboard. - `trace` (str, optional): extra debug context such as failed check name, row number, and row values. From 47af7c78ca80c9738e8a6bcaaeeff7c64bd996ae Mon Sep 17 00:00:00 2001 From: Jenas Anton Vimal Date: Mon, 10 Aug 2026 00:20:00 +0530 Subject: [PATCH 10/14] Update examples/common_patterns/error_and_warning_operations/README.md Co-authored-by: Dejan Tucakov --- examples/common_patterns/error_and_warning_operations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index f0344fcc1..65d1f2f18 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -44,7 +44,7 @@ The connector uses: - [`op.warning(message="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#warning) for recoverable row-level quality issues. - `message` (string): non-empty warning text shown in the dashboard. In this example, it is used for empty `city` and invalid `date` format rows that are skipped. - [`op.error(message="...", trace="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#error) when primary key identity is missing and data can no longer be safely written. - - `message` (str): non-empty fatal error text shown in the dashboard. + - `message` (string): non-empty fatal error text shown in the dashboard. - `trace` (str, optional): extra debug context such as failed check name, row number, and row values. `op.error()` terminates the sync immediately. From ee54451b55edd733ff77430d88d4461543617f76 Mon Sep 17 00:00:00 2001 From: Jenas Anton Vimal Date: Mon, 10 Aug 2026 00:20:08 +0530 Subject: [PATCH 11/14] Update examples/common_patterns/error_and_warning_operations/README.md Co-authored-by: Dejan Tucakov --- examples/common_patterns/error_and_warning_operations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index 65d1f2f18..8a1595a5e 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -45,7 +45,7 @@ The connector uses: - `message` (string): non-empty warning text shown in the dashboard. In this example, it is used for empty `city` and invalid `date` format rows that are skipped. - [`op.error(message="...", trace="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#error) when primary key identity is missing and data can no longer be safely written. - `message` (string): non-empty fatal error text shown in the dashboard. - - `trace` (str, optional): extra debug context such as failed check name, row number, and row values. + - `trace` (string, optional): extra debug context such as failed check name, row number, and row values. `op.error()` terminates the sync immediately. From 708a8c0a4b97d860293ee0122dab90cd2434313c Mon Sep 17 00:00:00 2001 From: Jenas Anton Vimal Date: Mon, 10 Aug 2026 15:29:55 +0530 Subject: [PATCH 12/14] Update examples/common_patterns/error_and_warning_operations/README.md --- examples/common_patterns/error_and_warning_operations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common_patterns/error_and_warning_operations/README.md b/examples/common_patterns/error_and_warning_operations/README.md index 8a1595a5e..a94aaa09f 100644 --- a/examples/common_patterns/error_and_warning_operations/README.md +++ b/examples/common_patterns/error_and_warning_operations/README.md @@ -45,7 +45,7 @@ The connector uses: - `message` (string): non-empty warning text shown in the dashboard. In this example, it is used for empty `city` and invalid `date` format rows that are skipped. - [`op.error(message="...", trace="...")`](https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-operations#error) when primary key identity is missing and data can no longer be safely written. - `message` (string): non-empty fatal error text shown in the dashboard. - - `trace` (string, optional): extra debug context such as failed check name, row number, and row values. + - `trace` (string, optional): Stack trace or other debugging information about the error, for example `str(exception)`. `op.error()` terminates the sync immediately. From bcac0c2aa9ef593b8357af95783712d75bd39504 Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Mon, 10 Aug 2026 16:07:51 +0530 Subject: [PATCH 13/14] flake8 formatted --- .../common_patterns/error_and_warning_operations/connector.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/common_patterns/error_and_warning_operations/connector.py b/examples/common_patterns/error_and_warning_operations/connector.py index 23aa29f44..a1fc3eb92 100644 --- a/examples/common_patterns/error_and_warning_operations/connector.py +++ b/examples/common_patterns/error_and_warning_operations/connector.py @@ -5,14 +5,12 @@ # For reading mock weather records from a CSV file import csv -import trace # For parsing optional date values from datetime import datetime # For resolving local file paths relative to this connector file from pathlib import Path -from threading import enumerate # Import required classes from fivetran_connector_sdk from fivetran_connector_sdk import Connector From 78d76b661a4c1d4f811e887720eb0d0ccdb5ea56 Mon Sep 17 00:00:00 2001 From: fivetran-JenasVimal Date: Mon, 10 Aug 2026 22:38:02 +0530 Subject: [PATCH 14/14] resolved comments --- .../error_and_warning_operations/connector.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/common_patterns/error_and_warning_operations/connector.py b/examples/common_patterns/error_and_warning_operations/connector.py index a1fc3eb92..61f483583 100644 --- a/examples/common_patterns/error_and_warning_operations/connector.py +++ b/examples/common_patterns/error_and_warning_operations/connector.py @@ -1,11 +1,18 @@ """ This example demonstrates op.warning() and op.error() in one deterministic flow. It emits two warnings and then one terminal error for an empty primary key. +See the Technical Reference documentation +(https://fivetran.com/docs/connector-sdk/technical-reference/connector-sdk-code/connector-sdk-methods#update) +and the Best Practices documentation +(https://fivetran.com/docs/connector-sdk/best-practices) for details. """ # For reading mock weather records from a CSV file import csv +# For reading configuration from a JSON file +import json + # For parsing optional date values from datetime import datetime @@ -180,4 +187,9 @@ def update(configuration: dict, state: dict): # Note: This method is not called by Fivetran when executing your connector in production. # Always test using 'fivetran debug' prior to finalizing and deploying your connector. if __name__ == "__main__": - connector.debug() + # Open the configuration.json file and load its contents + with open("configuration.json", "r") as f: + configuration = json.load(f) + + # Test the connector locally + connector.debug(configuration=configuration)