Replies: 1 comment 1 reply
|
I think the sxql I agree that Mito would benefit from some higher-level query functions (such as my 2c. Thanks for posting, I appreciate reading other people's approach on Mito. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have been exploring how mito handles relationships between tables because Mito doesn’t add foreign key constraints for refering tables. This is fine, it is done at the CLOS level and makes sense once you wrap your head around it. However, using RELATIONSHIP examples here and here:
Link 1: https://github.com/fukamachi/mito
Link2: https://lisp-journey.gitlab.io/blog/models-and-databases-mito-sxql/
... after we create the user and tweet tables, insert a few tweet entries using the user variable, we can only ever retrieve the first tweet using the following sample code: (mito:find-dao 'tweet :user user)
To replicate we are using the example from Link2 above:
Note: We now have 4 tweets in the tweet table, user_id is 1 and status is "hello there.". We should now be able to query the db and list all the tweets using different approaches.
And we only get one result instead of 4:
We can also do something like this using sxql:
QUESTION: Why does (mito:find-dao 'tweet :user user) return only the first tweet? I expected that to return all tweets by user, what is going on here and what might be the canonical way to just user the CLOS object bound to user to look up all tweets by that user as that seems nicer than the sxql approach?
All reactions