Dynamic database connections

Modeling Administration · Friday Demos · August 2, 2024 · 5:01

New functionality that allows for dynamically swapping the database connection from a branch. Easily switch between prod or staging schemas (not just dbt) in the UI - great for testing data…

Transcript

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

  1. and then the last one is more fun uh is it uh so whoops um hacked on this on Wednesday or Thursday or something so on basically on a connections page I don't know what to call this but trying to add this idea of like allowing a connection to use another connection um and so this is I learned to not try to make UI at all and just make cries for help and Jared or Sarah will come in and actually do it so here's my UI for adding a connection environment uh but so I go and I say oh let me add this other post address connection as an environment for this connection and deleted if I want uh but I don't want to instead I

  2. want to go which one even was the keep that one uh um so now I because I've done that I'm in and I'm in a branch uh I get this switcher um so let's say this is my default connection I have this account this is how many people are in my users table in this connection so I switch it ideally would rerun the query it w't but I reload the page now it's using this other connection and if I go to the model um you can see like it's basically it's swapped out the entire it's literally like rebased the connection including like the schema model uh so like it's giving you this air about this table not being there because it's really like the default

  3. it's a it's a different whole different schema backing it so that's not merged uh you saw that UI uh but it actually like kind of works so and think it's useful so I'm gonna probably try to push it push it in um at the risk of you know give a mouse a cookie uh does that mean that people will be able to start parameterizing this potentially in the model too it uh in so so in the um yeah uh not not immediately but yeah it would basically be like you so here you would go like you add these alloud connections and then you would click another thing that's like add user attribute as parameterization and then there's a little bit of work to do to

  4. figure out exactly the right injection point to be like because we don't want to go and chasing that down through the system so hope I've been thinking about it hopefully there's a point where we get like one one place where we can say okay this is the place where you switch and then because it works really well with these branches because we can use the exact same proven life cycle that the DBT environments use where you basically literally change the branch model to say like I have this new special thing um so the parameterized by user attribute would have to work a little differently be a little more but there's got to be a way and uh are you adding the connections one by one

  5. like the what I'm thinking about is like if there's a schema and there's one per customer for example am I going to have to add each one incrementally or like what's your sort of thought there the the well so the the that one the schema per customer right is already done yeah sorry it's it would really be like a yeah I'm going like one you'll have to you'll have to do it explicitly and and that's obviously different than how looker does it which has its pluses and minuses right like the explicit can be good right because you can actually see like these are actually like each of these is a distinct connection and I can test it right versus like there are these parameterizations that

  6. kind yeah combine in mysterious ways and I have to be sure that I know what I'm doing if you hooked it up to an API then you can sort of make it automatic based on some logic so that actually doesn't really matter I think yeah that's love that you started off Stephen with a proving that you were doing your job and then four demos later well I mean the other that one was no one asked me to do that connection thing and and then arel on Thursday was like do how about the sequel stuff like oh