honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
2018-04-18T02:52:39.000008Z

Hi honey…ers? Is there a way to emit non parametrized sql OR can someone help me understand if its possible for something to read the raw sql in that format produce. I suppose i could wrap the sql like is done here: https://www.postgresql.org/docs/9.1/static/ecpg-dynamic.html This is for a specific i need i have to generate sql statments that can be written to a file then used again. So i’m assuming i need (or at least its easier) to work with

INSERT INTO persons (id, name) VALUES (2523, 'drew') 
Then the version with parametrization:
INSERT INTO persons (id, name) VALUES (2523, ?) "drew"

2018-04-18T02:55:05.000155Z

i think this is an option on format

seancorfield 2018-04-18T02:55:13.000293Z

Does the file have to be actual SQL that can be run? Or can it just be a representation that you could load and do something with later?

seancorfield 2018-04-18T02:55:44.000111Z

HoneySQL produces a data structure so you might be able to just save that as EDN?

2018-04-18T02:57:39.000227Z

@seancorfield One of the goals is to produce something sql stmts that any program (any language) could use. So it can be a representation, but that would probably be a secondary goal to just producing the runnable sql.

2018-04-18T02:59:16.000277Z

I suppose its not hard to read this into a java program and execute it. As you suggest it might be easier as a data structure.

INSERT INTO persons (id, name) VALUES (2523, ?) "drew"

2018-04-18T03:01:26.000045Z

Well, with "INSERT INTO persons (id, name) VALUES (2523, ?)" 'drew' or some way to tell where the arguments start.