06:54 abraxxa joined 06:59 abraxxa left 07:00 abraxxa joined 10:51 patrickb joined 12:04 abraxxa left 12:06 abraxxa joined
patrickb o/ 12:07
Are there any plans to support literal SQL in queries? (So that I provide some SELECT statement that returns one or many table rows and then have Red automatically map the result to objects and hand me those?) 12:09
12:11 abraxxa left
SmokeMachine it already support literal SQL, but it do not convert it to anything... 12:11
patrickb: ^^
12:12 abraxxa joined
SmokeMachine you can always do `red-do { .execute: "SELECT 1" }` (if you are using `red-defaults`) or `$*RED-DB.execute: "select 1"` (if you are defining `$*RED-DB`) 12:13
patrickb is that documented
Thanks :-)
SmokeMachine no sure... :(
patrickb: that's not the best way of documenting it, but you can run this on the driver object: fco.github.io/Red/api/Red/Driver 12:21
you can also hand create an AST tree and send it to the driver as well to make it translatable to any driver you want... 12:40
(by AST I mean Red::AST and not RakuAST (yet))
patrickb Understood. Thanks for explaining. I'm mostly interested in writing DB dependent SQL though. (And still be able to benefit of the OR-Mapping, that Red does.) Does something like this fit into the broader Red vision in general? 13:40
SmokeMachine I’ve been thinking on a generic model for custom queries… but i think I’m still far from that… 13:44
patrickb OK. 13:47
SmokeMachine I have to do at least this (github.com/FCO/Red/issues/470) before that
patrickb: Could you give me an example of query you’d like to run? Please? 13:49
patrickb gist.github.com/patrickbkr/0822bb6...ea1ef7ccab 13:56
I reformatted it a bit, but otherwise directly copied out of a production codebase 13:57
Basic idea: There is a major and minor version column. I'd like the row with the latest version of a specific type. 13:59
There is also a no-subselect variant, but I find it quite a bit harder to understand, so I went with the subselect variant. 14:00
SmokeMachine Have your tried doing that with Red? 14:09
patrickb Not yet, I have to admit. 14:11
Apart from this specific case I'd enjoy being able to just write plain SQL in situations where the SQL turns out simpler or the knowledge of the Red DSL is lacking and I (or a team mate) is faster in putting some SQL together than working out the corresponding Red DSL fragment. 14:16
In my experience that's typically the case when doing data analysis tasks.
I have to leave for a bit, but will backlog. Thanks for your interest so far! 14:17
SmokeMachine fernando@Fernandos-MBP-2  ~/Red   master  raku -I. -MRed -e ' 14:30
model ModuleVersion { ... }
model Module is table<my_module> {
has $.id is id;
has $.name is column;
14:30 SmokeMachine left, SmokeMachine joined
SmokeMachine patrickb: does that make sense? ^^ 14:31
the query (the internal one) would be only this: `.say for ModuleVersion.^all.grep(*.module."{ get-db-column-name }"() == 1).sort({ -.major, -.minor })` 14:32
patrickb: I've forgotten the limit 1: www.irccloud.com/pastebin/zhpmmRlT/ 14:35
(the first one I've clicked on the wrong button, sorry) 14:36
16:43 ChanServ sets mode: +o SmokeMachine
SmokeMachine Red ORM for the Raku language - #red logs are going to be saved on logs.liz.nl, and later logs.raku.org 16:44
16:46 SmokeMachine sets mode: -o SmokeMachine
patrickb SmokeMachine: Looks good. Thanks! 17:04
17:04 patrickb left 17:09 patrickb joined 17:24 SmokeMachine left 17:25 SmokeMachine joined 20:06 patrickb left 20:18 japhb left 20:20 japhb joined 21:40 abraxxa left 21:44 abraxxa joined