Dynamic connection environments improvements

Conrad Slimmer · Friday Demos · March 14, 2025 · 10:39

Bunch of fresh code for some of our most complex environments, smoothing the experience for connection environments plus the interaction with git and user attributes. Making sure even the…

Try it yourselfThe full week on docsadministrationmodeling

Transcript

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

  1. okay I'll jump in um let's see which screen do you guys want want this one so this one there we go okay so I've been kind of working at the intersection of lots of various complicated features that you know interact in ways that um can be confusing uh want to just do a real quick demo on something that I did this week and then um I might try and demo something I did a couple weeks ago that I tried to demo in the past and got myself confused that's how complicated these things are uh so this one you can see that I've got um a model up that's taking advantage of uh the DBT environments um and I'm in a branch and so I'm able

  2. to actually switch DBT environments and I'll also note that this model is um is get enabled so here I am I'm in the production environment everything's cool I've made some changes to this branch and I want to create a poll request so I'm going to create a poll request and it just jumped me in to create this poll request great all right well that's the current behavior now imagine that I had actually switched into my development environment within the um within the branch my development DBT environment and now I've got all of my Dev views and whatnot going on here if I create the poll request from the based on the dev DBT environment there's going to be all kinds of views and different fields

  3. that I've done development on that really aren't part of my production uh schema and so that poll request is going to have all these differences in it that really shouldn't be there and so I've just gone in and I've added a simple guard rail for when I create the poll request if I'm not in my production environment before you saw it just jumped me straight into the open the poll request now I'm going to pop up this warning that says hey you're in a non-production environment are you sure you want to continue so just a little bit of friction in uh in the create PLL request flow and this same um warning will be present if you already have a poll request open and you've

  4. switched over to a development uh DVT environment uh and then you go to update the poll request you would have the same effect of like now that branch is based on my development environment so adding some guard rails to prevent people or at least prevent people from unknowingly create or update uh PLL requests based on nonproduction schema basically these same uh guard rail will be in place for um environment schemas uh for sorry environment connections so if I'm in an environment connection and I have a non- default uh and I'm doing schema switching then I will warn like hey you're not in the default schema here okay so that's number one and then let's see we're gonna we're going to try this time I like

  5. I say I confused myself last time things were actually working but this stuff's complex and so even the people who develop it sometimes get themselves confused so if I jump over here I'm going to pick oh which one was it I think that I have got um PG local I think it's PG local is the one let's just check all right does this one environment set up oh yeah so this one's got environment set up so I've got this um this connection I've got two databases actually I've got one of my test databases is running in Docker and one of them's running in you know local uh postgress not in Docker so I'm just taking advantage of that to basically set up two connections that

  6. have different schemas different uh tables in them and if we look at this one here um I'm gonna I'm I'm just going to start simple so here I am I'm in this uh this connection and basically what I want to do is give like an overview not just of the new feature but of connection environments in general and the complex ways that the different settings can interact so right now what I'm looking at is the PG look local my local database and I've added I just went in and I copied the users table so now I've got the a copy of users in this table in this connection environment uh which is the default if I want I can switch over to PG Docker this

  7. is my Docker one and then actually it can't find the view that we're looking for because that view doesn't exist in my Docker schema okay cool well what if I go in here and uh I swap this setting here in my connection environment so that I'm not doing use schema from connection environments oh now I'm still using the schema model that came from the um from my local postgress database not the docker one and so now we actually you can see that we've got this users copy cool right uh but what if I want to do an analysis on this and I want to select you know I don't care age oh because I'm in this database and I'm using the connection that is actually

  8. making the query request to my Docker based connection which doesn't have that ta that user's copy table in it the query failed okay this query will run if I switch into the default connection all right so far so good uh I have a question Conrad yeah go ahead why are we showing it in the model IDE if that's not something we can query because you've got the schema set the you're not switching schemas and so okay what you see what you see in the IDE is based on the schema model okay not on the if I switch the the use schema from connection uh and you know let's clear this query uh you see I've got users copy here I switch over to non-default connection

  9. I've got all these other Connections in my thing but uh you can see that the user's copy view no longer exists okay um if I'm boring people I can stop but I just I feel like this deserves a little bit of an overview uh okay that's great so now we've got this nice feature that allows us to dynamically assign uh connections based on a user attribute so I think I've got the user attribute called Dynamic connection I think the value for default is default and I'm GNA update that doing that actually brings this in uh PG Docker would have to be the user attribute although I think that I want a different one well let's let's not do that let's just refresh okay so now

  10. I'm in Dynamic connections uh and I want to turn ah do I want to do that yeah I want to see what I've got in this Dynamic connection so let's jump back into here uh even though I'm in the branch oh did you see I turned off this setting allow Branch connection environment override and what that means is that even though I'm in a branch I can no longer override the user attribute based connection environment and so I continue to get and it it looks like let's see here yeah so I must have the care cor user attribute to get the docker connection the non-default connection um and that's really the thing that I was trying to show here is that we've added this new

  11. setting to make it so that when I'm in a branch I can or cannot override the user attributes setting and this is important because if you're able to override the user attribute setting and you're using user attribute based connections for um security purposes and some of the users that you're trying to secure are queriers or above then they're able to go into branches and they would be able to select a different connection than the one that's assigned by their user attribute and that would override they would then be able to bypass that security that you're providing via the user attribute based connection so this is an important setting to know about when you're doing this um I'm going to wrap up there just by saying

  12. that all of these settings do work in conjunction with one another they're complicated enough that I've confused myself when trying to demo them and so don't hesitate to ask if you have any questions when you're trying to get these settings right for your various use cases and let's see if I can close it out