News for hackers. Stuff that matters.
Re:Meet Korma, a SQL DSL for Clojure by jwr on Wednesday November 02, 2011 @04:21PM (#3188753)
I think writing DSLs for SQL makes little sense.

SQL is already a declarative query DSL, why not just use it? Putting another declarative layer on top buys you little (syntactic sugar for most libraries, this one additionally seems to deal with one-to-many relations, and I hope that support is read-write, not just read-only) — and isolates you from the database below.

In every serious application I've worked on there was a need to use something which the DSL did not support. So why do it at all?

Re:Meet Korma, a SQL DSL for Clojure by technomancy on Wednesday November 02, 2011 @04:33PM (#3188806)
Raw SQL is not very composable, while Korma emphasizes composability on the second paragraph of the page.
Re:Meet Korma, a SQL DSL for Clojure by hosh on Wednesday November 02, 2011 @05:18PM (#3188977)
And composability lets you create business DSLs and macros on top of that. I've used this to good effect with Rails' Arel, but since it is still Ruby, you can't go as far unless you're willing to parse the Ruby into something more legible, like S-expressions.
Re:Meet Korma, a SQL DSL for Clojure by its2010already on Wednesday November 02, 2011 @04:37PM (#3188826)
It does make sense to be able to define business/application logic as reusable query components.

For example, if your PERSON entity has TITLE, FIRST_NAME and LAST_NAME fields, that little bit of logic that concatenates them together in the right way to form a full name is something that is useful to define. Likewise, setting up a join of tables that is used many times in your application is something that Korma will let you do.

Even though these components may be implementable on the database side (as user defined functions or views), it may not always be possible (or desirable) to do that way.

Re:Meet Korma, a SQL DSL for Clojure by pradocchia on Wednesday November 02, 2011 @10:08PM (#3189864)
I spend much of my time in the database, legacy and greenfield, and I would love a better DSL than SQL, something that ran directly in the database itself and targeted the planner/optimizer rather than just emitting more SQL. I would like to be able to pass a WHERE clause to a function, or a SELECT statement to a procedure, not just simple ints, or strings to be exec'd.
Re:Meet Korma, a SQL DSL for Clojure by groovy2shoes on Wednesday November 02, 2011 @04:28PM (#3188790)
In this case, an embedded DSL brings all the goodies of Lisp's code-as-data to SQL.