SQL and ORM balance for backend developers

Why Every Backend Developer Should Master SQL — Even in the Age of ORMs

Summary: ORMs make development faster, but mastering SQL and database internals turns good backend engineers into great ones. Here’s why understanding both levels — abstraction and reality — matters. ⚙️ Context & Problem Modern web frameworks — Django, FastAPI, Spring Boot, Laravel — all encourage the use of Object-Relational Mappers (ORMs). They make it easy to map objects to tables, run queries in a few lines of code, and forget about SQL altogether. ...

October 26, 2025 · 5 min · Frederico Gago
Microservices Resilience Cover Image

How to Handle Microservice Failures: The Ambiguous Timeout Dilemma

🧩 The Classic Problem: When a Service Doesn’t Respond Imagine the following flow in a service-oriented system: Client → the-api → the-upstream → Database 1️⃣ The client calls the-api/v1/test 2️⃣ the-api calls the-upstream 3️⃣ the-upstream writes data into its own database 4️⃣ It replies OK to the-api 5️⃣ the-api stores the result in its database and replies OK to the client Everything works fine — until step 4 (D) fails because of a network partition or timeout. Now, the-api doesn’t know if the upstream actually wrote the data or not. You can’t safely commit your local write — and you can’t confidently reply to the client. ...

October 6, 2025 · 5 min · Frederico Gago
Conceptual diagram of a Unit of Work with application and persistence layers

Unit of Work (UoW) in Python with SQLAlchemy: explicit transactions, savepoints, and outbox

Building a Production-Grade Unit of Work (UoW) System in Python with SQLAlchemy When you build complex applications with databases, services, and background jobs, you eventually run into the transaction problem: How do I guarantee all operations happen atomically? How do I handle nested scopes (reuse vs rollback)? How do I ensure events are only published once? How do I protect against duplicate commits when retries happen? The solution is a Unit of Work (UoW) system — a design pattern that wraps all your persistence operations in a clear, explicit transaction boundary. ...

September 26, 2025 · 5 min · Frederico Gago
Ilustração de reconciliação de dados

Reconciliação Automática de Contribuições (ERP ↔ Portal) com Python

Resumo: Como automatizei a reconciliação mensal de contribuições entre um ERP e um portal externo. Mostro padrões reutilizáveis: bounded concurrency, retry com backoff + jitter, tolerância monetária, bucketização por período+taxa e upsert idempotente de divergências — usando value objects (YearMonth, Money) e ports (interfaces). Sem expor integrações reais: o foco é a arquitetura e as ideias reutilizáveis. ⚙️ Contexto & Problema Em RH, após o processamento salarial (até dia 10 em PT), é enviado o mapa de contribuições do mês anterior para o portal oficial. Se ocorrerem alterações após o envio (ajustes, faltas, prémios, correções), é fácil esquecer o reenvio do mapa corrigido — gerando inconsistências com risco regulatório e retrabalho. ...

September 11, 2025 · 5 min · Frederico Gago