How paz-rangelr/erp-snowflake-elt works
This repository is an ERP-to-Snowflake ELT pipeline. Its main workflow reads entity definitions from a declarative catalog, fetches paginated ERP records, flattens them into warehouse rows, and merges by content hash so unchanged data is not rewritten. Separate operational paths cover incremental sync, historical backfill, reconciliation, verification and re-queuing; read-only probes measure drift. The README documents the DQ-view capability. Some orchestration internals were not fully sampled, so uncertain call links are omitted; unsampled subsystems are represented only where the README or source index supports them.
Main entry points: extraer.py Extract and flatten · erp_client.py ERP API client · verificar.py Load verification · entidades.py Entity catalog
Components 18
Ingestion engine
- Entity catalog
src/entidades.py - ERP API client
src/erp_client.py - Extract and flatten
src/extraer.py - Memory guard
src/memoria.py
Load operations
- Incremental sync
src/sync.py - Historical backfill
src/backfill.py - History reconciler
src/reconciliar.py - Nightly runner
src/nocturno.py
Verification and drift
- Load verification
src/verificar.py - Re-queue gaps
src/reencolar.py - Status report
src/estado.py - Drift probe
sondas/deriva.py - Field-change probe
sondas/deriva_detalle.py
Warehouse and state
- Hash merge
src/sf.py - Snowflake warehouse
- DQ views
sql/04_vistas_dq.sql
Other components
- Operator
- Leasing ERP API
Connections 24
- Leasing ERP API → ERP API client: serves pages
README.md - Entity catalog → ERP API client: configures requests
README.md - Entity catalog → Extract and flatten: defines mappings
README.md - ERP API client → Extract and flatten: supplies records
README.md - Extract and flatten → Hash merge: submits rows
README.md - Hash merge → Snowflake warehouse: merges rows
README.md - Snowflake warehouse → DQ views: feeds views
README.md - Incremental sync → Extract and flatten: runs incremental load
README.md - History reconciler → Extract and flatten: re-reads history
README.md - Historical backfill → Extract and flatten: loads windows
src/backfill.py - Nightly runner → Historical backfill: coordinates phases
src/nocturno.py - Nightly runner → Load verification: runs checks
src/nocturno.py - Load verification → ERP API client: counts API records
src/verificar.py - Load verification → Snowflake warehouse: compares counts
src/verificar.py - Load verification → Re-queue gaps: re-queues gaps
src/verificar.py - Status report → Snowflake warehouse: reads status
src/estado.py - Drift probe → ERP API client: reads current data
sondas/deriva.py - Drift probe → Snowflake warehouse: compares hashes
sondas/deriva.py - Field-change probe → ERP API client: fetches records
sondas/deriva_detalle.py - Field-change probe → Snowflake warehouse: reads saved JSON
sondas/deriva_detalle.py - Operator → Incremental sync: starts update
README.md - Operator → History reconciler: starts reconciliation
README.md - Operator → Status report: requests status
README.md - Extract and flatten → Memory guard: uses guard
src/extraer.py