Fork me on GitHub
#datomic
<
2020-09-25
>
jaret19:09:47

^ New release of Dev Tools provides dev-tools via Cognitect maven repo!

đź‘Ť 3
seancorfield19:09:07

I didn't see anything stating the new version of REBL in dev-tools -- I had to download the ZIP to find out what the latest version was (0.9.242) so that I could put it in my deps.edn and pull it from the Cognitect Maven repo.

seancorfield19:09:54

(and, yes, I know that having downloaded the ZIP, I don't need to set it up that way -- I could just use a local install -- but I prefer the idea of being able to get things direct from Maven)

jaret19:09:16

Thank Sean, I'll share this with the team and see what we can do.

Michael J Dorian19:09:36

Hey! I want to pull all data on an entity based on it's entity id, can anyone tell me what's wrong with this query? (d/pull (d/db conn) [:db/id 79164837199970])

Michael J Dorian19:09:31

I know the id based on a previous query

manutter5120:09:57

missing colon on :db/id

Michael J Dorian20:09:18

Ah, had that messed up. This isn't working for me either, it just says

Execution error (NullPointerException) at com.google.common.base.Preconditions/checkNotNull (Preconditions.java:782).
null
(d/pull (d/db conn) [:db/id 79164837199970])

souenzzo20:09:46

[:db/id 42] isn't a valid lookup eid it should be just 42

Michael J Dorian20:09:18

like so? (d/pull (d/db conn) 79164837199970)

manutter5120:09:22

Ah, right, that’s true

Michael J Dorian20:09:58

I guess there's something wrong with the query I'm getting this id from then, I'm still getting null pointer exceptions

manutter5120:09:18

funny, though, why wouldn’t that work just like any other unique ID pair?

souenzzo20:09:21

:db/id isn't a "datomic ident" There is no [42 :db/id 42] tuple in "datoms stack"

manutter5120:09:50

@UNMBR6ATT Are you sure you haven’t lost the conn? That could give you an NPE

manutter5120:09:09

@U2J4FRT2T Ok, that makes sense

manutter5120:09:46

I guess I’ll aways be an old SQL guy at heart

Michael J Dorian20:09:35

I don't think so, I can still run a query that gives me [[79164837199970]] and all of my functions are making a fresh (d/db conn)

Michael J Dorian20:09:51

the query that gives me the id is

[:find ?e                                                                                                             :where                                                                                                                 [?e :user/email ?email]] 

Michael J Dorian20:09:23

which, if I'm not mistaken, should just give me the entity ids of anything with an email address

csm20:09:38

you don’t have a selector, you’d need (d/pull (d/db conn) '[*] id) to pull everything for id.

csm20:09:33

Client api can also use an arg map: (d/pull db {:selector '[*] :eid id})

Michael J Dorian20:09:25

thank you, that did it!

manutter5120:09:33

Yeah that was it, I was looking up the docs:

datomic.api/pull
([db pattern eid])
  Returns a hierarchical selection of attributes for eid.

         See  for more information.

manutter5120:09:54

I was just working with pull expressions too, should have spotted that sooner.

Michael J Dorian20:09:46

Sorry for the silly question, these docs have a lot of "..." that really throws me off. I'm curious why I didn't get an arity exception though

manutter5120:09:26

Yeah, seems like you should have.

Michael J Dorian20:09:26

Oh, I guess I could have included the selector and :eid all in a map. All makes sense now. Thanks everyone!