Skip to content

Conversation

@fivetran-surabhisingh
Copy link
Collaborator

Jira ticket

Closes <ADD TICKET LINK HERE, EACH PR MUST BE LINKED TO A JIRA TICKET>

Description of Change

<MENTION A SHORT DESCRIPTION OF YOUR CHANGES HERE>

Testing

<MENTION ABOUT YOUR TESTING DETAILS HERE, ATTACH SCREENSHOTS IF NEEDED (WITHOUT PII)>

Checklist

Some tips and links to help validate your PR:

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

@fivetran-surabhisingh fivetran-surabhisingh self-assigned this Oct 31, 2025
@fivetran-surabhisingh fivetran-surabhisingh requested a review from a team as a code owner October 31, 2025 18:19
@fivetran-surabhisingh fivetran-surabhisingh added the hackathon For all the PRs related to the internal Fivetran 2025 Connector SDK Hackathon. label Oct 31, 2025
@github-actions github-actions bot added the size/S PR size: small label Oct 31, 2025
@github-actions
Copy link

🧹 Python Code Quality Check

⚠️ Flake8 has detected issues, please fix the issues before merging:

📎 Download full report from workflow artifacts.

📌 Only Python files changed in this PR were checked.

🔍 See how this check works

This comment is auto-updated with every commit.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Swift connector for fetching payment data via SWIFT API. The connector is a minimal implementation showing API integration setup.

  • Adds a new Swift connector under connectors/swift/
  • Implements basic transaction fetching from a SWIFT API endpoint
  • Uses a decorator-based connector pattern

"""

import requests
from fivetran_connector_sdk import connector, config, state, records, log, schema
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER: Incorrect SDK imports. The Fivetran Connector SDK uses a different import pattern. Use these exact imports instead: from fivetran_connector_sdk import Connector, from fivetran_connector_sdk import Logging as log, and from fivetran_connector_sdk import Operations as op. The decorator-based pattern with @connector, config, state, records, and schema imports does not exist in the SDK.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +9 to +12
CONFIG = config.Config(
base_url=config.StringField(description="SWIFT API base URL"),
api_key=config.SecretField(description="SWIFT API key")
)
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER: This configuration pattern is not supported by the Fivetran Connector SDK. Configuration should be defined in a configuration.json file which the SDK automatically validates. Remove this CONFIG object and create a configuration.json file instead with the required fields.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +14 to +22
SCHEMA = schema.Schema(
name="swift_transactions",
columns={
"transaction_id": schema.StringColumn(),
"amount": schema.StringColumn(),
"currency": schema.StringColumn(),
"timestamp": schema.StringColumn(),
}
)
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER: This schema definition pattern is not supported. The SDK requires a schema() function that returns a list of table dictionaries. Replace this with a proper schema(configuration: dict) function following the template format.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +24 to +30
@connector(
name="SwiftConnector",
version="0.1.0",
config=CONFIG,
schema=SCHEMA,
)
def run_connector(ctx: state.Context):
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER: The decorator-based @connector pattern is not part of the Fivetran Connector SDK. The SDK requires an update(configuration: dict, state: dict) function and a Connector object initialized as connector = Connector(update=update, schema=schema). Remove the decorator and implement the required functions.

Copilot generated this review using guidance from repository custom instructions.
Fetches payment data via SWIFT API (mock endpoint for base setup).
"""

import requests
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import comment. Add a comment explaining the purpose of this import, e.g., # For making HTTP API requests (provided by SDK runtime).

Suggested change
import requests
import requests # For making HTTP API requests (provided by SDK runtime)

Copilot uses AI. Check for mistakes.
for tx in response.json().get("data", []):
records.write("swift_transactions", tx)

return ctx.update_state({"last_sync": "now"})
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER: Incorrect state management pattern. The SDK uses op.checkpoint(state) to save state, and the update function should not return state. Replace with proper checkpointing using op.checkpoint() and include the required checkpoint comment.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +1 to +4
"""
Swift connector for Fivetran Connector SDK.
Fetches payment data via SWIFT API (mock endpoint for base setup).
"""
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing required structure: The connector is missing the mandatory main block for debugging. Add the following at the end: if __name__ == '__main__': block with connector.debug(configuration=configuration) as shown in the template.

Copilot generated this review using guidance from repository custom instructions.
for tx in response.json().get("data", []):
records.write("swift_transactions", tx)

return ctx.update_state({"last_sync": "now"})
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using string literal 'now' as a timestamp value is incorrect. Use a proper ISO 8601 timestamp format like datetime.datetime.now().isoformat() or a Unix timestamp.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +33
response = requests.get(f"{ctx.config.base_url}/transactions", headers=headers)
response.raise_for_status()
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing specific exception handling. Generic exceptions from raise_for_status() should be caught and handled specifically (e.g., distinguish between 4xx client errors that shouldn't be retried vs 5xx server errors that should). Implement proper error handling with specific exception types.

Copilot generated this review using guidance from repository custom instructions.
"""

import requests
from fivetran_connector_sdk import connector, config, state, records, log, schema
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'log' is not used.

Suggested change
from fivetran_connector_sdk import connector, config, state, records, log, schema
from fivetran_connector_sdk import connector, config, state, records, schema

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hackathon For all the PRs related to the internal Fivetran 2025 Connector SDK Hackathon. size/S PR size: small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant