Closed vaeng closed 5 months ago
As it is not working yet, we can still change it to whatever we like it to be :)
Here's an example solution:
https://gist.github.com/Steffan153/89135660eadb6286b3e8f4b5f821d177
Also, the tests didn't account for different order of keys, so you might need something like this:
UPDATE tests
SET status = 'pass'
FROM (SELECT database, url, payload, result FROM 'rest-api') AS actual
WHERE (actual.database, actual.url, actual.payload) = (tests.database, tests.url, tests.payload)
AND (SELECT COUNT(*) FROM json_tree(actual.result) as a, json_tree(tests.expected) as b WHERE (a.fullkey, a.atom) IS (b.fullkey, b.atom)) =
(SELECT COUNT(*) FROM json_tree(tests.expected))
AND (SELECT COUNT(*) FROM json_tree(tests.expected)) = (SELECT COUNT(*) FROM json_tree(actual.result));
@Steffan153 I think this fails as the version we aim for does not support the ->> syntax
The online test runner supports it, it's just the CI that's outdated. Maybe switch the action to Alpine? Ubuntu seems to be outdated
Or I can switch to not using the opreators, it's not a problem. It's just cleaner this way.
The online test runner supports it, it's just the CI that's outdated. Maybe switch the action to Alpine? Ubuntu seems to be outdated
Or I can switch to not using the opreators, it's not a problem. It's just cleaner this way.
I like the cleaner version, but I would rather stick with a working older version.
Here we discussed the version question. Unless you have good arguments for a new version, we might have to downgrade alpine to fit that approach: https://github.com/exercism/sqlite/issues/32
Welp, that's too bad. I've updated the gist to use json_extract
.
Welp, that's too bad. I've updated the gist to use
json_extract
.
I can't see your new commit yet
I updated the gist: https://gist.github.com/Steffan153/89135660eadb6286b3e8f4b5f821d177
(I don't have write access for a commit)
json with sqlite is hard. I have started this a while ago and have done a lot of different things in between. I have to confess, that I do not have a clean way to progress this exercise solution. The rest of the files is fine.
Does anyone want to write a solution and add their credit to the config.json file?