replikativ/datahike

[Bug]: historical database records can not be accessed via keywords

Closed this issue · 0 comments

What version of Datahike are you using?

0.4.1480

What version of Java are you using?

openjdk version "11.0.13" 2021-10-19

What operating system are you using?

Ubuntu 20.04.3 LTS

What database EDN configuration are you using?

any with keep-history? set to true

Describe the bug

When interacting with any historical database record HistoricalDB, AsOfDB, SinceDB, one cannot access any attributes using keywords.

What is the expected behaviour?

Access the db record attributes without any exceptions.

How can the behaviour be reproduced?

(require '[datahike.api :as d])

(def cfg {:store              {:backend :mem
                               :id      "DEV"}
          :keep-history?      true
          :schema-flexibility :read})

(do
  (d/delete-database cfg)
  (d/create-database cfg))

(def conn (d/connect cfg))

(d/transact conn [{:name "Alice"}
                  {:name "Bob"}])

(d/transact conn [{:name "Charlie"}])

(let [db (d/as-of @conn (inc datahike.constants/tx0))]
  (:origin-db db))
;; => Execution error (UnsupportedOperationException) at datahike.db.AsOfDB/getLookupThunk (db.cljc:563).
;;    getLookupThunk is not supported on AsOfDB