yesql icon indicating copy to clipboard operation
yesql copied to clipboard

Support for multiple queries per file?

Open jsonmurphy opened this issue 5 years ago • 6 comments

From the README and examples it seems (unlike clojure's yesql or even eql) only one query per file is supported. Was this a deliberate choice? or just not implemented as yet?

At the moment this is the only barrier for me to use this library exclusively as i foresee having to create many sql files for even a simple CRUD application with more than one db model/table.

jsonmurphy avatar Jul 25 '18 19:07 jsonmurphy

Hiya. I didn't see any reason to support multiple queries per file, files are free and this allows a simpler parser and less syntax to learn.

I do plan to add support for a compile time string, which allows more flexibility

What's the advantage of a single file? :)

lpil avatar Aug 03 '18 19:08 lpil

Hi! Sorry to comment on an old issue. One benefit of a single file is not to having to add Yesql.defquery for each file. Sometimes you have several small but related queries which makes sense to group into one file. Also having tons of small files means having to jump back and forth between files a lot. Not a huge "problem" of course, but a nice to have for sure.

(Thanks for a great library!)

omh avatar Mar 19 '19 19:03 omh

Hi Ole, thanks for the kind words.

If there was a defquery like function that took a compile time string would using this in a loop be a suitable solution? I'd rather keep the API as simple as possible and let users build abstractions on top if needed.

lpil avatar Mar 19 '19 20:03 lpil

I think that would help, yes, but then again, there's other libraries that support multiple files. If you want to keep it simple that is of course 100% 👍

omh avatar Mar 27 '19 14:03 omh

I just found about ayesql which is very similar to this library but offers more power on compos ability and multiple scripts.

@lpil would it be sensible to close this issue and add a reference to ayesql in the README.md?

chouzar avatar Apr 24 '20 04:04 chouzar

Sounds good!

lpil avatar Apr 24 '20 09:04 lpil