Using Claude in VS Code to Build a Custom Connector with the Fivetran Connector SDK
This tutorial demonstrates how to build a custom Fivetran connector using the Connector SDK and Claude AI in Visual Studio Code. It explains how to create instructions for the AI agent, generate the connector files, debug, verify the output locally, and finally deploy the custom connector to Fivetran.
For prerequisites and best practices, see our Building a Custom Connector With VS Code and Claude AI documentation.
The tutorial is based on our FDA Drug API Connector Tutorial.
Prerequisites
Make sure the following tools and setup steps are in place before starting to build a custom Fivetran connector with Claude AI and VS Code:
- Connector SDK installed (see How to Install Fivetran Connector SDK for detailed instructions)
- DuckDB installed
- Visual Studio Code installed
- GitHub Copilot extension installed in VS Code
- GitHub Copilot Chat extension is also installed
- Edit with Copilot available in the Copilot Chat sidebar (Agent Mode)
- (Optional) API key stored as an environment variable
Create a dedicated project folder and confirm local tools are ready.
Project layout example:
FDA_drug_vscode_claude/
agents.md # system instructions pasted from the public repo
connector.py # added later by Claude
configuration.json # added later by Claude
requirements.txt # added later by Claude
README.md # added later by Claude
notes.txt # your API context: auth, endpoints, examples
For more details, see our Project Structure documentation.
Suggested checks before you start prompting:
- Run
fivetran --versionin the VS Code terminal to confirm Connector SDK is on the path. - Run
python --versionto confirm your interpreter is available to the terminal inside VS Code. - If your source needs credentials, export an environment variable for the API key using your shell's syntax. See our environment variable documentation for more details.
Troubleshooting
The issues below are drawn from the VS Code flow in the video transcript. Use them to keep the main steps clean while still capturing practical fixes.
Empty results or 404 errors after first debug run
- Symptom: responses are empty or the API returns 404.
- Likely cause: date range or query filters are too strict for the selected endpoint.
- Fix: loosen or remove the initial lookback window in
configuration.json, or adjust query parameters inconnector.py. Keep the test limit at 10. - Verify: rerun
fivetran debugand confirm rows are emitted.
Field mismatches or schema errors
- Symptom: KeyError, missing field, or schema change events that repeat.
- Likely cause: response shape differs by endpoint or across pages.
- Fix: use safe accessors (for example,
dict.get), flatten nested objects consistently, and declare only primary keys. Bump the local schema version if needed so changes are applied cleanly. - Verify: debug shows stable upserts without repeated schema changes.
Pagination only retrieves one page or duplicates rows
- Symptom: only a small subset of records appears, or duplicates are emitted.
- Likely cause: missing next-page handling, incorrect offset/limit logic, or not honoring continuation tokens.
- Fix: inspect response metadata for next links or cursors; update the loop to request subsequent pages; deduplicate by primary key when emitting.
- Verify: upsert counts increase across pages and duplicates disappear.
Endpoint table missing
- Symptom: an expected table is not created in
warehouse.db. - Likely cause: endpoint not included in
configuration.jsonor not wired inconnector.py. - Fix: add the endpoint to config and map it to a handler in
connector.py; include it in the discover schema. - Verify: rerun debug and confirm the table appears with rows.
Wrong working directory during CLI commands
- Symptom: CLI cannot find
connector.pyorconfiguration.json. - Likely cause: running commands from a parent folder.
- Fix: change directory to the project root before running CLI.
- Verify: CLI starts and references the correct files.
Missing or unset API key when needed
- Symptom: HTTP 401 or 403.
- Likely cause: API requires a key, but the environment variable is unset.
- Fix: export the key as an environment variable and read it in
configuration.json. See the environment variable guide. - Verify: authenticated requests succeed and records are emitted.
Rate limiting or HTTP 429
- Symptom: intermittent failures with 429 status.
- Likely cause: too many requests during testing.
- Fix: keep the test limit at 10, add small sleeps/backoff, and respect server rate limits.
- Verify: stable runs without 429 after adjustments.
warehouse.db not created
- Symptom: no local database after debug.
- Likely cause: debug run failed early or the output path is incorrect.
- Fix: fix the failing error first; ensure the default output location is used or configured correctly.
- Verify: file appears in the project and opens in DuckDB.
DuckDB cannot open the file
- Symptom: error opening
warehouse.db. - Likely cause: DuckDB not installed or wrong path.
- Fix: install DuckDB and provide the correct path to the db file; re-run debug if necessary.
- Verify: tables list successfully and rows are queryable.
Deployment prompts fail or are incomplete
- Symptom: deploy exits asking for destination, connection name, or config path.
- Likely cause: missing inputs.
- Fix: provide destination name, a clear connection name, and the
configuration.jsonpath. - Verify: CLI returns a connector URL and the page opens in Fivetran.
Agent edits the wrong folder
- Symptom: files are created or modified outside the project.
- Likely cause: workspace scope confusion.
- Fix: pin the project folder, point the agent to local files with
#file:references, and confirm paths before accepting edits. - Verify: expected files update in the intended directory.