
Dynamic dbt schema swapping
Dynamic schema swapping for dbt development. Now you can test dbt changes in separate schemas trivially in the Omni front-end via branches.
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
transitions nicely from the last two branch-focused demonstrations. So, here I am. This is an update to a demonstration I gave a few weeks ago on DBT circuit switching. Hmm, so for the most part, this will all look very familiar. But what changed is that before, when I was doing the demo, there was a new DBT syntax that you added to the model called "target schema," and you specified all of that there .
This is no longer there. Now this is how it works, and this code is in production with the feature flagged, so it's ready to use for anyone who wants to test it, is that the target schema for your, you could say, your production model is specified in the DBT settings. So, there is no more duplication of effort here.
Anything you save here will be used for the model. Once the feature flag disappears, the save process itself , creating the DBT integration, will result in the creation of these new Omni virtual circuits. It will check your existing DBT schemes and then create equivalent virtual ones for them. Um, you see, I have an extra product table in this Omni DBT thing.
The actual schemas in the database are as follows. Um, so this Omni DBT is now getting data from DBT products. Omni DBT sales get data from DBT product sales . If I then create a branch, uh, any of your schemes...That's the scheme prefix, by the way. The word "schema" is used in DBT , but is essentially a prefix of schema.
Any prefix you use will be listed here and you can override it. So I'll change that to buck, and you can see that it just switched to the developer table. So now this whole branch will point to, uh, developer stuff. Um, so I can query this table whose data is manipulated to have dev in the name. I can exit the branch, restart it, and it will switch to prod.
So, uh, yeah, I think that's it. And again I won't be able to stop sharing for some reason, because of Linux stuff. So, if anyone can stop by for me, that would be great. Thank you. Uh, in this thread too, could you change the schema? In the branch, um, yes, I changed the circuit to DBT buck when I created the branch.
Yes. Em. Is it fixed in that location, or when you're on a workbook page, could you also change it to something like a transition? Yes. Um, anywhere there's a branch header, you can change the schema there and it will apply to the entire branch. Yes. That is, you can run the workbook and then just switch the branch and then run it again and just see what happens.
Yes. Perfectly. Yes, that's what I would like. I like how fast the switching is. This is incredible. Em. But one little thought, uh, would be, I just anticipate that someone might be confused, uh, what table the Omni DBT view actually points to. Can we add a comment somewhere or a comment like, "Oh, by the way, you know, when you're in the IDE, of course, help them see what this actually points to in this table now."
Yeah, we definitely could. One more question. Another question I had about...Sorry. Sorry, continue. Oh no, sorry. Sorry . Hmm, I tried... I was testing this, although I stopped a bit because I was scared I'd break everything when our omni.omni column was in the C schema... So, I guess the question about virtual schemas is, "Hmm, we've done all our development so far in the C DBT schema, I think that's our schema on omni.
And when I enabled that, I hit the save button, then the virtual schema came up . Do I need to move everything to start using this, or do I need to move all the logic to this schema? I guess so. Yes. Which then raises a question that I didn't know the answer to. Maybe Steven or Conrad knows as well, but is there an easy way for us to do this?
Is it something like a content validator or something where we could swap everything around without making people have to start over? There's a schema change request in the content validator that I haven't looked at. But that's not relevant. all the model files. All the logic, or not? No, because, for example, in a DBT schema, like tables, we have all these new dimensions, relationships, joins and all that, and then or just a step back .
What path do we want people to take from a static schema to a dynamic schema? We may not have the answer , but we should probably figure out that we have to find the answer to that question. With every person who wants to move to an MX schema, they'll start with a static one and then they'll say, "Great ."
I want to move on to this DBT workflow. I need a dynamic schema now." Yeah, well, I mean , I think I've thought about that, and I think the answer might be the recommended configuration for Omni: we set everything up as a virtual schema and just prefix their schema with something like an underscore Omni, and they do all their development there.
And then when they're actually ready to, you know, go to " Hey, I have a development workflow," they're ready, right? And in the meantime, it's just a little bit of a mental load for them to actually understand, like, "Oh, this is supported by this schema below." But I think we can describe it, and it's just the default way of doing things : everything is a virtual schema.
Then you don't have a hard time transitioning. It makes a lot of sense, and I feel like given that we're trying to set up the product to play nicely with DBT and, like with the virtual schema, I think we should probably make sure that that's pretty much the only way that can choose a client. Given that , it shouldn't be that hard to get a branch to change representation schemas.
It's a little bit tricky, but it's not the end of the world if we do it. And if someone references something like that in their model, they're referencing a virtual schema, obviously you're going to replace it. If they're not referencing a virtual schema, you're, I assume, not going to replace it, right? But that would be an anti-pattern.
Right. So, if they just go directly to the original schema, um, yeah, we don't do any replacement. Right. So yeah, I think that's the reason why you put this in and set it up right away. Right. Yeah, and what I want to add is that it's DBT-centric, and it's really nice tight integration, and it's kind of like magic that works like magic with how DBT is set up.
But that very basic mechanism, I think, makes sense for, you know, clients that are managing own ETL, and that's, you know, completely outside of DBT, we can use the same mechanism. Um, and be able to get the same development workflow where they can make their changes and make sure everything works and all that. Yeah, I was just thinking, what if someone, um, uses DBT, but for some reason can't connect us to their Git repository?
That's still useful, I guess, right? Yeah, just a toggle . Yeah, and does our UI allow us to do that? If they can't connect to their DBT repository, um, uh, they can't do that right now . Given how it all works, they could maybe do a less integrated manual version with a simple dynamic schema. Um , but to actually use that version, this tighter integration, it's based on the metadata that we get by running the DBT repository and finding out what schemas are there and what prefixes they belong to, etc., to do everything related to the product .
So there's a little bit of logic specific to DBT. Yeah. Okay. Got it. And I was just asking that as we build this, I know we're thinking about extended use cases, and people who I think have been working on this for a while, but, you know, from an SE perspective, we're also going to have to explain it during the trial runs.
Um, and have a really great experience for people when they first use this tool. So, I'm trying to keep up with all these virtual circuits and stuff, but, um, yeah, I think we're probably going to need a little bit of, um , clarification on what all of this is going to mean and how we can best explain it to our early adopters, you know, when they first get access to the product.
Yeah. And a little bit of product marketing around that. I feel like we could kind of brand it out of that. Yeah, your style, your DBT power circuit or something. Um, that might make it feel less intimidating.