Nice, looks promising. How does this compare to drizzle? Context: We've had a lot of ORM frameworks come and go in node.js - sequelize, typeorm etc, but none of them have really caught on. Things have been changing a lot lately after typescript took over, so we've seen a bunch of ORMs take off that give you a really good typescript experience. So, the juggernaut in this space is of course prisma, which is super expre…
Show HN: Node.js ORM to query SQL database through an array-like API
61–70 of 108 posts
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#62Nice, looks promising. How does this compare to drizzle? Context: We've had a lot of ORM frameworks come and go in node.js - sequelize, typeorm etc, but none of them have really caught on. Things have been changing a lot lately after typescript took over, so we've seen a bunch of ORMs take off that give you a really good typescript experience. So, the juggernaut in this space is of course prisma, which is super expre…
Hmm. I might be wrong as I haven't used Drizzle, just read the docs, but isn't Drizzle just like Prisma? That's really not the same as this. I find Prisma at least one of the most terrible things I ever worked with in my life ; the rigidity (which I guess is the arrogance of the devs which they call opinionated; their right but he), the weird querying dsl, the terrible tooling. Just checked 'Drizzle queries' again an…
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#63Nice, looks promising. How does this compare to drizzle? Context: We've had a lot of ORM frameworks come and go in node.js - sequelize, typeorm etc, but none of them have really caught on. Things have been changing a lot lately after typescript took over, so we've seen a bunch of ORMs take off that give you a really good typescript experience. So, the juggernaut in this space is of course prisma, which is super expre…
Hmm. I might be wrong as I haven't used Drizzle, just read the docs, but isn't Drizzle just like Prisma? That's really not the same as this. I find Prisma at least one of the most terrible things I ever worked with in my life ; the rigidity (which I guess is the arrogance of the devs which they call opinionated; their right but he), the weird querying dsl, the terrible tooling. Just checked 'Drizzle queries' again an…
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#64I've come to the conclusion that ORMs are good for simple queries like User.find_by(email: "john@snow.com"), but once you get beyond that you are better off just writing sql.
I agree, classic ORMs usually don't play well with complex queries. I think Qustar is closer to a query builder than ORM tbh. You can compose arbitrary queries using it.
We've (I was the original author, bias alert) always had a policy of "if you can't convince it to produce the exact same query that you'd've written by hand, that's either a bug or a missing feature."
Some of said features do still remain missing, because of course they do, but the attitude is hugely important nevertheless.
You're doing an awesome thing here, and ... I've been considering trying to write a better ROM for JS on and off for a while, and though I may still do so anyway, assuming my sieve-like brain doesn't forget about qustar first I think I should really talk to you about whether we can work together instead before I strike out on my own.
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#65Pretty cool! The only thing I didn't like in the examples were things like .eq and .add, which are kind of a DSL, so it takes away from the "just plain JS" approach. But I assume it's because JS doesn't allow operator overloading?
Yep, I would love to use plain "==" and "+", but JS doesn't support it.
https://p3rl.org/DBIx::Perlish does it pretty nicely, but only because instead of using operator overloading the author lets the query code compile as a lambda and then pulls apart the perl5 VM opcodes and translates -those- into a query, which is ... awesome in its own way but not something you'd want to try and reproduce.
Interestingly, Scala actually turns 'x + y' into 'x.+(y)' and you could maybe get somewhere with that style.
For javascript, you'd probably need instead to provide a Babel transform and rely on the fact that like 90%+ of javascript projects are already 'compile to javascript' code except that the source is also sort of javascript.
My plan instead is to have an API much like yours (... or possibly just (ab)use yours, see my other comment ...) and then a format string based DSL for nicer querying.
... now that I think about it, making the DSL I have in mind work with qustar might be a good "dual implementations keep you honest" thing, but I have a lot of yaks to shave before that becomes relevant, so please nobody hold your breath.
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#66Very cool. Reminds me of linq to sql
Yes, as an efcore fan, I often wish that we had better ORM in my company's node projects. Sequelize seriously drives me insane
I'm not sold on ORMs. They make the easy queries slightly easier, and have no solution more complex queries. Not worth the learning-curve (life times, caching, dirty state, associations, cascading, mapping, etc)
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#67Pretty cool! The only thing I didn't like in the examples were things like .eq and .add, which are kind of a DSL, so it takes away from the "just plain JS" approach. But I assume it's because JS doesn't allow operator overloading?
Yep, I would love to use plain "==" and "+", but JS doesn't support it.
It won’t be perfect but maybe you can do something useful with it. Symbols in general are a really powerful tool that almost enable meta-programming in JS. I searched “Symbol” in your repository and didn’t see any results, so if you aren’t familiar with them, I recommend taking the time to read up on how you can use them.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
And this 2015 blog: https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols...
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#68why is codegen bad?
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#69An intriguing idea! I like this approach for being an innovative interface to SQL. I wonder if it would reduce cognitive load when interfacing with the DB. I'm a game dev and often need to avoid situations where I'm using '.map' to iterate an entire array, for performance reasons. It would feel odd to use the concept, knowing it wasn't really iterating and/or was using an index. Is that how it works?
It’s exactly what Entity Framework does in dotnet. It allows you to query the database like it’s an enumerable. In fact, in EF, an IQueryable (which is the interface you use to query a SQL dataset) implements IEnumerable. So you can 100% manipulate your dataset like a normal array/list. Sure it comes with its own shenanigans but 90% of the time it’s easy to read and to manipulate.
Re: Show HN: Node.js ORM to query SQL database through an array-like API
#70Now that we have about 15 years of ORMs, do they really make things easier? SQL is not a difficult language to learn, and views and stored procedures provide a stable interface that decouples the underlying table schema, allowing for migrations and refactoring of the database structure without having to rewrite a lot of code. ORMs seem to me to be mostly about syntactic sugar nowadays; I’m worried that the abstractio…
Every time you switch languages, or stay in the same language for 2 years, you have to learn another ORM. SQL is about as close as timeless gets in this business.