How evirgenfurkan/pbinject works
PBInject is a single-file Python CLI that synchronizes CSV exports or local CSV files into PocketBase collections. The main workflow reads and normalizes source rows against runtime collection schemas, resolves relations, compares rows with existing records to plan creates, updates and deletions, then applies the plan and logs a summary. The README also documents multi-collection and watch modes. The implementation is concentrated in pbinject.py; unsampled portions limit detail on relation resolution and request execution.
Main entry points: pbinject.py Watch loop
Components 12
CSV input
- CSV source
pbinject.py - Normalize rows
pbinject.py
Sync planning
- Sync planner
pbinject.py - Deletion guard
pbinject.py
PocketBase access
- Schema and key
pbinject.py - Relation resolution
pbinject.py - Existing records
pbinject.py - Batch and fallback
pbinject.py
Apply and record
- Operation log
pbinject.py - Watch loop
pbinject.py
Other components
- Operator
- PocketBase
Connections 14
- Operator → Watch loop: starts sync
README.md - Watch loop → CSV source: selects source
pbinject.py - CSV source → Normalize rows: parses rows
pbinject.py - Normalize rows → Schema and key: maps fields
pbinject.py - Schema and key → PocketBase: fetches schema
pbinject.py - Normalize rows → Relation resolution: resolves values
pbinject.py - Relation resolution → PocketBase: looks up or creates
README.md - Watch loop → Existing records: fetches records
pbinject.py - Existing records → PocketBase: reads pages
pbinject.py - Watch loop → Sync planner: plans sync
pbinject.py - Sync planner → Deletion guard: presents deletion plan
README.md - Deletion guard → Batch and fallback: approves changes
README.md - Batch and fallback → PocketBase: applies requests
README.md - Watch loop → Operation log: appends summary
pbinject.py