DEV Community

Discussion on: ORMs, Lazy Loading and Web Applications

Collapse
 
engineercoding profile image
Wesley Ameling

I once had to rewrite the fetch queries in Django's ORM to prefetch all its 'child tables' (read tables with a foreign key or a many to many relation to the table in question). While the syntax is not difficult it felt like hardcoding which renders the ORM not really capable to do it properly. I get that one does not always need to prefetch, but a more abstract way such as passing a class would have been a lot better. This latter is still a form of hardcoding, yet makes the code more readable.