
Omni's dbt integration: Prototyping dbt models with Omni
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
Hi there, this is Sarah from Omni solutions engineering team and today I'm going to walk you through a quick demo of how you can use Omni to prototype new DBT models. So oftent times when we're working in a BI tool because we're really focused on business logic, new ideas for transformations come up, but it's often difficult to move that transformation logic into the layer of our data stack that makes most sense.
That is to say, it often gets stuck in the BI layer and this can lead to things like non-performant dashboards or duplicative logic. In Omni, because of our birectional DBT integration, we're able to really effectively use the BI tool to prototype. So, we're taking advantage of the exploration and ease of use within this workflow while still allowing us to at the end of the day define this logic in the layer of our data stack that makes most sense.
So let's look at this through the lens of customer facts. We're bringing up this idea of customer facts that ultimately we want to build as a transformation. So here you can see that we have a table orders and stage customers and we're bringing in information about our customers. So we have customer name from stage customers and then some aggregations that we've built that are quite useful to understand how our customers are behaving.
for example, their first order date, their most recent order date, how many orders they've had with us, and their lifetime spent. Let's say this a was added to a dashboard. So, our orders overview dashboard, and has become very useful to understand our top customers. But over time, we might notice if we go into the performance profile that this is taking more time to run than we might like.
Maybe this is rather than green starting to become red. That is to say, it's slowing down the dashboard. This is where we might consider some of the levers within Omni to make this a bit more performant. Let's go back to the query itself and take a look at how it's structured. So here you can see that we're doing a join between two tables and then we have some aggregations.
And as we start to think about the structures within Omni that might help, one thing we might consider is making this a saved query view. This might be quite helpful if we want to do things like bucketing or use this as a CTE in another use case. But when it comes to performance, rather than a view, we might want to consider creating this as a table.
And that is something that DBT is very good at. So here we might consider making this a dbt model rather than some object living only in Omni. So as we look at moving this logic into DBT, we can use Omni to actually convert this to a DBT model, bringing in some of those more DBTonic ideas as we start to develop.
So you can see here we're now in dbt mode and our references have been pulled into more dbt tonic rough functions. So we're starting to get into a structure that is more dbtton tonic. Now I can go in and modify as I might want to. For example, in my case maybe I want to use CTE so it follows best practice.
In this case, what I'm going to do is just pull in a CTE for my tables. Then I'm going to do a CTE for my aggregations, another CTE for my joins, and then ultimately select from all of those. So, let me do that now. All right. So, just to walk you through that again. Here you can see I'm selecting from customers, orders, doing my aggregations.
I've added a few new ideas in here as well. Then we're doing our join and then we have our select. Now let's actually open a pull request against my DBT project. So again I can come up to model and say push to dbt repo at which point I'm prompted to name the file and the git branch as well as create a commit message.
Now that I have those renamed, let's actually open that pull request. So you'll notice here I'm pulled into my Git repository where I'm really going to fit into my workflow that's already structured for my DBT project. That is to say, I'm prompted to create a pull request and then any CI/CD workflow I have available to me will also be adhered to.
In my case, that means a DBT cloud job has been kicked off automatically. We can keep tabs on how that's going by going directly into DBT cloud here. I'll quickly just wait for that to finish and we can move on from there. All right, so our job has finished successfully. So now I'm comfortable moving this into production.
So let's go back into our poll request and merge it. From here, again, because we're plugged in directly to our CI/CD workflow within our DBT repository, other aspects of my work will be adhered to. So, if we were to go back into DBT cloud, I have a merge job kicked off already based on that uh behavior that we just did in Git.
So we can see here that this was just kicked off and it has merged our change into production. This means that that's now available as an object in my warehouse. If I want want to then use that object within Omni, all I have to do is go back to my IDE within Omni and refresh my schema. So now you can see if we go into refresh schema that new table should be made available in my uh repo here.
So we can now see that available gear, our fact customers view. And I can use it like any other object within Omni. So here's where I might go in and use things like our content validator to switch out this view for the one the query that we were using previously. Just allowing us to modify that dashboard using again software engineering best practices.
So all in all, we went from prototyping this new idea, using Omni to create this new object, continue through in a DBT workflow, and then plugging directly into our CI/CD workflow in DBT. So everything is going to live ultimately in the layer that makes most sense. Rather than locking your business logic in your BI tool, Omni really allows you to move that logic across your stack to ensure it's going to live where it makes most sense for your use case.
Thanks so much.