3 ms·
SQL was built to do this type of operation. It's generally a better pattern to fetch the data you need, rather than fetch all the data and then to transform it
by marginalia_nu 5y ago
SQL was built to do this type of operation. It's generally a better pattern to fetch the data you need, rather than fetch all the data and then to transform it into what you need in the code.
- deepstack 5y agoand Prologo will be even better and cleaner syntax.
- alexchantavy 5y agoI'm actually working on a similar problem right now so I appreciate your comments. What if the data is already in the Python process so I don't have the ability of doing a `group by` at the database level? Should I perform this functionality in the Python code itself, or should I write to another database table and do the `group by` there? Edit: upon further reflection I think my application is at the tipping point where it needs another database table.
- marginalia_nu 5y agoDepending on your database, perhaps a materialized view is in order?