Cách Transform JSON Data để Khớp Bất Kỳ Schema Nào - Pure Python vs Pandas
pandas.json_normalize() trong pandas 3.0 tự động flatten nested dict thành dot-separated columns, mở rộng list thành từng row qua record_path. Tham số errors='ignore' ngăn crash khi schema API không nhất quán - nhưng phải kiểm tra lại bằng df.isna().sum(). Custom Python .get() nhanh hơn 3-5x khi chỉ cần 2-3 field từ JSON sâu nhiều cấp. jsonschema library giúp validate output đúng schema trước khi import hoặc forward đến API tiếp theo.
Từ Batch sang Micro-Batch Streaming: Bài học xương máu từ Delta Index Pipeline
Pipeline delta index search/ads giảm worst-case freshness lag từ 10 phút xuống 30 giây (giảm 50%) sau khi chuyển sang Spark Structured Streaming micro-batch với trigger 30 giây. Bottleneck thực sự không phải processing cost mà là scheduling delay và orchestration overhead. Hai lần thất bại (record-level streaming + success file markers) trước khi tìm ra 4 pattern cốt lõi. Áp dụng cho pipeline xử lý hàng triệu documents, delta index hàng chục GB.