Views in topics

Modeling · Friday Demos · August 2, 2024 · 13:33

Sometimes you need to customize a view for the purpose of a single topic - new labels, new fields, maybe even different field definitions. Now you can. This work opens up a views: argument…

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. um I'll show you guys what I've been working on this week melting my brain and I'll caveat by saying that there's more work to do even this piece of work is not uh yet merged into um in domain but there's a PR up for this and then there'll be follow on work uh to make it ready for prime time uh so you can see that I'm in the models file here and inside of these topics I now have a new keyword this keyword is like I say because it's not released um won't autocomplete for you but uh you know have a views keyword so just like we added relation or topic scoped relationships I've added topic scoped views and so now I can do any

  2. customizations to views or their fields that will only be applied within the context of a topic the way this works is that it actually all of the the layering within views if you're in you know Branch or workbook all of the the layering is applied first just within the topic scope views and then at the time that we actually go and get the topic model for like hey I'm I'm in a a workbook and I've decided I want to do some analysis within a topic at that point we actually resolve the topic scope views into the model scope views and so the topic scope views can either extends from a model scoped view which is um what I'm doing right here so this actually creates

  3. an a new view within the the scope of that topic or they can just extend uh their same view so so like these are it it's it's like there's another layer um being applied to to the to the Views within the context of that model so these you know Fields will be custom customized within the context of that topic so um you know you can see is there any restriction is it sort of just like you literally can do anything that you could do in a view yes like you could the primary key you can just like you can kind of do it's just like a little view file that's sitting in there so sick yeah it's terrifying it's a little it's a little bit

  4. terrifying but it's I I think it's actually really useful and and it you know I think it's really useful I'm excited about it um just to show it working in some of the stuff that was difficult that I ran into like in in uh in this view you can see that like I've added a full name Dimension that only is in within the scope of this context I've added a you know or within the scope of this topic I've added this topic only count uh and I've you know labeled status within the orders View and so just to kind of show that happening you can see status and topic is is picking up that label if I were to switch out of this topic it

  5. wouldn't have that customization on it and you can see selected the topic only count and the users only count so the you know the users count um gets you know retains its definition within the original View and the topic only count picks up that you know bogus like I added a million to it who who doesn't want another million um what else can we show you here oh I'll show you just the um users extense stuff this is I guess gon sorry I've got a break point that probably will work oh it's going to error because these fields don't exist no it's going to error because something else we need a way to reset reset oh use the button that's what the button's for where's

  6. the button message and it's over here my it's my beautiful button you got to open up the thing to yeah again you have to do it for each one of the fields it's true don't mess up my demo um anyway so you know you can see that in this one what did I do over here oh I have this other view that's extending from you know users EXT is identical to users uh um except that it has this different count uh and then what else was I going to show oh I this actually fixed along with this fixed an existing problem that we had with go to definition so extends used to actually try and take you to where the view ex to the extends

  7. but now we retain the the yaml path from the basically the last touched object that you're trying to go to whatever in whatever layer it's touched in so all the like go to definition stuff work so for example like you know uh users EXT is a is a topic view I'm going to go show you the topic view but if I go and say want to go to you know this guy here that's hasn't been touched and so I'm going to take you to the view the model view definition of it and that flows through also to all of the you know the fields if you click go to on a field it'll you know find the last place that it was touched and take

  8. you to that particular definition whether it's in a extension of a view or extension of a field a you know a topic scope view etc etc uh and then one other thing that I was going to show um because step made my life difficult last week uh but um if I add a bad field definition to one of these things uh this actually works with the autofixer the autofixer knows whether it should go and you know remove it from the topic scope view or the model scope view so um it's been a lot of fun and I think that we're getting close the things that are keeping this from being uh released at at this time is basically um model extension mutation uh is kind

  9. of a a a mind mess uh to to figure out what exactly needs to happen there there may need to be some ux around it like what does it mean if I want to modify a field within the context of a topic that has a topic scope view you know like where do we go to to do that mod ification so um there's a little bit of work to to to get over the line but uh I think that we be there soon that's just so sick concerns no that that is awesome and it's without a doubt the right way to do curation for for topics and stuff we've gotten a buchas like this this is really nice does this change the way that we

  10. would recommend someone does alias stuff that was one of the kind of things that led us to this is like yeah hey maybe it would be nice if instead of doing the you know joint to view as this we just have a way to create a view extension that only exists in the context of that model and and and then you kind of get this nice it's a little bit more contained and a little bit less surprising yeah it's I will say it's still slightly awkward because if I then want to I still need to create a relationship with it that's you know in that topic I kind of already tell people to put relationships for Alias stuff that's like one offy into topics totally

  11. um it's I think it just helps have like little design patterns here because if if you're structurally remodeling it you should probably just put an extension into the model and have a buyers and sellers View and treat them like tables um but I think if it's if it's like encapsulated in a topic we probably want you to do it in in place with joins in place and all that kind of stuff yeah I I like I said this was definitely one of the the motivations for developing this is like hey let's make it a little bit let's like shift where that happens so that it's a little bit more clear what's going on so yeah it definitely makes doing kind of contextual curation like so

  12. like if buyers and sellers you want to have some a few slightly different fields you know that are derivatives or like High fields or something like that which would make a ton of sense for a lot of reasons this is without a doubt a much better way to do that yeah or things like I want to apply different labels or you know like all this stuff and you know I'm not good at coming up with what all the use cases are but you ask like can you just do everything like yes I think our customers are going to figure out some crazy patterns and and yeah we should be playing with it and figuring out what are our recommended patterns like where is this actually

  13. really useful we should uh try to do I don't know if Jess is here but we should try to uh use this on our analytics model because we have a very similar sitch with um the content topic has like we joined the users Alias a few times for like the document creator and document consumer and there's some diffs there and this would be way more elegant does this also mean that a topic could theoretically be the entire model like no View files I mean if you if you wanted to literally install like a completely defined thing in one object you could just do it in the topic right now right yes you can probably now yeah I'm not saying that we I'm going to go

  14. do that but it's kind of interesting that you can actually have like a completely encapsulated file this may be obvious but what's the use case of that or is it more just the possibility of it uh you can see it all at once yeah if I need to go paste in something that I know has no dependencies you just know that you're pasting in something that has no dependencies so again like that is not a good reason probably but it's just sort of interesting that it you can actually see the entire like an entire query or Topic in one blob I mean the use case I would have for it is like whenever I have to like blow away my database I'm like I go

  15. in to demo and I like copy over all the stuff from each file so I can like have a richer uh experience to play with and it would be one thing to copy instead of multiple things to copy but I don't think that's really a a valid one for well I don't know for our customers I mean if they're having no I mean I think for little use cases like that there actually is something interesting there like it probably still not recommended because it comes with a lot of deficiencies too but I I I think the other the other one that I've thought is kind of interesting is that this is sort of like hey maybe I want to expose some stuff in a topic

  16. that I just don't want showing up in all views and Fields like I want to make something that's even richer or Fuller or exposes some things that I just don't want people seeing in the context of All Views and Fields yeah there also some things that like fields that maybe only make sense in the context of their joins that might make sense to put here so if you're comparing Fields across two different views or something to that tune where it really doesn't belong in either view but it it does belong to the topic level yeah this is this is bare joins in looker don't need to do that crazy thing can do this instead like doesn't mean though like it would be nice to get

  17. like there's a lot going these topics get even bigger right so like the that just even trying to rock what's going on in there is going to be harder like finding the topics right so some of the work that maybe Jared was looking at would be nice to start pulling into like how can we highlight them or like have some other way to like semantically browse a file yeah object browser type stuff like what or pull out pull it out and do you put topics in separate files or yeah that's definitely true and even even erds and stuff like that would be would be useful I still want a visualization for for joins