Fork me on GitHub
#datomic
<
2022-11-11
>
jjttjj00:11:00

Anyone ever get datomic ions/`ion-dev` working from windows? Currently getting this when trying to clojure -A:ion-dev '{:op :push}':

{:command-failed "{:op :push}",
 :causes
 ({:message "Unable to transform path",
   :class   ExceptionInfo,
   :data
   {:home   "C:\\Users\\me",
    :prefix "C:\\Users\\me/.m2/repository", ;; mixing the slashes might be the issue?
    :resolved-coord
    {:mvn/version   "1.0.362",
     :deps/manifest :mvn,
     :paths
     ["C:\\Users\\me\\.m2\\repository\\com\\cognitect\\transit-java\\1.0.362\\transit-java-1.0.362.jar"],
     :dependents    [com.cognitect/transit-clj]}}})}

Casey07:11:54

If I plan to store dates (YYYY-mm-dd) in datomic and query against them often (using < and >), is it better to store them as serialized strings or as instants with the time component set to something like midnight?

Lennart Buit08:11:16

Datomic can compare j.u.Date objects natively. I dont think thats the case for strings

Lennart Buit08:11:51

sadly Datomic doesnt support java.time.LocalDate just yet

Casey08:11:51

:in $ ?reference-date
:where
[?e :my/date ?date]
[(< ?date ?reference-date)]
I know from experience queries like this work for j.u.Dates :db.type/instant, but you think that won't work for :db.type/string?

Lennart Buit08:11:25

You can just try, and apparently I was wrong:

(d/q '{:find  [?e]
       :where [[?e :valid/from ?a]
               [?e :valid/to  ?b]
               [(< ?a ?b)]]}
     [[1 :valid/from "2020-01-01"]
      [1 :valid/to "2022-01-01"]])
=> #{[1]}

Lennart Buit08:11:40

(this vector-of-tuples-datasource only works in peer)

Casey08:11:26

Hm ok, that is good to know, thanks! Back to my original question.. is there a significant perf difference between the two?

Lennart Buit10:11:35

I don’t know the answer to that, sorry

❤️ 1
favila14:11:23

You could do tuples of ints or ints, eg [2020 1 1] or 20200101

favila14:11:12

“Performance” needs context—performance for what

favila14:11:59

I wouldn’t store them as juD with zeroed out time part just because it’s so easy for them to pick up extra precision and drift. You could use an attribute predicate to make sure it stays zero

Linus Ericsson07:11:06

You can also store dates as epoch days.