Skip to content

example(connector_sdk) : re-raised new connector#39

Open
fivetran-JenasVimal wants to merge 5 commits into
mainfrom
re-raise_people-ai
Open

example(connector_sdk) : re-raised new connector#39
fivetran-JenasVimal wants to merge 5 commits into
mainfrom
re-raise_people-ai

Conversation

@fivetran-JenasVimal

Copy link
Copy Markdown
Contributor

Description of Change

Re-raising this connector from old repo

Testing

This is actively being used by a customer. Also, tested locally this morning here
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, refer here for template.
  • Followed Python Coding Standards, refer here

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

Adds a new people_ai Connector SDK example (ported from an older repo) that authenticates to the People.ai API via OAuth2 client credentials, paginates through activities endpoints, and upserts results into destination tables.

Changes:

  • Added people_ai/connector.py implementing OAuth token acquisition, retry/backoff, pagination, and upserts.
  • Added people_ai/README.md documenting usage, configuration, and produced tables.
  • Added people_ai/configuration.json template plus a (currently empty) people_ai/requirements.txt.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 22 comments.

File Description
people_ai/connector.py Implements the People.ai API sync logic (auth, pagination, retries, upserts, checkpointing).
people_ai/README.md Documents connector behavior, setup, configuration parameters, and tables.
people_ai/configuration.json Provides placeholder configuration keys for API credentials.
people_ai/requirements.txt Added file intended for dependencies (currently empty).

Comment thread people_ai/requirements.txt Outdated
@@ -0,0 +1 @@

Comment thread people_ai/README.md
Comment on lines +14 to +19
## Requirements
- [Supported Python versions](https://github.com/fivetran/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: Ubuntu 20.04 or later, Debian 10 or later, or Amazon Linux 2 or later (arm64 or x86_64)
Comment thread people_ai/README.md
Comment on lines +47 to +50
## Requirements file
This connector has no external dependencies and does not require a `requirements.txt` file.

Note: The `fivetran_connector_sdk:latest` and `requests:latest` packages are pre-installed in the Fivetran environment. To avoid dependency conflicts, do not declare them in your `requirements.txt`.
Comment thread people_ai/README.md
Comment on lines +104 to +108
## Additional files
- `connector.py` – Contains all core logic: `schema`, `update`, `get_page`, `sync_base_activities`, `sync_activity_type`, `get_access_token`.
- `configuration.json` – Contains API credentials (`api_key`, `api_secret`).
- `requirements.txt` – Lists any third-party Python libraries required (e.g., `requests`).

Comment thread people_ai/connector.py
Comment on lines +62 to +71
"""
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 thread people_ai/README.md
Comment on lines +21 to +25
## Getting started
Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connectors/connector-sdk/setup-guide) for setup instructions.

For local testing, this example includes a `__main__` block that reads `configuration.json` and runs `connector.debug(...)`.

Comment thread people_ai/README.md
Comment on lines +91 to +103
## Tables created
This connector creates two tables, `ACTIVITY` and `PARTICIPANTS`.

### `ACTIVITY`
- Primary key: `uid`
- Selected columns (not exhaustive):
`uid`, `sub_type`, `created_at`, `activity_type`, `updated_at`

### `PARTICIPANTS`
- Primary key: `uid`, `email`
- Selected columns (not exhaustive):
`uid`, `email`, `status`, `name`, `ingested_at`, `phone_number`

Comment thread people_ai/connector.py
raise e # If re-auth fails, raise the exception
else:
# If 401 and max reauth retries reached
log.severe(
Comment thread people_ai/connector.py
except requests.exceptions.HTTPError as e:
# The retry logic is now inside get_page,
# so an error here means it failed permanently
log.severe(f"Permanent failure fetching base activities" f" at offset {offset}: {e}")
Comment thread people_ai/connector.py
except requests.exceptions.HTTPError as e:
# The retry logic is now inside get_page,
# so an error here means it failed permanently
log.severe(f"Permanent failure fetching {activity_type}" f" at offset {offset}: {e}")

@fivetran-sahilkhirwal fivetran-sahilkhirwal 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.

changes look good
For tests, please rebase after this is merged: #30

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 24 comments.

Comment thread people_ai/requirements.txt Outdated
@@ -0,0 +1 @@

Comment thread people_ai/README.md
Comment on lines +14 to +19
## Requirements
- [Supported Python versions](https://github.com/fivetran/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: Ubuntu 20.04 or later, Debian 10 or later, or Amazon Linux 2 or later (arm64 or x86_64)
Comment thread people_ai/README.md
- `api_key`: Your People.ai API key (client ID).
- `api_secret`: Your People.ai API secret (client secret).

Note: Ensure that `configuration.json` is not committed to version control. Both configuration values are required; the connector will raise an error if either is missing.
Comment thread people_ai/README.md
Comment on lines +47 to +50
## Requirements file
This connector has no external dependencies and does not require a `requirements.txt` file.

Note: The `fivetran_connector_sdk:latest` and `requests:latest` packages are pre-installed in the Fivetran environment. To avoid dependency conflicts, do not declare them in your `requirements.txt`.
Comment thread people_ai/README.md
Comment on lines +104 to +108
## Additional files
- `connector.py` – Contains all core logic: `schema`, `update`, `get_page`, `sync_base_activities`, `sync_activity_type`, `get_access_token`.
- `configuration.json` – Contains API credentials (`api_key`, `api_secret`).
- `requirements.txt` – Lists any third-party Python libraries required (e.g., `requests`).

Comment thread people_ai/connector.py
Comment on lines +402 to +413
"""
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 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.
"""
Comment thread people_ai/connector.py
Comment on lines +458 to +459
limit=100000,
)
Comment thread people_ai/connector.py
Comment on lines +468 to +477
# 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.
# This is useful for debugging while you write your code. Note this method is not called by Fivetran when executing your connector in production.
# Please test using the Fivetran debug command prior to finalizing and deploying your connector.
if __name__ == "__main__":
# Open the configuration.json file and load its contents into a dictionary.
with open("configuration.json", "r") as f:
configuration = json.load(f)
# Adding this code to your `connector.py` allows you to test your connector by running your file directly from your IDE.
connector.debug(configuration=configuration)
Comment thread people_ai/connector.py
Comment on lines +236 to +242
page = get_page(
access_token,
reauth_func,
activity_type=None,
limit=limit,
offset=offset,
)
Comment thread people_ai/README.md
Comment on lines +21 to +25
## Getting started
Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connectors/connector-sdk/setup-guide) for setup instructions.

For local testing, this example includes a `__main__` block that reads `configuration.json` and runs `connector.debug(...)`.

Copilot AI review requested due to automatic review settings July 3, 2026 08:06

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 23 comments.

Comment thread people_ai/connector.py
Comment on lines +62 to +71
"""
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 thread people_ai/connector.py
Comment on lines +402 to +413
"""
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 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.
"""
Comment thread people_ai/connector.py
Comment on lines +39 to +40
# The unused imports 'Sequence' and 'Literal' have been removed.
from typing import Any, Dict, List, Callable, Optional
Comment thread people_ai/connector.py
Comment on lines +158 to +162
log.severe(
f"Failed to fetch page after {__MAX_RETRIES + 1} "
f"due to {status_code} error."
)
raise e
Comment thread people_ai/connector.py
Comment on lines +166 to +167
log.severe(f"Received unrecoverable HTTP error {status_code}")
raise e
Comment thread people_ai/README.md
Comment on lines +21 to +24
## Getting started
Refer to the [Connector SDK Setup Guide](https://fivetran.com/docs/connectors/connector-sdk/setup-guide) for setup instructions.

For local testing, this example includes a `__main__` block that reads `configuration.json` and runs `connector.debug(...)`.
Comment thread people_ai/README.md
Comment on lines +47 to +50
## Requirements file
This connector has no external dependencies and does not require a `requirements.txt` file.

Note: The `fivetran_connector_sdk:latest` and `requests:latest` packages are pre-installed in the Fivetran environment. To avoid dependency conflicts, do not declare them in your `requirements.txt`.
Comment thread people_ai/README.md
Comment on lines +104 to +108
## Additional files
- `connector.py` – Contains all core logic: `schema`, `update`, `get_page`, `sync_base_activities`, `sync_activity_type`, `get_access_token`.
- `configuration.json` – Contains API credentials (`api_key`, `api_secret`).
- `requirements.txt` – Lists any third-party Python libraries required (e.g., `requests`).

Comment thread people_ai/README.md
Comment on lines +52 to +56
## Authentication
- Type: OAuth2 Client Credentials
- Token URL: `https://api.people.ai/auth/v1/tokens`
- Headers: `Content-Type: application/x-www-form-urlencoded`
- Grant Type: `client_credentials`
Comment thread people_ai/README.md
Comment on lines +94 to +98
### `ACTIVITY`
- Primary key: `uid`
- Selected columns (not exhaustive):
`uid`, `sub_type`, `created_at`, `activity_type`, `updated_at`

Copilot AI review requested due to automatic review settings July 3, 2026 08:12
@fivetran-rishabhghosh fivetran-rishabhghosh removed the request for review from a team July 3, 2026 08:14

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 22 comments.

Comment thread people_ai/connector.py
Comment on lines +61 to +70
"""
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 thread people_ai/connector.py
Comment on lines +401 to +412
"""
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 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.
"""
Comment thread people_ai/connector.py
Comment on lines +157 to +160
log.severe(
f"Failed to fetch page after {__MAX_RETRIES + 1} "
f"due to {status_code} error."
)
Comment thread people_ai/connector.py
Comment on lines +165 to +166
log.severe(f"Received unrecoverable HTTP error {status_code}")
raise e
Comment thread people_ai/connector.py
Comment on lines +242 to +246
except requests.exceptions.HTTPError as e:
# The retry logic is now inside get_page,
# so an error here means it failed permanently
log.severe(f"Permanent failure fetching base activities" f" at offset {offset}: {e}")
break
Comment thread people_ai/connector.py
Comment on lines +192 to +194
except Exception as e:
log.severe(f"Failed to refresh token: {e}")
raise e # If re-auth fails, raise the exception
Comment thread people_ai/connector.py
Comment on lines +197 to +203
log.severe(
f"Authentication failed after {__REAUTH_RETRY_COUNT + 1}"
" re-authentication attempts."
)
raise requests.exceptions.HTTPError(
"401 Client Error: Unauthorized (Max re-auth retries reached)"
)
Comment thread people_ai/connector.py
Comment on lines +427 to +432
try:
access_token = get_access_token(api_key, api_secret)
except requests.exceptions.RequestException as e:
log.severe(f"FATAL: Initial authentication failed: {e}")
return # Stop the sync

Comment thread people_ai/connector.py
Comment on lines +235 to +241
page = get_page(
access_token,
reauth_func,
activity_type=None,
limit=limit,
offset=offset,
)
Comment thread people_ai/connector.py
while True:
try:
# Pass the reauth_func
page = get_page(access_token, reauth_func, activity_type, limit=limit, offset=offset)
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