Abstract models

Modeling · Friday Demos · August 9, 2024 · 12:09

New `abstract` files in the model allow for fields, views, topics declarable without attachment to a table - this opens up new use cases for model inheritance and layering we'll be…

Transcript

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

  1. I can go first I got a I got a demo I've been working with Conrad and Stephen on um which screen uh so we have a notion of extends in our model and maybe also to this is not quite done yet um but but getting getting closer um we have a notion of extends in our our model um but our extensions um are uh are all like uh real objects in the sense that they're tied I'm hearing some phone that was me sorry uh but uh the they the real objects and and will basically create validated errors when they're not tied to specific specific things so like if you've got a view um a view model that you want to extend it can't be an

  2. abstract thing it has to be tied to it or El it provides a huge amount of uh validators um we've we've now added a new feature to uh enable abstract Fe abstract views or abstract model objects so views topics Fields uh can basically not be tied specifically to a column or a table in the database but they can be logical constructs that can then be extended um and other modeling tools like looker for example has this notion of basically extension required they're sort of like abstract objects that basically you have uh an interface that you want to provide and then can uh and can apply and so like for things like templated uh analysis so like blocks and stuff it's super useful um so we've

  3. got now a very similar construct we we sort of called it abstract um for for these model objects too in this case imagine this is a you know a user uh templated analysis uh here and I've got you know two two pieces of of of logic I want to apply I've got a full name thing that assumes there's a first name and a last name user uh field object that's going to be uh you know concatenated there's also a piece of metadata in this case like I I didn't have uh time to build a user lookup demo or dashboard in my local instance so I just actually just just uh am gonna link out to uh the the dashboards uh on on demo but basically

  4. we provide metadata and it'll basically be um uh uh composed together with this Bas space user object that we've got um here too and this is how you could build things like a hub and spoke you know if you got a centralized model that's basically a bunch of logical constructs and then you want to go do not touch you want to have a bunch of um specific uh you know materialized versions of it like each departmental use case or something like that why do we what is the what is the abstract true thing doing here it's saying that these these things should not be validated as real objects object and instead are actually just abstract objects too so if you okay just as an example

  5. I just I feel like if it could look more like a normal view file it would be helpful so like that I mean these are just small things but like that at the top like essentially like I I at least for me as like a not uh a not that thoughtful person about the system like table name non-existent is more clear than abstract true um or like yeah because we're essentially saying this isn't to a table is like the summary of what it means right for for views yes for topics they could also be and for Fields they could also be too um and so like it's like a I'm I'm very open to uh the top but it definitely definitely should be at the

  6. top because like it has to declare what it is it's just I think it would help if it was more descriptive of like I I don't know how but um the looker term was extension required uh which is not like it is more descriptive it's just not you know yeah I I'm not sure that's probably one that just talking to everyone here I think if we can figure out ways to describe this that is more self- obvious to people I think that's always really really helpful yeah I I think that's not that's not crazy uh at all and just to show people too what what it looks like uh they're you know oh I probably should undo the abstract uh through uh basically what means

  7. is this user user object like any other extension effectively can pull in that that full name and can pull in metadata about the ID so that you know the full name is the the space and the concatenate but like you know you get you get what it it's effectively doing and it also can pull in this metadata where it's effectively composing this object inside the the user so this is like our you know user user dashboard or something Jamie is this also where you'd Envision putting like um fields that are dependent on two views and that type of like the stuff that you would do a bear join with in looker yeah you you could you could very easily do it that way too you

  8. don't you wouldn't necessarily H have to you could create a view though that basically is dependent on those two joined objects and and express it the the hard part with the two different joints you may want it to specifically depend upon those two fields and you want to make sure that joint comes in too so we may it may not be like a locally scoped you know definition of a field yeah it wouldn't be but like things like you know an example uh this was like prompted prompted partially by you know Conrad's new uh views inside topics and being able to do aliases uh I think there would be you know effectively renaming things so youve got sellers and buyers on a user's table where

  9. you may want to do it you may want to implement the user's table as effectively an abstract view with a bunch of you know either metadata or uh you know uh dependent uh measures that that you know you user count or count users that are new or what whatever it might be apply it in in both rolling that forward though how's that going to work with like a schema update and like like Can it can it then reference the table itself but abstract itself away too or the abstract views are not tied at all whatsoever to database tables or database in general um so like think think you know basically what it's defining is a uh an interface or construct that it requires from a

  10. table that's actually going and extending and to the extent that it doesn't exist so just as a maybe like a simple example so like you know the this this requires a first name and a last name and if if last name doesn't exist like we want to delete it uh uh last name is not found in uh in users basically you know if I I go here it'll it's not actually navigating me to the right validation uh problem but like it's basic giving me this error because this field is depending on another field that's not actually present so like you will get it really does look like a a uh a field that's basically depending upon the the actual specifics too it's really defining an

  11. interface and we should error whenever that interface is basically broken yeah there's there's a few things that are a little bit a little bit weird too and like there's uh you could we have this layered modeled approach also so like you can imagine actually extending an abstract View and changing things uh in it and maybe would do that in a workbook model but like it gets it gets kind of even more complicated quickly but uh but yeah they should be this should be powerful for things like Hub and spoke uh it should it should at least enable it just quick follow on question from that Jamie um so in terms of like coverage for Hub and spoke versus looker like would this meet a lot

  12. of the needs of like this would be this would be effectively 100% of what looker does what we don't do though is the project import style uh pulling in other external but like you could at least in theory you know within a single you know Omni model uh have all of the functionality that they had to we we there may be use cases where you'd want to have abstract models and reference models that are in other other you know defined in another place in in some way which we do not have the ability for yet but but like functionally I think we'd be able to replicate it all it's just organizationally it's not it's not the same and like we obviously don't do you know

  13. multiple multiple connections against the same models still too go thanks yet we don't do that yet yet yeah yeah exactly when you have um an abstract view that references something like last name but your schema has like a family name column does that just mean that you have to go into your model and Alias last name to or family name to last name yeah so like the yes basically the what it's what the abstract VI is saying is I expect the user view to have a last name field in it you could you could do you could do that in a number of different ways too it could be that you effectively have SQL you know last name and then the SQL is basically referencing

  14. a separate column for it you could Alias a separate column uh you you could also too have like whatever the family name be a field and then extend the abstract View and overload that abstract View's reference for it too I think that's where uh our layered approach actually might be super interesting so like when when we do uh template analysises like like what looker does in blocks we could actually have more composability and more Customs like one of the things that's painful is everyone's schemas different like maybe you've got Facebook ad data but you have Facebook ad data in postgress versus like inside big query versus and you maybe have completely separate schemas in addition to uh completely different uh SQL that's going to be

  15. referencing it to and we could potentially overload it it at the uh templated level like at the templated analysis piece the abstract the abstract view could be actually customized um I I think I think I follow the the sort of place I'm going to is like when I think of uh inheriting from like an abstraction you know in like a good ide and good programming language uh you're basically making a declaration like I want to inherit this interface and then your tools give you really good feedback about like this thing expects you know the following values like this thing expects a last name value and I could almost imagine a world where like in that extend declaration you just Define the mapping you say last

  16. name colon family name or whatever um to satisfy the the expected interface and maybe maybe that's what you mean and maybe that already exists in your implementation but that's kind of where I'm going with this yeah I think that that makes sense too it it's not as explicit my implementation is really really lightweight really it's like off validator features uh so like it's not like we we have all the extension logic um already uh the like the way you would do it in in our system today would be basically having that separate field that you'd have to have like a last name field inside that view but I like that uh idea a lot sort of like explicitly defining that interface is not it's not

  17. crazy at all because like we really like what we all of our views all of our model is kind of you know they're apis to data they're interfaces to to data explicitly too um we just want to make sure uh you know validator at least tells you when they're when they're broken