honeysql

oyakushev 2024-10-11T09:03:57.497369Z

Hello! I've tried updating to the latest version of HoneySQL in Metabase and it appears that this commit https://github.com/seancorfield/honeysql/commit/a3ef21548520636168a970d780ff46a4be4fa002 breaks one of our tests. Metabase uses URL encoding to escape non-ASCII table names, so after the encoding the name may start with %. The linked commit replaced calling format-entity on the ddl names with format-var , and the latter treats the leading % as a function call.

(honey.sql/format {:create-table (java.net.URLEncoder/encode "привіт")})
=> ["CREATE TABLE D0%BF%D1%80%D0%B8%D0%B2%D1%96%D1%82()"]
;; The above is a malformed SQL.
I would change it in Metabase to ensure the slug never starts with % but doing so would be a breaking change to the users who already have DBs generated with the current encoding scheme. I'm willing to fix this myself but I need guidance what is the best way to fix this in HoneySQL.

oyakushev 2024-10-11T09:15:05.106579Z

Submitted an issue.

seancorfield 2024-10-11T16:15:49.518569Z

I believe this is fixed in the latest 2.6.9999-SNAPSHOT (a187ba98f129e263671da65da8b4ac22f08d70f4) so could folks try that version and make sure it doesn't break anything else? This was a regression introduced in https://github.com/seancorfield/honeysql/issues/526 when trying to fix as-is DDL with strings.

oyakushev 2024-10-22T10:58:26.003539Z

May I ask for a release that would include this fix, please?

seancorfield 2024-10-22T18:32:46.255249Z

Done. 2.6.1203. Should be up on Clojars in a few minutes.

oyakushev 2024-10-22T18:53:30.278079Z

Much appreciated!

oyakushev 2024-10-12T09:41:26.330139Z

Thank you for the quick fix! Indeed, the snapshot version passes all of the tests.

👍🏻 1
2024-10-11T09:14:40.896719Z

2024-10-12T12:04:19.977369Z