Fork me on GitHub
#datahike
<
2021-10-17
>
Jack Park02:10:48

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.

timo13:10:43

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

timo13:10:26

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.

timo14:10:01

Feel free to open a PR for an update :thumbsup:

Jack Park15:10:34

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!

Jack Park00:10:28

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.

kkuehne05:10:27

That’s interesting, I’ll create a bug report for you for that, so I can track that kind of issues with our examples.

timo10:10:10

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

timo10:10:45

what setup are you using? sorry about asking theses things. sometimes it is not clear how proficient people are with the clojure setup.

Jack Park21:10:36

I doubt I am proficient at all. I was using an ITerm and hand entering code in repl opened on the datahike project.

Jack Park21:10:52

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.

Jack Park21:10:34

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.

timo08:10:58

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.