Mapping alternatives
The problem with mixing Python and SQL is that there can be an impetus toward something that we might call the All Singing, All Dancing, All SQL solution. The idea here is that the relational database is somehow the ideal platform and Python corrupts this by injecting needless object-oriented features.
The all-SQL, object-free design strategy is sometimes justified as being more appropriate for certain kinds of problems. Specifically, the proponents will point out summarizing large sets of data using the SQL GROUP BY clause as an ideal use for SQL.
This kind of processing is implemented very effectively by Python's defaultdict and Counter. The Python version is often so effective that a small Python program querying lots ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access