datahike

Casey 2024-06-06T15:41:56.933419Z

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)

Casey 2024-06-09T07:20:47.328189Z

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?

timo 2024-06-10T07:14:20.217539Z

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.

timo 2024-06-10T07:19:07.637169Z

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?

whilo 2024-06-13T23:46:58.190509Z

It would be very cool if the pod would have these fixes. In general it should behave the same as the JVM version.

whilo 2024-06-14T05:45:32.206129Z

@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...

timo 2024-06-14T06:37:12.605079Z

LMS, I started this somewhere

Casey 2025-03-11T14:40:11.626959Z

@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?

Casey 2025-03-11T14:40:29.033679Z

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

whilo 2025-03-14T17:34:02.983639Z

@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.

👍 1
whilo 2025-03-14T17:34:16.436409Z

Not sure whether we need to do anything special to do so.

Casey 2025-03-14T17:54:45.818379Z

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?

whilo 2025-03-14T19:15:36.786739Z

This is not borkdude's fault.

whilo 2024-06-08T01:22:46.862999Z

@timok has done work on this. What is your take? Being able to only pass one data source to d/q is indeed limiting.

whilo 2024-06-08T01:30:26.806699Z

@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.

Casey 2024-06-16T07:37:02.176589Z

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

Casey 2024-06-16T07:37:22.073649Z

But d/q should support an arbitrary number of args