I'm playing around with the relatively new datahike babashka pod, but it seems to have quite limited functionality, is that by design or will more come later?
Specifically things I tried to use in my initial play session that didn't work were: (d/tempid), (dc/squuid) , and (perhaps the biggest problem) passing more than one argument to (d/q)
Sort of, in that I've used @borkdude 's https://github.com/clj-easy/graal-build-time to build native images of apps before. And whenever I encountered an error I've usually found the solution by searching related issues in borkdude's repos or opening one myself. I don't have much experience setting up builds for pods thought. I guess a pod has to expose a specific interface and we can't just build the entire library with graal?
Hi @ramblurr. You basically build whole datahike as GraalVM build. Would you be interested? I already put some work into it that I could pass on to you.
Can you show how you are passing your arguments to d/q? tempid is not implemented but that's trivial afais. squuid is not in the api ns so I did not bother. What do you need it for?
It would be very cool if the pod would have these fixes. In general it should behave the same as the JVM version.
@timok did you get one pipeline for a build running, e.g. Linux? I am still new to this and need to learn about it...
LMS, I started this somewhere
@timok I'd like to pickup this project again that involved using graal compiled clojure, and I wanted to use datahike as the db. Has there been any changes in the past half year?
To follow up on your question, here is a simple repro: Sample of d/q usage with more than 1 arg:
(d/transact conn [{:name "Alice", :age 20}
{:name "Bob", :age 30}
{:name "Charlie", :age 40}
{:age 15}])
(def db (d/db conn))
(d/q '[:find ?e ?n ?a
:where
[?e :name ?n]
[?e :age ?a]]
db)
;; this works
(d/q '[:find (pull ?e [*])
:in $
:where
[?e :name ?n]]
db)
;; this fails
(d/q '[:find (pull ?e pattern)
:in $ ?name pattern
:where
[?e :name ?name]
]
db "Alice" '[*])
The error is:
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Wrong number of args (3) passed to: datahike.pod/resolve-arg
Data: {:argument-type "", :type "class clojure.lang.ArityException"}
Location: /home/ramblurr/src/clojure-playground/datahike-playground/test.clj:69:1
----- Context ------------------------------------------------------------------
65: [?e :name ?n]]
66: db)
67:
68: ;; this fails
69: (d/q '[:find (pull ?e pattern)
^--- Wrong number of args (3) passed to: datahike.pod/resolve-arg
70: :in $ ?name pattern
71: :where
72: [?e :name ?name]
73: ]
74: db "Alice" '[*])
----- Stack trace --------------------------------------------------------------
babashka.pods.impl/processor - <built-in>
babashka.pods.sci/load-pod/fn--29312 - <built-in>
user - /home/ramblurr/src/clojure-playground/datahike-playground/test.clj:69:1@timok I think this is is probably a problem with the pod implementation of the API hardcoding 3 args for q . I think it would be cool if we could just expand the pod API from our specification as well.
Not sure whether we need to do anything special to do so.
You're right.. https://github.com/replikativ/datahike/blob/1a6ef689b0c6c4239d327ee156647cc5763c91f1/src/datahike/pod.clj#L138-L147 it does look like that function should support varargs. Is this a bug to report to borkdude?
I think there is an apply missing here https://github.com/replikativ/datahike/blob/1a6ef689b0c6c4239d327ee156647cc5763c91f1/src/datahike/pod.clj#L147
This is not borkdude's fault.
@timok has done work on this. What is your take? Being able to only pass one data source to d/q is indeed limiting.
@ramblurr do you happen to have experience with building for different targets? So far we have not found the time yet to build the pod and our native builds for multiple platforms.
I can share more info when I'm back at my desk on Monday but the d/q call was pretty simple for example a common thing is to pass the db arg, some ident and a pull pattern
But d/q should support an arbitrary number of args