Hello. Does anybody know how to add a "for update nowait" clause in Korma? The closest thing I found is korma.core/modifier
, but it adds the clause to the beginning of the query:)
I'm surprised korma is still being used. Last time I heard about it was maybe 7-8 years ago!
Yep, it's not great, but IMHO if it is used as a simple DSL (and if all the inputs are sanitized 🙂) does the job well
HoneySQL V2 supports that (and is a much more complete DSL than Korma).
Does anybody know of a Clojure SQL library that automatically transforms SQL results into tree-like structures (ideally via foreign keys, etc)? I feel like a saw a library like that, but I can’t remember the name.
I've had a few requests over the years for adding such functionality to the various SQL-related libs I maintain so if you find anything, I'd be very interested.
Perhaps this (but I think it was a different library that I saw): https://github.com/metabase/toucan
The closest in c.j.j / next.jdbc
is the datafy
/`nav` support that lets you lazily traverse the DB via FK relationships (but they are defined by convention or in data -- not derived from the DB metadata).
Toucan feels very OOP/ORM-y to me...
Yeah… you need to define your model… And this whole “hydration” talk 🙂 But I haven’t gone through it carefully, just now seeing it for the first time.
Perhaps datafy/nav is good enough… I gotta give it a shot. Thanks @seancorfield 🙂
So it let’s you retrieve a map-in-map-etc based on foreign-keys, as I understand
You can have something like:
{:order-id 1
:name "X"
:address {:street "123 Main"
:zip "99999"
:city "XYZ"}}
… from two tables, let’s say “orders” and “addresses” where :address is a foreign key in the “orders” table, pointing to “addresses” table?I don't understand what you're asking, sorry.
My bad, it’s not a clear example. I’ll explore further.
I used to enjoy https://github.com/paper-trail-gem/paper_trail in my Rails years.
Versioning/auditing is a big reason why Datomic, ES/CQRS, etc have traction. paper_trail
gives one something equivalent while still having the benefits of SQL (I particularly like its leanness).
Anyone has attempted to code an paper_trail equivalent in :clj: ?
Thanks, but unfortunately migrating to HoneySQL is not an option... I ended up writing a parametrised sql query and executing it via korma...