-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for meta
to be defined for each dimension at the view
level
#7391
Comments
Hey @marxlow 👋 This is an interesting feature request—now I'm trying to understand whether it aligns with the fundamental premise of views that they don't define things (e.g., members) themselves but only expose members of cubes. Your use case makes sense to me, but I'm currently not sure if there are more use cases that would benefit from such Also, I wonder if this #7327, once merged, would be a working solution for your use case. |
Hey @igor! I think it aligns, Let's say I am building out an Analytics tool dealing with demographic data using 2 Charts. Chart A --> Strictly only allows users to filter by Gender Currently we have to "leak" what I consider to be business/product logic from each Charts A & B down to the Cube level. Because we cannot override dimension meta values at the
HOWEVER, If we had the ability to override dimension meta values. This is what the implementation could've looked like instead. Cubes could've stayed agnostic to the implementation details of the
In the second approach we see that logic is encapsulated within each view. The Chart consuming from each Yeap I saw that :) it #7327 can work too, but it's less clean IMO. We have to tie the dimension of each Cube level back up to the
|
Hey @igor, would you accept a PR to add this feature? If we came up with the PR, what's the process and timeline to get this merged/released? |
Hi @igorlukanin, what do you think, if this was PRed would it be accepted? |
@igorlukanin Thought I'd give you a bump on this. Are you open to accepting a PR on this? |
In my opinion, it looks like the ability to define top-level meta in views pretty much solves the issue and provides the way forward here. View members would inherit their meta payload from cubes—and you also have an option to enrich that data with top-level meta in each view. In a way, it looks logical: if you go down the "one-view-per-chart" path, it makes sense to have view-specific (chart-specific) metadata. IMO, the proposed change looks like some syntactic sugar rather than something that unblocks the use case—and we can probably collect more usage data before introducing more complexity in the implementation. |
I'd love to hear what @paveltiunov thinks as well. |
Hey @igorlukanin , in this case we need the behaviours (defined using meta) at the dimension level to be different for each View and .
|
@paveltiunov Any views on this (no pun intended 😉 )? |
@marxlow @NatElkins Let me expand the pseudo code example above: // Given 2 views
view View1 {
cubeA {
includes: [
{
name: 'some_dimension_with_different_behaviours_in_view' , // <-- Unable to define a dimension level meta
}
]
},
meta: {
cubeA: {
some_dimension_with_different_behaviours_in_view: {
// metadata that details that behavior for View1
}
}
}
}
view View2 {
cubeA {
includes: [
{
name: 'some_dimension_with_different_behaviours_in_view' , // <-- Unable to define a dimension level meta
}
]
},
meta: {
cubeA: {
some_dimension_with_different_behaviours_in_view: {
// metadata that details that behavior for View2
}
}
}
}
cubeA {
dimensions: [
...
some_dimension_with_different_behaviours_in_view: {
meta: { } // --> Cannot be overwritten by Views. Sha
}
...
]
} Would top-level meta in |
@igorlukanin Thanks, that was actually very helpful. I can't speak for @marxlow but I suppose that will work for us actually. It's not quite as "clean," in the sense that now we have data stored in two places and we'll need to check every dimension that we're getting from the cube against the metadata at the view level. But it should be relatively scalable, so long as we don't make any mistakes in the implementation 😃 |
Sounds great! Closing this issue as resolved. Please feel free to reopen. |
Is your feature request related to a problem? Please describe.
Views
to hide the implementation details of the underlying Cube. --> Our Frontend will only interface with Views.meta
property to dynamically change the behaviour on the Frontend. e.gmeta: { isRecommended: true }
.meta: { isRecommended: true }
to the underlying Cube. But that creates a strong leakage & coupling between the Cube & the View.Describe the solution you'd like
Allow views to overwrite the meta property of the underlying cube:
Describe alternatives you've considered
Adding the
meta
in Cube works but as mentioned earlier creates coupling & leakageAdditional context
From a quick scan of the codebase this looks logic can be implemented in the
CubeSymbols.js --> membersFromCubes function
here (https://github.com/cube-js/cube/blob/master/packages/cubejs-schema-compiler/src/compiler/CubeSymbols.js)The text was updated successfully, but these errors were encountered: