Bidirectional Sync: Salesforce and Snowflake Objective: Stream Salesforce sales data into Snowflake for analytics in near real time, and push the metrics Snowflake calculates back into Salesforce, so sellers act on the same numbers the analysts see. What's Getting Built File Landing and Pickup (System API) — picks up partner files over SFTP or object storage after a completeness check and lands them raw and immutable · SFTP/OBJECT-STORE POLL, MARKER-FILE / SIZE-STABILITY CHECK, COPY to landing zone, RECORD arrival (partner, name, size, checksum) Validate and Stream Load (Process API) — validates structure and control totals, then streams and chunks the file into the warehouse with a checkpoint per chunk · VALIDATE structure + encoding, RECONCILE declared vs parsed control totals, STREAM + CHUNK transform, CHECKPOINT + STAGE load Warehouse Load Target (target) — receives validated rows idempotently on a natural key so a replayed chunk overwrites rather than appends · STAGE INSERT, MERGE on natural key, POLL bulk job completion Run Reconciliation (Batch flow) — reconciles source, transformed, delivered, and rejected counts per run and resumes from the last committed checkpoint on failure · SELECT source/transformed/delivered/rejected counts, PUBLISH run manifest, RESUME from lastCheckpoint Rejected Record Store (Object Store) — per-record error store holding malformed rows with reason so the rest of the run completes and rejects can be reprocessed · PUT /{runId}/{recordRef}, GET /{runId}/{recordRef}, DELETE /{runId}/{recordRef} 1. Business requirements Sync opportunities, accounts, and products from Salesforce to Snowflake in near real time. Return calculated analytics from Snowflake to Salesforce in scheduled batches. Sustain large datasets — 100K+ records — without degrading either system. Validate and cleanse data as part of the sync rather than afterwards. Maintain an audit trail with end-to-end data lineage. 2. Salesforce to Snowflake Trigger on Platform Events or Change Data Capture rather than polling. Cover Opportunity, Account, Contact, Product, and OpportunityLineItem. Target a sync latency under five minutes from the Salesforce change. Flatten the Salesforce object graph into the Snowflake table structure. Enrich each row with sync timestamp, source system, and a data quality score. 3. Snowflake to Salesforce Run as a scheduled batch every four hours. Carry calculated metrics: customer lifetime value, sales forecasts, territory performance. Write to custom fields on Account and Opportunity. Validate calculated values against business rules before updating Salesforce. 4. Data transformation and quality Standardize dates, currencies, and phone numbers to one format. Validate required fields and referential integrity. Handle nulls and type conversions explicitly rather than by coercion. Score and flag data quality instead of silently accepting bad rows. Load into staging tables and validate before the final load. 5. Conflict resolution Resolve conflicts on timestamp by default. Define per-field rules wherever the timestamp rule gives the wrong answer. Log every conflict for manual review. Allow a manual override path for business-critical fields. 6. Performance Use bulk operations for large datasets and Salesforce Bulk API 2.0 for large writes. Process independent data streams in parallel. Recommend Snowflake clustering and query patterns for the access paths you create. Pool connections and bound resource usage per stream. 7. Error handling and recovery Wrap external calls in retry logic with a circuit breaker. Send failed records to a dead letter queue that supports manual reprocessing. Roll back failed batch operations rather than leaving partial loads. Classify errors and route them by type. Raise incidents into your existing incident management system. 8. Monitoring and analytics Dashboard sync status and throughput in real time. Report data quality trends over time, not just current state. Monitor sync completion against its SLA. Alert on data anomalies as well as outright failures. 9. Security and governance Encrypt data end to end, in transit and at rest. Apply role-based access control by data sensitivity. Mask data in non-production environments. Meet SOX and GDPR obligations, with audit logging and data lineage. 10. Deployment architecture Separate dev, test, and prod configuration. Deploy blue-green so updates take no downtime. Define the infrastructure as code. Document disaster recovery, backup, and capacity plans. Deliverable: A deployable bidirectional integration with the architecture documented in comments, the full set of failure scenarios handled, and production monitoring in place.