sql

All things SQL and JDBC...
orestis 2020-02-13T07:56:16.171100Z

I wonder if HoneySQL users wouldn’t be better off if it didn’t limit its functionality to ANSI SQL. Is anybody these days only using ANSI SQL? Rather than importing extra libraries, wouldn’t it be better to take a “batteries included” approach and bring everything in, then decide which dialect to use based on some configuration?

orestis 2020-02-13T07:57:03.171800Z

(I’m saying this out of pure curiosity and discussion, not suggesting that anyone should do the work)

dharrigan 2020-02-13T09:21:43.172700Z

Personally, I'm quite happy to by default enforce (in a manner of speaking) ansi sql. Keeps things regular. I like that with HoneySQL, if I do have to do something postgresql specific, I can write raw sql if I need to. but I haven't 🙂

dharrigan 2020-02-13T09:22:30.173400Z

Problem, I see, with batteries included is the sheer variation in all the db dialects and the maintainability of honeysql with that going forward.

➕ 3
orestis 2020-02-13T09:54:04.175800Z

I went to HugSQL just to be able to easily copy paste snippets and develop SQL at an SQL repl. Converting all that back to HoneySQL would be a hassle. OTOH, for some things like dynamic columns for an upsert statement etc, I use honeysql.

orestis 2020-02-13T09:54:33.176400Z

Yeah, maintainability is a question. But I’d say the same with having two separate libraries, maintained by two separate entities.

dharrigan 2020-02-13T12:43:44.176800Z

window functions ftw! 🙂

2020-02-13T14:09:43.179100Z

idk. so far I wrote extensions for honeysql once or twice while working with mysql and I'm fine with that. I also understand not wanting to maintain this type of things as it's the same reason I don't want to opensource a mysql-honeysql library with the stuff I wrote: it might be just too specific to what I was using

2020-02-13T14:11:56.180300Z

imo it's already hard enough writing a DSL for a DSL that has a specification. now imagine doing that for all the types of mysql engines out there, all postgresql versions, etc...

seancorfield 2020-02-13T16:28:54.183600Z

One of the big problems with multi-dialect support is that the vendors have incompatible SQL. We've already seen this with SET. There's no single precedence for SET that works for all databases. That's why there's set0 and set1 (in addition to the original sset).

seancorfield 2020-02-13T16:30:32.185400Z

There's already a HoneySQL-PostgreSQL library to extend the generic DSL. That's how dialects should work.

isak 2020-02-13T16:36:28.188900Z

I think if you limit yourself to ANSI SQL, the quality of your SQL can take a nosedive, because stuff like JSON functions are not standard (which are essential for non-trivial UI queries IMO). I think the best solution for ORMs/QueryBuilders is to make a SQL -> DSL converter. I did a similar thing for SQL in .NET, though this was targeting an AST, not a query DSL. so the output is really verbose:

seancorfield 2020-02-13T17:29:38.191Z

@isak No one is suggesting limiting anyone to ANSI SQL. The issue is that HoneySQL has to serve all users, regardless of database choice, and so it opts to support ANSI SQL (and a few non-conflicting extensions) and encourages other libraries to extend HoneySQL with database-specific syntax -- PostgreSQL seems to be the most common set of extensions via https://github.com/nilenso/honeysql-postgres

💯 1
isak 2020-02-13T17:42:39.192800Z

@seancorfield Ok, maybe I misinterpreted, I've just seen many people elsewhere who actually do try to limit themselves to ANSI

seancorfield 2020-02-13T17:48:14.193100Z

I agree that would be a mistake 🙂

seancorfield 2020-02-13T17:50:43.195200Z

We use MySQL (Percona 5.7) heavily at work and we certainly take advantage of MySQL-specific syntax in a lot of places. I test clojure.java.jdbc and next.jdbc against PostgreSQL but I've never used it for anything -- and I will say the vast majority of the support work I have to do on both those libs and HoneySQL is "caused" by PostgreSQL (or should I say by PostgreSQL users 🙂 ).

🙂 1
dharrigan 2020-02-13T17:51:06.195600Z

PostgreSQL FTW 😛

dharrigan 2020-02-13T17:51:33.196Z

I used mariadb too a lot in the past, one of my past places of work were massive mariadb users

dharrigan 2020-02-13T17:51:44.196200Z

tis a nice db 🙂