Fork me on GitHub
#datomic
<
2018-10-08
>
grounded_sage09:10:40

@jarppe I get that. But I’m assuming Ions handles all the Lambda work so you essentially just write Clojure code? I’m not up on all of it. I’m in the front end world

stijn09:10:42

question on ions push: it complains that there is a :local/root dependency and hence you have to specify a uname. However, what if this local dependency is in the same git repo, shouldn't that use the git commit then? (we are migrating to ions, but have to keep the existing API available, so we have introduced multiple deps.edn projects in the same git repo)

unbalanced15:10:11

looking for some advice on data modeling best practices. I'm currently using a compound key to track information but my intuition tells me that this is an anti-pattern

unbalanced15:10:35

Obviously it would be ideal if I could omit the :item/key and have the uniqueness of the datoms be predicated on :item/name, :item/category, and :item/subcategory but predictably if I make those :db.unique/identity it's steam-rolling other datums

pvillegas1215:10:29

Have you looked at https://github.com/arohner/datomic-compound-index? It does not solve the problem but sheds light into it

unbalanced16:10:42

interesting. Well at least I'm not the first person to run into this 🙂

marshall16:10:43

@goomba There’s nothing inherently “wrong” with modeling compound uniqueness as a munged-key

marshall16:10:51

yes, it involves redundant data

marshall16:10:14

but, if you actually require compound uniqueness semantics, then you need to do something like that

unbalanced16:10:31

yayyyy okay great.

marshall16:10:00

is the type of :item/key string?

marshall16:10:31

vector is’nt a datomic db.type

marshall16:10:54

ah, it’s cardinality many?

marshall16:10:59

i would probably avoid that

marshall16:10:25

in fact, you cant do that

unbalanced16:10:34

ahh sorry I'm actually putting the hash value of the vector but for omitted that for simplicity

marshall16:10:36

" Only (:db.cardinality/one) attributes can be unique.”

unbalanced16:10:48

"simplicity"

marshall16:10:50

yeah, a hashed values is probably fine

marshall16:10:06

although it does drop one potential advantage

marshall16:10:09

which is index locality

marshall16:10:39

i.e. [:a :aa :aaa] will hash very differently (maybe) than [:a :aa :ccc]

marshall16:10:00

but if you made them something like compound strings, they would sort more ‘realistically’

marshall16:10:26

":a:aa:aaa" and ":a:aa:ccc"

marshall16:10:04

also human readable

marshall16:10:10

which is nice for debugging and/or error handling

unbalanced16:10:18

ahh good point. yeah I'm at the dev phase where I just throw everything at the wall and see what ticks

unbalanced16:10:44

but that's a better idea

unbalanced16:10:02

thank you 🙂

ghaskins19:10:35

hi all, im struggling to find out how to determine the txinstant of the last commit to the db

ghaskins19:10:48

i can get (basis-t) of course

ghaskins19:10:58

but then im not sure how to get t -> txinstant

souenzzo19:10:11

@ghaskins

(defn t->inst
  [db t]
  (:db/txInstant (d/pull db [:db/txInstant] (d/t->tx t))))

ghaskins19:10:02

awesome, thank you @souenzzo

eggsyntax21:10:26

Is there any way to query and get one or a few results that doesn't require retrieving a large amount of data (assuming a cold peer, in this case my local [on-prem] REPL)? I think (is this correct?) that both the :find ?e . find specification and the sample aggregation function retrieve the complete result set before cutting it down. It's fairly common (for me at least) to want to get a couple of representative matching entities in a fast way, and it seems like there would be some way to achieve that with a query.

Joe Lane21:10:59

async query that returns a channel? take N results from channel, then close?

eggsyntax21:10:58

Is there such a thing as an asynchronous query (for on-premise)? I thought queries all went through datomic.api/query, which as far as I know is fundamentally eager.

Joe Lane21:10:32

I’m very unfamiliar with on-prem.

Joe Lane21:10:44

All I know is the client api.

eggsyntax21:10:58

Whereas I'm pretty unfamiliar with the client api 😉

eggsyntax22:10:40

Incidentally, I think I can achieve something like this by hitting the indexes instead of querying. It just seems like there would be a way to do it via query, since (I imagine) it's a common need.