Skip to content

feature(connectors/bright_data_scrape): add Bright Data Web Scraper C…#41

Open
adomhamza wants to merge 6 commits into
fivetran:mainfrom
adomhamza:feature/bright_data_scrape
Open

feature(connectors/bright_data_scrape): add Bright Data Web Scraper C…#41
adomhamza wants to merge 6 commits into
fivetran:mainfrom
adomhamza:feature/bright_data_scrape

Conversation

@adomhamza

@adomhamza adomhamza commented Jul 2, 2026

Copy link
Copy Markdown

…onnector.

Description of Change

  • Adds a new Connector SDK example that syncs web scraping data from Bright Data's Web Scraper API to Fivetran.
  • Triggers scrape jobs via /datasets/v3/trigger, polls snapshot completion, flattens nested JSON responses, and upserts results to a scrape_results table with primary key (url, result_index).
  • Follows Connector SDK best practices: explicit PK column types in schema(), scalar op.upsert() calls, retry logic with exponential backoff, configuration validation, URL validation, state checkpointing, and key-presence checks during snapshot/JSONL data extraction. No extra third-party dependencies beyond the pre-installed Fivetran environment.

Features

  • Batch URL scraping with automatic snapshot polling
  • Handles one-to-one and one-to-many URL-to-result mappings
  • Dataset-specific query parameters for supported datasets (e.g. LinkedIn Post By URL)
  • Dynamic field discovery from API responses
  • Invalid URL filtering with log.warning() before sync

Files added

  • connector.pyschema(), update(), URL parsing/validation, result processing, upsert logic, debug entry point
  • helpers/scrape.py — job triggering, snapshot polling, retry logic, response parsing
  • helpers/data_processing.py — flattening and field discovery utilities
  • helpers/validation.py — configuration validation
  • configuration.json — placeholder values (no secrets)
  • README.md — setup, configuration, and usage documentation

Testing

image image image

Checklist

Some tips and links to help validate your PR:

  • 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

@adomhamza adomhamza marked this pull request as ready for review July 2, 2026 12:31
@adomhamza

Copy link
Copy Markdown
Author

@fivetran-JenasVimal

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 Connector SDK example (bright_data_scrape) that syncs web scraping results from Bright Data’s Web Scraper API into a Fivetran destination, including helper modules for scraping/polling, validation, and result flattening.

Changes:

  • Introduces a new Bright Data scraper connector (connector.py) with schema, URL parsing/validation, state checkpointing, and upsert logic.
  • Adds helper modules for API job triggering + snapshot polling (helpers/scrape.py), result flattening/field discovery (helpers/data_processing.py), and configuration validation (helpers/validation.py).
  • Adds end-user documentation (README.md) and a placeholder configuration.json.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
bright_data_scrape/connector.py Core Connector SDK implementation (schema/update, URL parsing, sync/upsert, state).
bright_data_scrape/helpers/scrape.py Bright Data API trigger + snapshot polling + response parsing utilities.
bright_data_scrape/helpers/data_processing.py Flattening and row-shaping utilities for scraped results.
bright_data_scrape/helpers/validation.py Configuration validation helper.
bright_data_scrape/helpers/init.py Helper re-exports for simplified imports.
bright_data_scrape/configuration.json Placeholder configuration values (no secrets).
bright_data_scrape/README.md Example documentation (setup/configuration/usage).

Comment thread bright_data_scrape/connector.py Outdated
Comment on lines +32 to +39
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/connectors/connector-sdk/technical-reference#schema
Args:
configuration: a dictionary that holds the configuration settings for the connector.
"""
Comment on lines +55 to +66
def update(configuration: dict, state: dict):
"""
Define the update function which lets you configure how your connector fetches data.
See the technical reference documentation for more details on the update function:
https://fivetran.com/docs/connectors/connector-sdk/technical-reference#update
Args:
configuration: a dictionary that holds the configuration settings for the connector.
state: a dictionary that holds the state of the connector.
"""
# Validate the configuration to ensure it contains all required values
validate_configuration(configuration=configuration)

Comment on lines +195 to +199
# Update state with sync information
state["last_scrape_urls"] = valid_urls
state["last_scrape_count"] = len(processed_results)

op.checkpoint(state)
Comment thread bright_data_scrape/connector.py
Comment thread bright_data_scrape/README.md
Comment thread bright_data_scrape/README.md
Comment thread bright_data_scrape/helpers/__init__.py
Comment thread bright_data_scrape/helpers/scrape.py
Comment thread bright_data_scrape/helpers/scrape.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@fivetran-JenasVimal

Copy link
Copy Markdown
Contributor

Hi @adomhamza ,

Could you please rebase your PR so that the latest checks can run and pass

Thank you!

@adomhamza

Copy link
Copy Markdown
Author

Hi @adomhamza ,

Could you please rebase your PR so that the latest checks can run and pass

Thank you!

Done.

Comment on lines +15 to +17
## Getting started

Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connectors/connector-sdk/setup-guide) to get started.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add this instead

Getting started

Refer to the Connector SDK Setup Guide to get started.

To initialize a new Connector SDK project using this connector as a starting point, run:

fivetran init --template bright_data_scrape

fivetran init initializes a new Connector SDK project by setting up the project structure, configuration files, and a connector you can run immediately with fivetran debug. For more information on fivetran init, refer to the Connector SDK init documentation.

Include the following note only if the connector requires a configuration.json file to run.

Note: Ensure you have updated the configuration.json file with the necessary parameters before running fivetran debug. See the Configuration file section for details on the required configuration parameters.

Comment thread bright_data_scrape/README.md Outdated
Comment thread bright_data_scrape/README.md Outdated
Comment thread bright_data_scrape/README.md Outdated
Comment on lines +20 to +23
# Import required classes from fivetran_connector_sdk
from fivetran_connector_sdk import Connector
from fivetran_connector_sdk import Logging as log
from fivetran_connector_sdk import Operations as op

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

# For reading configuration from a JSON file
import json

# 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

Please add these comments

adomhamza and others added 3 commits July 8, 2026 10:21
Co-authored-by: Jenas Anton Vimal <jenas.vimal@fivetran.com>
Co-authored-by: Jenas Anton Vimal <jenas.vimal@fivetran.com>
Co-authored-by: Jenas Anton Vimal <jenas.vimal@fivetran.com>
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