SQL vs. service layers isn’t just a tech squabble—it's where you house business logic. A big thread argues for keeping rules out of SQL to avoid cross-app drift; others warn that central services can bottleneck big data loads [1].
Centralizing logic in SQL — When many apps share a database, duplicating rules across stacks invites drift and coordination headaches [1]. A web service can standardize access, but it can become a bottleneck for large data pushes and raise ownership questions [1]. A materialized view offers performance with embedded logic, yet it requires a database connection and has network constraints [1].
Hybrid and governance trade-offs — A blend aims to please both sides, embedding logic where needed while exposing clean data surfaces [1]. Federated surfaces raise governance questions: who owns, supports, and ensures consistency across sources like Postgres and SQLite [1].
Kvatch: a single SQL surface for APIs and files — Kvatch lets you query REST APIs, CSVs, Google Sheets, Postgres, SQLite, and even Git repositories as one source [2]. It’s open-source, written in Go, with docs on GitHub at kvatch-cli examples showing how to mix API data with code and spreadsheets [2]. Kvatch is early, but it hints at how federated data surfaces can influence governance and speed [2].
References
Why I Keep Business Logic Out of SQL
Discusses centralizing business logic in web services or materialized views versus SQL apps, with trade-offs for performance and governance complexity
View sourceShow HN: Kvatch – query APIs, CSVs, Google Sheets, and databases as one source
Federates APIs, files, and databases into one SQL queryable source with examples and open-source tooling, and feedback from developers worldwide.
View source