Dynamic Sync System - Complete Guide
Overview
Your sync system is now fully dynamic and can handle any platform (Notion, Airtable, etc.) with intelligent filtering by platform, application, component, vault, user, and more.Quick Start
Architecture
File Structure
Key Components
- Dynamic Query Builder: Handles any combination of filters
- Platform Detection: Auto-detects platform type from your models
- Connection Pooling: Reuses connections across syncs
- Rate Limiting: Token bucket with burst support
- Incremental Sync: Only updates changed records
- Streaming: Memory-efficient batch processing
- Metrics: Comprehensive performance tracking
Command Reference
Discovery Commands
Basic Sync
Filtered Sync
Smart Sync
Performance Modes
Advanced Combinations
Monitoring
Direct Python Usage
Available Options
| Option | Description | Default |
|---|---|---|
--platform | Filter by platform type | None |
--app | Filter by application name/slug | None |
--source | Filter by source alias | None |
--component | Filter by component type | None |
--vault | Filter by vault name/ID | None |
--user | Filter by username/ID | None |
--only-enabled | Only sync enabled sources | False |
--only-due | Only sync sources due now | False |
--pool-size | Connection pool size | 10 |
--max-concurrent | Max concurrent syncs | 5 |
--batch-size | Streaming batch size | 100 |
--rate-limit | API calls per second | 3.0 |
--no-streaming | Disable streaming | False |
--no-incremental | Full replacement sync | False |
--dry-run | Show plan without syncing | False |
--verbose | Detailed output | False |
How It Works
Query Building
The system intelligently interprets your target:Platform Detection
The system automatically:- Detects
V01tDataResource.platform.platform_type - Groups sources by platform
- Selects appropriate sync service (Notion, Airtable, etc.)
- Routes to correct handler
Sync Flow
Common Workflows
Daily Sync
After Content Changes
Troubleshooting
Large Import
Specific App Update
Performance Tuning
Settings Explained
Pool Size (--pool-size):
- Number of reusable connections
- Higher = more memory, faster for many sources
- Recommended: 5-20
--max-concurrent):
- How many syncs run in parallel
- Higher = faster but more API load
- Recommended: 2-10
--batch-size):
- Records fetched per API call
- Higher = fewer calls, more memory
- Recommended: 50-200
--rate-limit):
- API calls per second
- Match your platform’s limits
- Notion: 3.0, Airtable: 5.0
Presets
| Mode | Pool | Concurrent | Use When |
|---|---|---|---|
| Safe | 5 | 2 | Errors, instability |
| Default | 10 | 5 | Normal use |
| Fast | 20 | 10 | Large imports |
Extending the System
Adding New Platforms
- Create service in
core/services/sync/:
- Update
appsync.py:
- Shell script automatically works!
Custom Metrics
Add toSyncMetrics in metrics.py: