This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Experimenting in repl with the Datahike file store example https://github.com/replikativ/datahike/blob/development/examples/basic/src/examples/store.clj It returns Execution error (ExceptionInfo) at datahike.db/validate-attr (db.cljc:986). No schema found in db. It properly creates data and meta, and that's as far as it gets. There's a closed issue about this, but it seems clear, at least to me, that it's a non-trivial issue giving the database a schema. The linked store.clj defines a schema but it is not used.
Hi @U0288B00494. You are just going through the examples? I can verify that it is not up-to-date, seems to me. Let me see...
This does the trick. The schema is missing. You could add the schema as :initial-tx
as well to the config. But you can transact it separately like this as well:
(d/transact mem-conn schema)
(d/transact file-conn schema)
...
We know that the examples need some updating.That makes sense! I'll be trying those ideas today. On the surface, it seems obvious to use a transaction to inject a schema. Thanks!
Ran into issues I've not seen before with repl: on that file page in repl, I could require datahike then add all the stuff. Now, if I enter (ns examples.store (:require [datahike.api :as d])) into repl, it gives an error Syntax error (FileNotFoundException) compiling at (datahike/db.cljc:1:1). Could not locate clojure/core/cache/wrapped__init.class, clojure/core/cache/wrapped.clj or clojure/core/cache/wrapped.cljc on classpath. That did not happen before.
That’s interesting, I’ll create a bug report for you for that, so I can track that kind of issues with our examples.
@U0288B00494 how are you using the 'repl'? That seems to me like an error unrelated to Datahike. Are you starting a repl and evaluating the code in your editor?
what setup are you using? sorry about asking theses things. sometimes it is not clear how proficient people are with the clojure setup.
I doubt I am proficient at all. I was using an ITerm and hand entering code in repl opened on the datahike project.
In another matter, I made a branch datahike and modified the example store.clj to add the schema. That's where I was failing in repl,so I simply cloned that code over into my datahike-test project as its own and called it from main and it runs without failure. So, I tried to push the new branch to datahike but, as you might expect, I'm not able to do so. The idea was to issue a PR from that branch.
I started repl in a terminal. But, I also started repl in a vscode terminal on datahike; both fail the same, except that the day before, for reasons I do not understand, I was able to run all the example code in repl with the only error being the issue about a schema.
So I don't know much about VSCode setup because I am using vim with conjure and I can load the namespace of examples.store
just fine. If I may recommend you an excellent youtube video where Sean Corfield shows his VSCode-REPL-development-flow: https://youtu.be/gIoadGfm5T8
If you still see problems then we will investigate that but my suspicion is that your repl flow does not work the way you intend to.