Apache Airflow provider for Planasonix data integration platform
Project description
Planasonix Airflow Provider
Apache Airflow provider package for Planasonix data integration platform.
Orchestrate your data syncs directly from Airflow DAGs with full visibility into job status, progress, and results.
Installation
pip install planasonix-airflow
Or with Poetry:
poetry add planasonix-airflow
Requirements
- Python 3.8+
- Apache Airflow 2.5+
- Planasonix Professional or Enterprise subscription
Quick Start
1. Create an API Key
- Log into Planasonix at https://app.planasonix.com
- Go to Settings → API Keys
- Create a new key with
sync:triggerandsync:readpermissions - Copy the key (starts with
flx_)
2. Configure Airflow Connection
Option A: Via Airflow UI
- Go to Admin → Connections
- Add a new connection:
- Connection Id:
planalytix_default - Connection Type:
Planasonix - Host:
https://api.planasonix.com - Password: Your API key (
flx_xxxx...)
- Connection Id:
Option B: Via Environment Variable
export AIRFLOW_CONN_PLANALYTIX_DEFAULT='planalytix://unused:flx_your_api_key@api.planasonix.com'
3. Create Your DAG
from datetime import datetime
from airflow import DAG
from planasonix_provider.operators.sync import PlanalytixSyncOperator
with DAG(
dag_id="sync_salesforce_daily",
start_date=datetime(2024, 1, 1),
schedule_interval="@daily",
catchup=False,
) as dag:
sync_salesforce = PlanalytixSyncOperator(
task_id="sync_salesforce",
connection_id="conn_abc123", # Your Planasonix connection ID
sync_type="incremental",
wait_for_completion=True,
poll_interval=30,
timeout=3600,
)
Components
PlanalytixHook
Low-level hook for direct API access:
from planasonix_provider.hooks.planasonix import PlanalytixHook
hook = PlanalytixHook()
# Trigger a sync
job = hook.trigger_sync(
connection_id="conn_abc123",
sync_type="incremental",
)
# Check status
status = hook.get_job(job["job_id"])
# Get results
results = hook.get_job_results(job["job_id"])
PlanalytixSyncOperator
Trigger and optionally wait for sync completion:
from planasonix_provider.operators.sync import PlanalytixSyncOperator
# Simple sync with waiting
sync_task = PlanalytixSyncOperator(
task_id="sync_data",
connection_id="conn_abc123",
sync_type="incremental", # or "full"
wait_for_completion=True,
poll_interval=30,
timeout=3600,
)
# Sync specific streams only
sync_partial = PlanalytixSyncOperator(
task_id="sync_orders",
connection_id="conn_abc123",
streams=["orders", "order_items"],
sync_type="incremental",
)
# High priority sync (Enterprise only)
sync_priority = PlanalytixSyncOperator(
task_id="sync_urgent",
connection_id="conn_abc123",
priority="high",
wait_for_completion=True,
)
# Fire and forget (no waiting)
trigger_only = PlanalytixSyncOperator(
task_id="trigger_sync",
connection_id="conn_abc123",
wait_for_completion=False,
)
PlanalytixSyncSensor
Wait for a job triggered elsewhere:
from planasonix_provider.sensors.sync import PlanalytixSyncSensor
# Wait for job from upstream task
wait_for_job = PlanalytixSyncSensor(
task_id="wait_for_sync",
job_id="{{ ti.xcom_pull(task_ids='trigger_sync', key='job_id') }}",
poke_interval=30,
timeout=3600,
mode="reschedule", # Free worker while waiting
)
XCom Values
The operator pushes these values to XCom:
| Key | Description |
|---|---|
job_id |
The Planasonix job ID |
connection_id |
The connection that was synced |
job_status |
Final status (completed, failed, cancelled) |
job_results |
Full results object (if completed) |
Access in downstream tasks:
def process_results(**context):
job_id = context["ti"].xcom_pull(task_ids="sync_task", key="job_id")
results = context["ti"].xcom_pull(task_ids="sync_task", key="job_results")
if results:
rows_synced = results.get("summary", {}).get("total_rows_synced", 0)
print(f"Synced {rows_synced} rows")
Webhook Integration
For real-time notifications, configure webhooks in Planasonix:
- Go to Settings → Webhooks
- Add your endpoint URL
- Select events:
job.completed,job.failed
Your webhook will receive:
{
"id": "evt_abc123",
"type": "job.completed",
"timestamp": "2024-01-15T10:30:00Z",
"job_id": "job_xyz789",
"data": {
"status": "completed",
"summary": {
"total_rows_synced": 48291,
"duration_seconds": 245
}
}
}
Idempotency
The operator automatically generates idempotency keys based on:
- DAG ID
- Task ID
- Run ID
This prevents duplicate syncs if a task is retried:
# Idempotency is automatic, but you can override:
sync_task = PlanalytixSyncOperator(
task_id="sync_data",
connection_id="conn_abc123",
idempotency_key="my-custom-key-{{ ds }}",
)
Error Handling
# Fail task on sync failure (default)
sync_task = PlanalytixSyncOperator(
task_id="sync_data",
connection_id="conn_abc123",
fail_on_error=True, # Default
)
# Continue on failure (for non-critical syncs)
sync_optional = PlanalytixSyncOperator(
task_id="sync_optional_data",
connection_id="conn_xyz",
fail_on_error=False,
)
Tier Features
| Feature | Professional | Enterprise |
|---|---|---|
| Trigger syncs | ✅ | ✅ |
| Wait for completion | ✅ | ✅ |
| Webhook notifications | ✅ | ✅ |
| Priority queuing | ❌ | ✅ |
| AI event visibility | ❌ | ✅ |
| Deferrable operators | ❌ | ✅ (coming soon) |
Troubleshooting
"No API key found"
Ensure your Airflow connection has the API key in the password field or in extras as api_key.
"Connection not found"
Verify the connection_id matches a connection in your Planasonix account. You can find connection IDs in the Planasonix UI under Connections.
"Orchestration API requires Professional tier"
The orchestration API is available on Professional and Enterprise tiers. Upgrade at https://planasonix.com/pricing
Sync timeout
Increase the timeout parameter or use wait_for_completion=False with a separate sensor.
Support
- Documentation: https://docs.planasonix.com/integrations/airflow
- Issues: https://github.com/planasonix/planasonix-airflow/issues
- Email: support@planasonix.com
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file planasonix_airflow-1.0.4.tar.gz.
File metadata
- Download URL: planasonix_airflow-1.0.4.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069f9bb24948a090aaa61202e56635108a497faada8d84c7e373c83b44c623eb
|
|
| MD5 |
bb4dcf7a7de3de58d642e9a383894863
|
|
| BLAKE2b-256 |
5ea5142c2a09f8e8b1d6395bd4fb0e6af3ae622983228b861905fe553e76b92e
|
Provenance
The following attestation bundles were made for planasonix_airflow-1.0.4.tar.gz:
Publisher:
publish-airflow-package.yml on parmlalli/planasonix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
planasonix_airflow-1.0.4.tar.gz -
Subject digest:
069f9bb24948a090aaa61202e56635108a497faada8d84c7e373c83b44c623eb - Sigstore transparency entry: 1056970104
- Sigstore integration time:
-
Permalink:
parmlalli/planasonix@55eb085e013ec384c6fb4778414e50e49bc581e2 -
Branch / Tag:
refs/heads/dev - Owner: https://github.com/parmlalli
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-airflow-package.yml@55eb085e013ec384c6fb4778414e50e49bc581e2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file planasonix_airflow-1.0.4-py3-none-any.whl.
File metadata
- Download URL: planasonix_airflow-1.0.4-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86768bba1ac465335cd3511c000c926f270e0ed58fc79007c0dd196a4b1fb2e1
|
|
| MD5 |
fadb996c413b61f5280bf6575f3ee172
|
|
| BLAKE2b-256 |
5cedef8dd6d6286c3689d390a7b151bc2a43d0a2c9226758a02ddd21d2397679
|
Provenance
The following attestation bundles were made for planasonix_airflow-1.0.4-py3-none-any.whl:
Publisher:
publish-airflow-package.yml on parmlalli/planasonix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
planasonix_airflow-1.0.4-py3-none-any.whl -
Subject digest:
86768bba1ac465335cd3511c000c926f270e0ed58fc79007c0dd196a4b1fb2e1 - Sigstore transparency entry: 1056970106
- Sigstore integration time:
-
Permalink:
parmlalli/planasonix@55eb085e013ec384c6fb4778414e50e49bc581e2 -
Branch / Tag:
refs/heads/dev - Owner: https://github.com/parmlalli
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-airflow-package.yml@55eb085e013ec384c6fb4778414e50e49bc581e2 -
Trigger Event:
workflow_dispatch
-
Statement type: