How is it recommended to handle situations where m...
# gd-beginners
j
How is it recommended to handle situations where my entities have common fields (like createdAt). Such that in a relationship between two entities, both have the createdAt and updatedAt entities.
I currently see this error in the modeler
i
Hi Jeremy, Looks like you are working with many-to-many model, correct? Some hints about model ambiguity can be found in our documentation. But it depends of what you need to achieve and what dataset needs to be “sliceable” by what data. Is it possible to change some of your relations from M:N(many-to-many) to 1:N(one-to-many)?
j
well in this case, i have an entity called
journey
and another called
journeyInstances
a
journeyInstances
has one
journey
by way of a
journeyInstances
.
journeyId
field. The modeler is complaining however that both entities have
createdAt
and
updatedAt
fields
image.png
is the recommendation to choose a path
eg. if I orient reporting around instances, then we'd choose that as the path?
the createdAt attribute on the instance describes when a person entered a journey. however, the createdAt date on the journey is less relevant from a reporting standpoint. Instead we might use the StartsAt attribute for slicing data around journeys that ran from X to Y period
i
I assume, there is no need to connect all three Date dimension datasets to both Attribute datasets via M:N relationship, then. I’d suggest to export the current model to JSON(as a backup) and try to change it to 1:N and/or remove unnecessary duplicated bridges between the Attribute datasets.
j
and this is how it came it automatically
this all comes back to sql and ambiguous * values, correct?
where in a native query those would be ambiguous
is the modeler trying to use these as relationship fields between journeyInstance and Journey?
i
Yes, your assumption is quite correct. The analytical engine “is not sure” what path to use for the calculation, as per there are multiple options/paths. Please check the examples under the 5. point of this article.
m
Hi Jeremy, if you are starting with GoodData and its data model, I would recommend going through this series of articles (they are quite brief and to the point I believe and can be great starting point). One of them is the one that Ivana linked and which addresses your specific issue. Regarding the case with “Created At” - in GoodData each date is not just a “date column in a specific table” but a separate “date dimension” which exists on its own (as a virtual table) and can be referenced from one or more datasets. If you are i.e. filtering by
CreatedAt
you are therefore not filtering by a specific
createdAt
field in your specific table. And this can cause ambiguities. In your case if user used something from
journeyInstance
and filtered it by
createdAt date
, the system would return very different results if it was filtered by
journeyInstance.createdAt
and
journey.createdAt
. But modelled like this, it is telling the system that these two are the same - a shared dimension. If createdAt of a
journey
can be different than
createdAt
of that joiurney’s
journeyinstance
it is recommended to create a separate date dimensions and link them to corresponding datasets (i.e.
JourneyCreatedAt
, `JourneyInstanceCreatedAt`…). This will allow you to filter/slice your visualizations by any of the specific dates without ambiguity. (if you need to have the createdAt dates in your logical model for reporting at all)
🙌 1