News for hackers. Stuff that matters.
Re:Write an SQL query builder in 150 lines of Python by jamamp on Friday August 27, 2021 @11:17AM (#28328932)
I work for an enterprise in-house web application, where over time we have a ton of tables, like over several hundred unfortunately. Writing queries for each any every table and manually mapping those to objects sounds exhausting. EntityFramework helps a lot with that, for CRUD operations.

Additionally, I think unit testing would benefit from an ORM as well. Instead of calling an actual database, you can easily have an in-memory database with an ORM with mocked data. Though, I suppose that is technically possibly with straight SQL queries as well, but I imagine it's easier with an ORM.

Re:Write an SQL query builder in 150 lines of Python by furstenheim on Friday August 27, 2021 @11:56AM (#28329407)
The main problem with in memory databases is that they are not the same database. I've had several issues which I had to find a fix that worked on one database and was legal syntax on the other. Say maybe one database allows force index but in memory does not.

I've even seen one database layer for in memory and a completely different one for real database. That means that your unit tests are not really testing your production code

Re:Write an SQL query builder in 150 lines of Python by zaybqp on Friday August 27, 2021 @12:50PM (#28330095)
You can also make the same argument about ORM's mock DB layer.
Re:Write an SQL query builder in 150 lines of Python by zaybqp on Friday August 27, 2021 @12:48PM (#28330065)
How would it be easier with ORM when switching to in-memory database for standard SQL is just changing connection string?