Fork me on GitHub
#datomic
<
2018-07-18
>
fdserr01:07:44

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.

marshall13:07:05

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

fdserr02:07:20

Indeed, with proper env set.

fdserr02:07:51

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

marshall12:07:58

you can definitely install and use txn functions on a running transactor without a restart

fdserr00:07:03

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

marshall17:07:49

transaction functions are not classpath functions

marshall17:07:25

you can use a classpath function as a txn function

marshall17:07:36

but you can also install a “regular old” transaction function (not as a classpath fn)

ignorabilis07:07:56

Cloud queries: any way to use :limit to get the newest instead of the oldest values?

oscar08:07:50

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.

ignorabilis07:07:39

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?

marshall13:07:59

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

marshall13:07:00

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

marshall13:07:18

just noticed you didnt quote your pull expr

marshall13:07:54

oh. interesting. it may not work with false

marshall13:07:22

looking into it

ignorabilis15:07:11

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

kirill.salykin07:07:14

Hi all, for datomic in prem how one filter based on LocalDate? Because seems like datomic uses old java Date.

eoliphant11:07:06

That's correct. Datomic uses clojure #insts, which are java Dates. Just convert as necessary

kirill.salykin11:07:07

Makes sense, thanks. Would be nice to have all new java date time things tho

ignorabilis15:07:04

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?

ignorabilis15:07:21

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

val_waeselynck15:07:25

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

ignorabilis15:07:23

@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

ignorabilis15:07:19

So in an ideal world part of the query would be (:my/entity :limit 50 :ascending false); of course :ascending is pseudo code

val_waeselynck15:07:48

@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

ignorabilis15:07:10

but we want :ascending false; also could you please elaborate on dichotomy algorithm?

val_waeselynck15:07:25

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.

val_waeselynck15:07:57

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.

val_waeselynck15:07:06

until you get to 50

favila15:07:04

or maybe another attribute for indexing

👍 4
val_waeselynck15:07:05

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

favila15:07:52

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

favila15:07:13

that would give you a cheaper "newest stuff" index

val_waeselynck15:07:17

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

favila15:07:59

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

val_waeselynck15:07:33

or a compound index

ignorabilis15:07:43

ok, thanks, we'll try the attribute for indexing

johnj22:07:14

Using the free transactor, a simple write takes ~15ms on average, is this normal? (in a single machine)

eraad22:07:30

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?

eraad22:07:21

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.