News for hackers. Stuff that matters.
Re:12 requests per second: A realistic look at Python web fr... by zem on Thursday February 18, 2021 @11:39PM (#26189825)
for me the value of an ORM is not so much query synthesis as serialisation of object fields to db columns and vice versa
Re:12 requests per second: A realistic look at Python web fr... by jtolmar on Friday February 19, 2021 @01:07AM (#26190256)
Same here.

I'd love to have a tool that just generates an object type for a given SQL query's result rows, and a function signature for its query parameters.

Re:12 requests per second: A realistic look at Python web fr... by reader_mode on Friday February 19, 2021 @01:29AM (#26190354)
F# has this + static SQL query string checking at compile time using type providers
Re:12 requests per second: A realistic look at Python web fr... by PeterisP on Friday February 19, 2021 @09:49AM (#26193710)
"just generates an object type for a given SQL query's result rows"

For a similar purpose in Python I generally use psycopg with namedtuple resultsets; the namedtuple 'records' do what I need for the returned data and are reasonably efficient.

Re:12 requests per second: A realistic look at Python web fr... by aabbcc1241 on Sunday February 21, 2021 @01:18AM (#26211288)
Just hack that for Typescript over this weekend (: https://news.ycombinator.com/item?id=26211286
Re:12 requests per second: A realistic look at Python web fr... by jtolmar on Monday February 22, 2021 @12:36PM (#26227393)
Wow, that was fast! I'm impressed.

If you want to keep going forward with it, I'd recommend working on making it clearer what the examples do, and looking at sqlc for Go for inspiration. Of the existing versions of this people replied with, that one had the clearest API, or at least clearest explanation on its landing page.

Re:12 requests per second: A realistic look at Python web fr... by grosskur on Friday February 19, 2021 @02:17AM (#26190553)
sqlc can do this: https://sqlc.dev/
Re:12 requests per second: A realistic look at Python web fr... by jtolmar on Monday February 22, 2021 @12:32PM (#26227321)
This is the nicest one of these from the ones posted, I think it's the model to copy.
Re:12 requests per second: A realistic look at Python web fr... by branko_d on Friday February 19, 2021 @01:14AM (#26190289)
This!

We don't need ORM, we need OQM (object-query mapping)!

Re:12 requests per second: A realistic look at Python web fr... by jtdev on Friday February 19, 2021 @08:49AM (#26193088)
That’s a huge dependency to take on just for mapping and serializing, something that most languages provide in a standard library or base functionality of the language itself.