Fork me on GitHub

Hi there! Is it possible to somehow keep the aliases on HoneySQL as qualified keywords? I'm querying a SQL database and I want to make aliases like SUM("person.age") as "people/age". Is it possible for HoneySQL to keep aliases as qualified keywords? Something like {:select [[[:sum :person.age] :people/age]]}, but keeping the alias as-is (currently it is converting to "people"."age")


@mauricio.szabo Which version of HoneySQL? I think this differs between 1.x and 2.x?


I'm using the latest version (2.1.818). I remember that I was able to make it work with 1.x a long time ago, but it was even a different Clojure version so I'm not sure what changed (or even if something changed). I somehow was able to fix by monkey-patching honey/format-entity, but I don't think that's a great solution 😄


Could you create an issue on GH with a small repro case of what you need? There may be a way to make it work but I'll need to spend some time experimenting.


dev=> (sql/format {:select [[[:sum :person.age] "people/age"]]})
["SELECT SUM(person.age) AS \"people/age\""]
In general, using strings for aliases leaves them as-is. Not sure if that helps you?

🤯 1

Oh, and it already quotes! Ok, that works for me 🙂


It is mentioned in the docs but it's probably not very obvious, since it's in a big paragraph about naming and quoting strategies...