This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-18
Channels
- # aleph (4)
- # beginners (70)
- # cider (66)
- # clara (16)
- # cljdoc (20)
- # cljs-dev (9)
- # cljsrn (2)
- # clojure (36)
- # clojure-ecuador (2)
- # clojure-italy (14)
- # clojure-japan (2)
- # clojure-nl (22)
- # clojure-uk (79)
- # clojurescript (133)
- # clojutre (2)
- # code-reviews (5)
- # cursive (5)
- # data-science (1)
- # datomic (47)
- # duct (2)
- # emacs (1)
- # figwheel-main (3)
- # fulcro (11)
- # funcool (1)
- # graphql (6)
- # hyperfiddle (4)
- # leiningen (4)
- # luminus (9)
- # lumo (8)
- # mount (4)
- # nrepl (2)
- # off-topic (19)
- # onyx (1)
- # re-frame (23)
- # reagent (91)
- # reitit (17)
- # ring-swagger (2)
- # shadow-cljs (43)
- # tools-deps (27)
- # vim (45)
On Prem DB/TX functions: any trick to deploy changes without a Transactor restart (classpath reload)? I’m using ˋd/function` with a single :require
, no closures or multimeths. Many thanks.
is the namespace you’re requiring already on the classpath? If so, you should be able to install the transaction function and then use it without a restart
you can definitely install and use txn functions on a running transactor without a restart
So you mean a running Transactor will grab changes in its classpath without a restart? I’m gonna give it another try... anything specific to be aware of? (option, env...)
but you can also install a “regular old” transaction function (not as a classpath fn)
Cloud queries: any way to use :limit
to get the newest instead of the oldest values?
Datomic doesn't guarantee a return order. Your best bet is to sort the entire set on some criteria (like :db/txInstant
) in an ion. It could be a query-fn or a lambda.
@U0LSQU69Z - thanks a lot!
And again on cloud - (pull ?eid [(:event/inputs :default false)])
does not return false
when there are no records, whereas (pull ?eid [(default :event/inputs false)])
works properly; the first one is in the docs as an example; am I doing something wrong?
=> (d/pull (d/db conn) '[:artist/name (:artist/endYear :default "N/A")] paul-eid)
#:artist{:name "Paul McCartney", :endYear "N/A"}
Seems OK here.
What version of Datomic and client?0.8.56 is the client; I'm not sure about the version of Datomic, but we updated somewhere after the release of ions
thanks 🙂
Hi all, for datomic in prem how one filter based on LocalDate? Because seems like datomic uses old java Date.
That's correct. Datomic uses clojure #insts, which are java Dates. Just convert as necessary
Makes sense, thanks. Would be nice to have all new java date time things tho
Datomic Ions - Is there a way to ensure that data is sorted by time when being transacted? I.e. instead of sorting it by :db/txInstant
over and over again for each query we want to have the default functionality of classic SQL databases, where everything is sorted by time by default
We have some values that get added over time; we want to get from the db only the latest N values
@ivan.yaroslavov btw, I recommend you don't rely on :db/txInstant
and use a custom attribute for that: https://vvvvalvalval.github.io/posts/2017-07-08-Datomic-this-is-not-the-history-youre-looking-for.html
what's more, with a custom attribute, you will be able to use the indexes for that attribute to your advantage, either using comparisons clauses in Datalog or seek-datoms
@val_waeselynck - that is ok, the main concern is that we don't want to constantly be sorting hundreds of values; we have an entity that contains a component entity with cardinality/many
; we just want to get the latest N values in an efficient way
So in an ideal world part of the query would be (:my/entity :limit 50 :ascending false)
; of course :ascending
is pseudo code
@ivan.yaroslavov if the target of the to-many are entities in the same partitions, seek-datoms should sort them in ascending order; you could use some dichotomy algorithm to get the latest
but we want :ascending false
; also could you please elaborate on dichotomy algorithm
?
it's easier to explain with dates; Datomic's index API only give you datoms in ascending order. So if you want the first 50 it's easy, but the latest 50 it's harder. However, you can query for the datoms starting from an exponentially decreasing lower bound date until you get to 50.
E.g give me the datoms from 1 day ago to now; then give me the datoms from 1 day ago to 2 days ago, then from 4 days ago to 2 days ago, etc.
until you get to 50
but you know, if we're just talking about hundreds of ref-typed values, you might as well realize them all in memory, since they will probably be in the same segment anyway
the thing is, you also have to restrict the search to the owning entity
or a compound index
ok, thanks, we'll try the attribute for indexing
Using the free transactor, a simple write takes ~15ms on average, is this normal? (in a single machine)