This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-06
Channels
- # bangalore-clj (2)
- # beginners (24)
- # boot (18)
- # cider (21)
- # cljs-dev (11)
- # clojars (3)
- # clojure (99)
- # clojure-brasil (1)
- # clojure-dusseldorf (2)
- # clojure-france (9)
- # clojure-greece (3)
- # clojure-russia (1)
- # clojure-spec (5)
- # clojure-uk (5)
- # clojurescript (205)
- # core-logic (2)
- # cursive (24)
- # datomic (13)
- # figwheel (1)
- # gsoc (1)
- # jobs (1)
- # jobs-discuss (7)
- # lambdaisland (5)
- # leiningen (4)
- # om (2)
- # pedestal (2)
- # proton (2)
- # re-frame (7)
- # reagent (5)
I have a schema that includes an attribute :a/metadata
, which in turn can hold an attribute :b/tags
. And :b/tags
takes a :tag
. :a/metadata
and :b/tags
are ref
s with the component option set to true. If I pull
an entity containing these attributes, however, I am getting some incongruent results between an in-memory db and a db setup using the transcator. If I do it using an in-memory db, the tags are pulled completely, but if I do it with the dev db using the transactor, I only get the :db/id
for the tags. I'm trying to understand why this might be happening. One thought I had is that the dev db is slower, and that the transaction has somehow not yet completed, so that even though I'm pulling with the version of the db that is returned by the transaction, that those value aren't yet saved... Anyone have any thoughts?
@ezmiller77 can you show us the pattern you use for pulling?
Sure. Basically, I do the transaction. Then from the result of the transaction I get :db-after
so that I'm sure to be using the correct version of the db. I then just do use the pull api:
(d/pull db-after '[*] [:arb/id id])
(The attribute shown there has a different name than waht `i wrote above, as I was just trying to simplify...)
I see. I'm not sure I can picture the entity diagram though. Could you show some example data (i.e a few datoms with these attributes) ?
and also what the output of the pull
looks like ?
So this is correct pull output that shows what you are asking for I think:
{:db/id 17592186045421,
:arb/id #uuid "590dc5a2-00e1-4a5b-8901-1fbc62c0dbc9",
:arb/value
[{:db/id 17592186045428,
:arb/value [{:db/id 17592186045430, :content/text "Title"}],
:arb/metadata [{:db/id 17592186045429, :metadata/html-tag :h1}]}
{:db/id 17592186045431,
:arb/value [{:db/id 17592186045433, :content/text "Paragraph"}],
:arb/metadata [{:db/id 17592186045432, :metadata/html-tag :p}]}],
:arb/metadata
[{:db/id 17592186045422, :metadata/html-tag :div}
{:db/id 17592186045423, :metadata/title "Untitled"}
{:db/id 17592186045424, :metadata/doctype {:db/id 17592186045418}}
{:db/id 17592186045425,
:metadata/tags
[{:db/id 17592186045426, :metadata/tag :tag1}
{:db/id 17592186045427, :metadata/tag :tag2}]}]}
This is an example of the pull result where the tags aren't recovered:
{:db/id 17592186046255,
:arb/id #uuid "590dc664-0ee1-4d47-b1ec-eeb332eeace9",
:arb/value
[{:db/id 17592186046260,
:arb/value [{:db/id 17592186046262, :content/text "A title "}],
:arb/metadata [{:db/id 17592186046261, :metadata/html-tag :p}]}
{:db/id 17592186046263,
:arb/value [{:db/id 17592186046265, :content/text "Paragraph"}],
:arb/metadata [{:db/id 17592186046264, :metadata/html-tag :p}]}],
:arb/metadata
[{:db/id 17592186046256, :metadata/html-tag :div}
{:db/id 17592186046257, :metadata/title "A title"}
{:db/id 17592186046258, :metadata/doctype {:db/id 17592186045418}}
{:db/id 17592186046259, :metadata/tags [{:db/id 17592186045417}]}]}
hmm I see. Weird
First thing I would check is that the attributes are actually the same in both dbs - by calling e.g (datomic.api/attribute db :metadata/tag)
for both dbs
That makes sense. Will try that. Thanks.
@val_waeselynck I suspect the problem I am having is related to a limitation of pull
related to enums: https://groups.google.com/forum/#!topic/datomic/WBLEqNH6RtE