-
Notifications
You must be signed in to change notification settings - Fork 30
feature(examples): Add Planday connector #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fivertran-karunveluru
wants to merge
3
commits into
main
Choose a base branch
from
planday
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+666
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Planday HR API Connector Example | ||
|
|
||
| ## Connector overview | ||
| This connector syncs employee, department, and skills data from the Planday HR API to your destination warehouse. It demonstrates memory-efficient streaming patterns for large datasets, implements comprehensive error handling with exponential backoff retry logic, and supports both initial and incremental synchronization using timestamp-based cursors. The connector fetches data from three core endpoints: `/employees` for staff information, `/departments` for organizational structure, and `/skills` for competency tracking. | ||
|
|
||
| ## Requirements | ||
| - [Supported Python versions](https://github.com/fivetran/fivetran_connector_sdk/blob/main/README.md#requirements): **3.9-3.13** | ||
| - 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/connectors/connector-sdk/setup-guide) to get started. | ||
|
|
||
| ## Features | ||
| - Syncs employee personal information, job details, and compensation data from Planday HR API | ||
| - Bearer token authentication with automatic retry logic for expired tokens (refer to `execute_api_request` function) | ||
| - Offset-based pagination with automatic page traversal (refer to `get_employees`, `get_departments`, and `get_skills` functions) | ||
| - Memory-efficient streaming prevents data accumulation for large employee datasets | ||
| - Incremental synchronization using timestamp-based cursors (refer to `get_time_range` function) | ||
| - Comprehensive error handling with exponential backoff retry logic (refer to `__handle_rate_limit` and `__handle_request_error` functions) | ||
| - Data quality validation and field mapping for consistent database schema (refer to `__map_employee_data`, `__map_department_data`, and `__map_skill_data` functions) | ||
|
|
||
| ## Configuration file | ||
| ```json | ||
| { | ||
| "api_key": "<YOUR_PLANDAY_HR_API_KEY>", | ||
| "initial_sync_days": "<YOUR_PLANDAY_HR_API_INITIAL_SYNC_DAYS>", | ||
| "max_records_per_page": "<YOUR_PLANDAY_HR_API_MAX_RECORDS_PER_PAGE>", | ||
| "request_timeout_seconds": "<YOUR_PLANDAY_HR_API_REQUEST_TIMEOUT_SECONDS>", | ||
| "retry_attempts": "<YOUR_PLANDAY_HR_API_RETRY_ATTEMPTS>", | ||
| "enable_incremental_sync": "<YOUR_PLANDAY_HR_API_ENABLE_INCREMENTAL_SYNC>" | ||
| } | ||
| ``` | ||
|
|
||
| ### Configuration parameters | ||
| - `api_key` (required): Your Planday HR API authentication key | ||
| - `initial_sync_days` (optional): Number of days to sync during initial sync, defaults to 90 days | ||
| - `max_records_per_page` (optional): Maximum records per API request, defaults to 100 (range: 1-1000) | ||
| - `request_timeout_seconds` (optional): HTTP request timeout in seconds, defaults to 30 | ||
| - `retry_attempts` (optional): Number of retry attempts for failed requests, defaults to 3 | ||
| - `enable_incremental_sync` (optional): Enable timestamp-based incremental sync, defaults to true | ||
|
|
||
| ## Requirements file | ||
| This connector does not require any additional packages beyond those provided by the Fivetran environment. | ||
|
|
||
| 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`. | ||
|
|
||
| ## Authentication | ||
| 1. Log in to the [Planday HR Developer Portal](https://openapi.planday.com/api/hr). | ||
| 2. Navigate to your application settings or API credentials section. | ||
| 3. Generate a new API key or retrieve your existing authentication token. | ||
| 4. Make a note of the `api_key` from your application settings. | ||
| 5. Ensure your API key has appropriate permissions for reading employee, department, and skills data. | ||
|
|
||
| Note: The connector uses Bearer token authentication with automatic retry logic for failed requests. API keys are never logged or exposed in plain text for security. | ||
|
|
||
| ## Pagination | ||
| Offset-based pagination with automatic page traversal (refer to the `get_employees`, `get_departments`, and `get_skills` functions). Generator-based processing prevents memory accumulation for large employee datasets. Processes pages sequentially while yielding individual records for immediate processing. Each endpoint supports configurable page sizes through the `max_records_per_page` setting. | ||
|
|
||
| ## Data handling | ||
| Employee, department, and skills data are mapped from Planday HR API format to normalized database columns (refer to the `__map_employee_data`, `__map_department_data`, and `__map_skill_data` functions). Nested objects are flattened, and all timestamps are converted to UTC format for consistency across different time zones. | ||
|
|
||
| Supports timestamp-based incremental synchronization using the `last_sync_time` state parameter (refer to the `get_time_range` function). Initial sync can be configured to fetch historical data up to 365 days. Memory-efficient streaming processes individual records without accumulating large datasets in memory. | ||
|
|
||
| ## Error handling | ||
| - 429 Rate Limited: Automatic retry with Retry-After header support (refer to the `__handle_rate_limit` function) | ||
| - Timeout handling with configurable retry attempts (refer to the `__handle_request_error` function) | ||
| - Exponential backoff with jitter prevents multiple clients from making requests at the same time | ||
| - Parameter validation with descriptive error messages provides clear guidance for fixing setup issues | ||
| - Network connectivity issues are handled with progressive retry delays and comprehensive logging | ||
|
|
||
| ## Tables created | ||
| | Table | Primary Key | Description | | ||
| |-------|-------------|-------------| | ||
| | EMPLOYEES | `id` | Employee personal information, job details, and compensation data | | ||
| | DEPARTMENTS | `id` | Organizational departments with management structure and budget information | | ||
| | SKILLS | `id` | Employee skills and competencies with proficiency levels and categories | | ||
|
|
||
| Column types are automatically inferred by Fivetran. Sample columns include `first_name`, `last_name`, `email`, `department_id`, `hire_date`, `position`, `salary`, `hourly_rate`, `manager_id`, `name`, `description`, `budget`, `cost_center`, `category`, `level`, `certification_required`. | ||
|
|
||
| ## 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "api_key": "<YOUR_PLANDAY_HR_API_KEY>", | ||
| "initial_sync_days": "<YOUR_PLANDAY_HR_API_INITIAL_SYNC_DAYS>", | ||
| "max_records_per_page": "<YOUR_PLANDAY_HR_API_MAX_RECORDS_PER_PAGE>", | ||
| "request_timeout_seconds": "<YOUR_PLANDAY_HR_API_REQUEST_TIMEOUT_SECONDS>", | ||
| "retry_attempts": "<YOUR_PLANDAY_HR_API_RETRY_ATTEMPTS>", | ||
| "enable_incremental_sync": "<YOUR_PLANDAY_HR_API_ENABLE_INCREMENTAL_SYNC>" | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.