By Peter Bell

A DSL for SQL

Written in Ruby, but looks interesting. Will have to compare to Mark Mandells TQL (part of Transfer) and Doug Hughes' query object API and see what I can learn . . .

Comments
I don't know if it's because I'm so used to SQL or what, but abstractions like that never really appealed to me. It's not saving (m)any keystrokes, it doesn't appear to be abstracting much of anything, and I find it harder to read and understand than plain SQL (now, that is just looking at the examples he posted).

I find things like active record to be much more useful at abstracting away the SQL. And if I need to drop down into it, I think I'd rather just write "select col1,col2,col3 from table" instead of select(table, col1, col2,col3) ... or anything similar.

But, that's just me. I haven't looked at TQL, so I can't comment there =).
# Posted By Sam | 3/19/07 12:42 PM
A SQL DSL should do one or two things.

At a minimum it should be dialect independent, so you knw it'll work MSSQL, MySQL, PostGres, etc. wich can be nice.

Optionally it'll be OO, so like in TQL you can describe "joins" based on object relationships without having to worry about things like joining tables.

Although with all of these it is still the (all too common) edge cases that kill you - properties in the joining tables, needing dialect specific functions for performance reasons, etc.
# Posted By Peter Bell | 3/19/07 12:51 PM
Well, you mention two very valid uses =) ... I was speaking specifically to the examples I saw in the link.

I try not to use too many vendor specific things, but you are right, it would be nice to have a layer of abstraction that worked with many vendors... Unfortunately, the examples I looked at in that link all seemed to be things that are very well defined and implemented as standard in every relational DBMS I've used (which, only amounts to a handful, but still).

Things like soundsLike(word) or rhymesWith(word) or "select top 100" vs. "where rownum < 100" vs "limit 100" to choose something common.
# Posted By Sam | 3/19/07 1:04 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.