Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-11-20 Thread Mark
Hi Carlo - I'm using the 2.0 snapshot. How should I express a join on multiple columns, ie SELECT blah FROM t1 JOIN t2 ON (t1.a=t2.b) AND (t1.c=t2.d) ? On Wednesday, July 3, 2013 1:48:07 AM UTC-7, Carlo wrote: Hey guys! I've been working on a small library to make writing SQL queries a

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-11-20 Thread Carlo Zancanaro
Hi Mark! On Wed, Nov 20, 2013 at 01:11:11PM -0800, Mark wrote: I'm using the 2.0 snapshot. How should I express a join on multiple columns, ie SELECT blah FROM t1 JOIN t2 ON (t1.a=t2.b) AND (t1.c=t2.d) ? Something like this should work: (let [t1 (- (table :t1) (project

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-11-20 Thread Mark
Thanks, Carlo. Even without the documentation, I'm beginning to get the hang of the DSL. I should have guessed that '(and...) would have done the trick. I'd like to put a request in for using a map or a vector of pairs as an alternative since it's easier to construct those. One more

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-09-19 Thread Joel Holdbrooks
This looks really nice Carlo! It'd be even better if it were on GitHub so I could star it :). But I'm definitely going to take a look at this when I'm in the SQL world again. On Wednesday, July 3, 2013 1:48:07 AM UTC-7, Carlo wrote: Hey guys! I've been working on a small library to make

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-09-18 Thread Daniel Neal
Sounds good! I've been having a go with it today in a data-migration thing and I like it. It feels very like clojureql but as you said, it fails earlier with ambiguous queries, which definitely makes debugging easier. One other difference I did notice with clojureql is that in clojureql the

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-09-18 Thread Carlo Zancanaro
On Wed, Sep 18, 2013 at 09:27:22AM -0700, Daniel Neal wrote: One other difference I did notice with clojureql is that in clojureql the database/connection is part of the query definition `(table db :users)`, where as in clojure-sql the database/connection is a separate thing. This seemed

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-09-17 Thread Daniel Neal
This library looks great! I've always liked ClojureQL much more than the other Clojure SQL libraries, exactly for its emphasis on composability and relational algebra. At first looks - your library looks like it will be easier to extend for different database servers... I'd be interested in

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-09-17 Thread Carlo Zancanaro
On Tue, Sep 17, 2013 at 02:28:08AM -0700, Daniel Neal wrote: I'd be interested in knowing some more about your approach compared to that of ClojureQL and the motivation behind it. Sure! The basic difference is that I tried to be a little bit more rigid in how queries must be constructed. I

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread Sean Corfield
On Fri, Jul 5, 2013 at 8:53 PM, Carlo Zancanaro carlozancan...@gmail.com wrote: Is there a reason you don't use the database's table/column name quoting? It means that keywords like :first-name cannot be used as table names without a fair bit of trouble. The DSL in java.jdbc supports

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread r0man
Composing queries is done via compose. Take a look here: https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L16 On Saturday, July 6, 2013 5:46:06 AM UTC+2, Carlo wrote: Hey Roman, The issue that I see with `sqlingvo`, and the thing which I was trying to solve for

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread Carlo Zancanaro
This is a fairly restricted composition, though: (def triangles (compose (select [:color :num_sides] (from :shapes)) (where '(= :num_sides 3 (def green-triangles (compose triangles (where '(= :color green (sql green-triangles) ;=

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread r0man
You can do this with the second argument to the where function. I added an example here: https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L24 On Saturday, July 6, 2013 4:02:23 PM UTC+2, Carlo wrote: This is a fairly restricted composition, though: (def triangles

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread r0man
Hi Carlo, if you'are looking for generating more complex SQL there's also: https://github.com/r0man/sqlingvo Roman. On Wednesday, July 3, 2013 10:48:07 AM UTC+2, Carlo wrote: Hey guys! I've been working on a small library to make writing SQL queries a little bit easier. It's along the

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread Sean Corfield
And there's HoneySQL: https://github.com/jkk/honeysql (that's the one java.jdbc will recommend going forward since I worked with the author, Justin Kramer, on compatibility and direction for java.jdbc and HoneySQL at Clojure/conj last year) On Fri, Jul 5, 2013 at 3:59 AM, r0man

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread Carlo Zancanaro
Hey Roman, The issue that I see with `sqlingvo`, and the thing which I was trying to solve for myself, is that it doesn't compose well. Unless I'm missing something, you have to generate the entire query in the one `sql` form. To me, this is a big restriction and was the number one thing I was

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-05 Thread Carlo Zancanaro
Hey Sean, Most of the points in my reply to Roman also apply to `HoneySQL`. In particular this phrase in the README summarises a good deal of my criticism: When using the vanilla helper functions, new clauses will replace old clauses. You have to go out of your way to get the composability that I

[ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-03 Thread Carlo Zancanaro
Hey guys! I've been working on a small library to make writing SQL queries a little bit easier. It's along the same lines as ClojureQL, but takes a different approach and compiles into quite different SQL in the end. At the moment it's quite immature, but it should be able to support any queries