SQL parameters

Steven Talbot · Friday Demos · December 13, 2024 · 3:44

A new column parameter type for modeling injected SQL. Now flexible column pickers are simple to build

Try it yourselfThe full week on docsmodelingsqlworkbook

Transcript

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

  1. small thing that kind of opportunistic feature where it go uh we've already have this ability to reference mustache uh values like this uh and you can reference literal values but the thing that we don't have is this concept of uh in in looker you can do this like un quoted reference which will just drop something in kind of as is to your SQL on the SQL doesn't work like that uh everything's kind of more structural but what we've done done this uh is a column type of filters so I have this filter on the field that's a type column pick a column with a suggestion list uh and I'm referencing it back up here right filter see just pick a column of value and so

  2. that over here I can go and I can I should have made a single Flex filter would have been a better demo oh well uh but you can pick a value and your Dynamic column changes it's kind of a silly example to do this actually controls are a better solution if this is literally what you're trying to do but it's more for like building a fancy modeling situation where you're trying to change something deep down um but this is just to show function I presume this also lets us handle caching a bit better or does it like does this mean that the column's cached if you just quered for first name good question uh no which is surpris oh it hit the row limit uh

  3. TR traffic Source yeah no it's not catched it must have a subtle difference in uh either the SQL generated or the plan or something um oh yeah it's like we could if we cared about that we could maybe figure out how to make it ignore that but it's it's gonna be a little different can you pick multiple options Sten I think it would choose the first one um I guess it should have made a single select filter for the demo I think it'll just choose the first one yeah so almost certainly if you're doing this you want to do just good reminder this yeah that that would be the thing to do want to make one of these what happens if uh you have nothing

  4. selected can it just be a blank placeholder that will inject a column when when desired yeah it's uh it's you not oh single selects you can't unselect anything but yes if you SCT nothing it's just a null it's just it won't explode so you cannot you could put a default value in there too right sure you could col l n you could put a default value yeah y that's awesome