Dynamic SQL templating

Steven Talbot · Friday Demos · March 8, 2024 · 3:36

Templated SQL for ad hoc use cases where users may want to map raw SQL to filter blocks.

Try it yourselfThe full week on docsmodelingworkbook

Transcript

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

  1. I can go uh so this first demo is something very small mostly it's funny last week I demoed the percent thing and said it would be cool if you could make it in the UI back when Luke introduced nested menus he said you should never make a 3 deep nested menu well I've done it I think it makes sense but anyway here it is you can get percentiles in the UI so you can click the 75th percentile and make it real quick uh so small one but uh triple Nest triple Nest yeah I don't know if more nesting than that who knows but who knows uh this so this is another this something I tried to demo last week but I'm kind of glad it

  2. failed because then we clean it up and it looks better so I've got a pared query in Magic mode and I've done this thing with this join where uh now like this is a different join between orders and users makes a lot of sense mine is eight and like I've redefined age right and if I were to go in the past in exit SQL these would have just been added into the workbook and now like my workbook changes so now we have this thing that this very like in yourf face menu like we are going to add these things to your workbook and if I want to actually do it and thanks Jared for figuring out a little bit of I had no idea how

  3. to present this but Jared did it uh so then you hit EGS and add changes and so now they're in your workbook but at least we told you we were going to do that um all right now this one's more of a h so those two are are in are in main this one's more of a hack um while I was waiting had some downtime this week in between get stuff and periodo period stuff um so this none of this is new right this is our beautiful mustache filter syntax um so I've got this query I haven't run it yet um that's saying like it's got these templated filters and it's saying like if this is 35 default false then AG mat 35 blah blah

  4. blah so I run the query I'm not in Magic mode there are these but now these filters have popped up and if I didn't break my local um I should be able to change them and now I've got this kind of this templated SQL filter experience um so and then and go hopefully again this is I didn't even test this but uh so ideally it would Auto bind oh no it did okay so it did I think this is going to work it worked uh so that's now we've got this little like' hooked up the dashboard filters to the SQL query templated filters and so you can kind of do little arbitrary template of filtering in your SQL query and power from the dashboard again

  5. that it's more of a hack State uh and I had to shove it and get back to other stuff but I'm trying to push it through