Fork me on GitHub

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


Indeed, with proper env set.


I can use the fns, but I’d be keen to be able to hot deploy updates. Thanks.


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


transaction functions are not classpath functions


you can use a classpath function as a txn function


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.


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?


where in the docs is that example? I believe that might be a syntax issue


=> (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?


just noticed you didnt quote your pull expr


oh. interesting. it may not work with false


looking into it


0.8.56 is the client; I'm not sure about the version of Datomic, but we updated somewhere after the release of ions


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

Joe Lane15:07:04

Why do you want that? Are you sure you need it?

Joe Lane15:07:50

Also, when you say sorted by time when being transacted do you mean being queried?


We have some values that get added over time; we want to get from the db only the latest N values


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


or maybe another attribute for indexing

👍 4

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


you could separately store an indexed long which is the date in milliseconds negated


that would give you a cheaper "newest stuff" index


the thing is, you also have to restrict the search to the owning entity


d/index-seek before (or at the top of) a query


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)


Hi! One of my co-workers is thinking about setting up a “long running” Datomic Ion as a Kafka client to process real time events. I see there are a lot of loose ends (how to start it, monitor it, stop it, etc.). Any feedback?


It would be cool if Datomic had an Ion configuration option (similar to Lambda and API GTW) called Kafka, so Datomic can manage the long-running process for you.