Red ORM for the Raku language - #red logs are going to be saved on logs.liz.nl, and later logs.raku.org Set by SmokeMachine on 1 June 2021. |
|||
07:05
patrickb joined
|
|||
patrickb | o/ | 07:53 | |
I'm pretty sure Red fails to do "-" -> "_" conversion somewhere in INSERT statement creation on the SQLite backend. Any clues on where to look? | 07:56 | ||
Is that a drivers responsibility? | 07:57 | ||
SmokeMachine | it should be done here: github.com/FCO/Red/blob/master/lib...L.pm6#L172 | 08:00 | |
have you used `my $*RED-DEBUG = True;` to see the generated SQL? | 08:01 | ||
patrickb | yes | ||
SmokeMachine | patrickb: ^^ | ||
would you mind to share the code with that problem. please? | 08:03 | ||
patrickb | nopaste.chaoz-irc.net/view/3c58b1ed | ||
nopaste.chaoz-irc.net/view/8b2e1063 <- that's the table class | 08:04 | ||
all those DB::Stuff thingies are enums | 08:05 | ||
nopaste.chaoz-irc.net/view/d1439ed1 <- that's the full Schema | 08:07 | ||
SmokeMachine | it seems event-top is not being set... | ||
oh! MAIN_BANCH is the enum? | 08:08 | ||
patrickb | also source-retrieval-retries is still set to its default value | ||
SmokeMachine | I mean, is MAIN_BRANCH the enum? | ||
patrickb | project is also an enum, and that is set | 08:09 | |
so my thesis is, it silently ignores attributes with - in them | 08:10 | ||
commit-sha is also missing | |||
SmokeMachine | it seems a deeper problem... it seems it's not understanding enums... (I don't remember of testing enums...) | ||
patrickb | it is well possible enums also don't work, but I'm really sure it also fails to deal with - in attributes | 08:11 | |
commit-sha is a plain string column. It's missing. source-retrieval-retries is a plain Int column, its passed value is ignored and the default value applied | 08:12 | ||
SmokeMachine | I've already had many problems forgetting to do the transformation from kebabcase to snake case on Red's code... I thought it was fixed... but it's possible I've forgot it somewhere else... | ||
what's your Red version? | |||
patrickb | project on the other hand is *not* missing | 08:13 | |
0.1.44 | |||
SmokeMachine | I'll need to investigate that... | 08:14 | |
patrickb | are there any hopes for enums to somehow work? (once the - _ thing is solved?) | 08:15 | |
SmokeMachine | I'll try to fix that as soon as possible... would you mind to open an issue with that, please? | ||
patrickb | will do | ||
SmokeMachine | if you continue trying to find the problem, and you fix that, please PR it | 08:16 | |
patrickb | I'll have another quick look, but won't spend much time on it. I guess you'll be a lot quicker than me in finding the problem. | 08:22 | |
SmokeMachine | thank you! | ||
patrickb | github.com/FCO/Red/issues/487 | 08:23 | |
SmokeMachine | thanks! | 08:24 | |
patrickb | Isn't it possible to specify a column name different from the attribute? `is column<name => 'col-name'> or something like that? | 08:30 | |
SmokeMachine | yes, exactly that | 08:36 | |
patrickb | SmokeMachine: Thanks for your work and caring for the users of Red. This is much appreciated and not taken for granted. | ||
SmokeMachine | :) | ||
patrickb: one example of renaming a column: github.com/FCO/Red/blob/658511fd43...-tdd.t#L93 | 08:49 | ||
patrickb | how can I give a `referencing` a name? | 08:55 | |
SmokeMachine | at the same way, `is referencing(*.id, :model<Bla>)` is just a fancy way of doing a `is column{ :references{ .id }, :model-name<Bla>}` ... for example: github.com/FCO/Red/blob/658511fd43...odel.t#L31 | 09:01 | |
patrickb: ^^ | 09:03 | ||
patrickb | SmokeMachine: I think you were right. It's actually the enums that cause this, not the "-". | 10:20 | |
SmokeMachine | :) and :( at the same time... :) | 10:21 | |
I don't remember testing it with enums... I think I've completely forgot about them... I only thought about creating tables from the enums... but haven't implemented that... | 10:23 | ||
patrickb: github.com/FCO/Red/issues/34 | 10:24 | ||
patrickb | Hm. Couldn't it just do a very thin mapping to Plain ints? | 10:25 | |
SmokeMachine | I think we should support all of those options... (but we could start with the mapping to the enum's value...) | 10:26 | |
what do you think? | 10:27 | ||
for now, you maybe could use custom inflators and deflators for that (while that's not implemented) | 10:28 | ||
patrickb | I suspect that would cover most uses. I guess one typically would want enums to just list alternatives. Especially in the context of a DB. For that case just writing the enum value to the DB is the obvious solution. | 10:29 | |
SmokeMachine | a custom inflator/deflator example: github.com/FCO/Red/blob/658511fd43...akumod#L11 | ||
patrickb | Thanks! I'll have a look. | 10:30 | |
Is it possible to provide inflators / deflators for a type instead of a column? Quite some typing otherwise... | 10:31 | ||
SmokeMachine | It's planed to be possible... currently we have a hardcoded one... github.com/FCO/Red/blob/master/lib...e/Json.pm6 | 10:36 | |
patrickb | So can I implement such a Type class myself and just reference it in `is column{}`? | 10:39 | |
SmokeMachine | I don't think that will be that easy... if I remember well Json was kind special... and I was still trying to find a goodly to generalize that... | 10:41 | |
and Json isn't defined on `is column{}` but on the attribute itself, for example: github.com/FCO/Red/blob/658511fd43...json.t#L15 | 10:42 | ||
(I really need to improve the documentation...) | 10:43 | ||
patrickb: can I ask you a favor? if you learning something you find useful while testing Red, would you mind to write. piece of documentation about that and PR it? My poor English make it too hard to me to write documentation... (if any other person would like to also help me on that, I'd thank a lot) | 10:46 | ||
patrickb | Will see what I can do | 11:05 | |
SmokeMachine | thank you very much! | 11:06 | |
patrickb | I have now added respective inflators and deflators to my schema and the values in the generated SQL are now properly deflated. But the SQL still only includes default values. All values I passed to the Object constructor are still missing in the SQL. | 11:35 | |
This is such an obvious problem that I suspect I'm doing something quite obvious wrong. | |||
SmokeMachine | odd, can I see your code? | 11:36 | |
patrickb | nopaste.linux-dev.org/?1335494 | 11:37 | |
SmokeMachine | ok, that's it! | 11:38 | |
there are 2 options to insert data on database: | |||
1 - `Model.new(:col1<data1>, :col2<data2>).^save` | 11:39 | ||
2 - `Model.^create(:col1<data1>, :col2<data2>)` | |||
patrickb | ouch | ||
SmokeMachine | when you do `Model.new(...).^create` you are calling `Model.^create` without any parameter | 11:40 | |
is it possible that's the problem since the beginning? (sorry for not seeing that before) | 11:41 | ||
patrickb | Is it possible to forbid ^create on a defined object? | ||
well, the inflators and deflators are probably still necessary. | |||
SmokeMachine | yes... I think that's a good idea | ||
would you mind to open a new issue, please? | 11:42 | ||
patrickb | :-) | ||
SmokeMachine | (I mean for forbidding .^create on defined obj) | ||
patrickb | github.com/FCO/Red/issues/488 | 11:44 | |
SmokeMachine | thanks! | ||
for creating/updating/deleting rows, we have a documentation page: fco.github.io/Red/tutorials/start.html | 11:46 | ||
have you already seen this? fco.github.io/Red/ | 11:47 | ||
(almost everything is missing there... but that's a start...) | |||
patrickb | I have read through most of it, yes. | ||
13:09
abraxxa left
|
|||
patrickb | SmokeMachine: github.com/FCO/Red/issues/490 | 19:46 | |
This has haunted me for the last few hours. | |||
SmokeMachine: I suspect it's a rakudo bug, but it makes sense that you have a look first, as I think you can pinpoint better where things go wrong. | 19:48 | ||
SmokeMachine | Have you tried adding `use Red:api<2>` to CITestSetManager.rakumod? | 20:05 | |
Without that the operators are not being override… | 20:06 | ||
patrickb: ^^ | |||
patrickb | Works. Thanks! | 20:08 | |
SmokeMachine | But that error is completely LTA… | ||
patrickb | The failure mode is... suboptimal. | ||
SmokeMachine | Yes, it is | ||
patrickb | Yeah... | ||
SmokeMachine | Would you mind to add that tou tour issue, please? | 20:09 | |
Sorry and thanks for finding all these issues! :) | |||
I really need some help finding and fixing Red issues… | 20:13 | ||
patrickb | Done | 20:33 | |
SmokeMachine | thanks! | 20:49 | |
21:39
patrickb left
|