Skip to main content

Databricks + dbt Labs + Sigma Demo

Summary

  • Integrated data platform: This video shows how Databricks, dbt Labs and Sigma work together to load, transform and analyze retail customer and order data end-to-end.
  • Catalog organization: Data flows through raw, development and production catalogs in Unity Catalog, with dbt Cloud performing transformations to create fact and mart tables.
  • Analytics to dashboard: Sigma connects to transformed Databricks data for exploration and analysis, enabling stakeholders to create dashboards and derive insights from this video demonstrations.

Databricks + dbt Labs + Sigma Demo

Watch: Databricks + dbt Labs + Sigma Demo
Explore how Databricks, dbt Labs, and Sigma accelerate AI adoption and enable reliable data-driven decision-making at scale.

Chapters

FAQs

What is the purpose of this video?

This video shows how Databricks, dbt Labs and Sigma work together for a complete data analytics workflow—loading, transforming and analyzing data in an integrated environment.

How are catalogs organized in this video?

Data flows through three catalogs (raw for source data, development for testing and production for validated data) using Unity Catalog for governance and access control.

What does dbt Cloud do in this flow?

dbt Cloud transforms raw data through staging, testing and mart tables, creating high-quality fact tables that Sigma can then analyze and visualize.

How does Sigma complete the workflow?

Sigma connects to the transformed Databricks data to enable exploration, analysis and dashboard creation, allowing stakeholders to visualize insights and make data-driven decisions.

Full transcript

0:00 Introduction to Demo

Welcome to dates DBT labs and sigma demo in this demo uh we'll be loading some sample retail customers and uh ORD data into Data braks then we will transform this data using DVD Cloud to create a fact table and we will then use Sigma to analyze this data and create a dashboard let's first go ahead and create this um a data bricks trial we'll sign up for it all right so you have to go to sign up. datab break. com and you can click on get started for free use the express setup and type in an email address and you will receive a verification code um and once you enter that you'll be in a new data R environment created just for you I'll go ahead and create that you do the same okay once you sign up uh for the new data brakes trial um you're going to land into this workspace um a new workspace that's created for you that looks like this um so for today's demo we're only going to be uh using uh the SQL section of this workspace feel feel free to explore the other options um you know um in in your trial um but yeah let's let's go ahead and create some um load some sample data um into Data braks actually before that let's get into this uh SQL warehouses uh section here and you can see uh that there is a serverless SQL Warehouse that's already created for you um which is the that's the computer that we're going to be using uh to run these queries okay um the SQL statements so let's go ahead and copy this over I have some statements to run here let me just go ahead and kick it off okay while that's running I wanted to um you know uh let you know what what I'm doing here um so we we're creating three cataloges um raw development and production we're going to be using these cataloges as part of the dbd uh Cloud uh for transformation um um you know on dbd cloud and then um we are also providing uh some privileges uh to these catalogs and schemas um and we are creating um uh some new tables here you can see customers and sales orders and we're loading data uh from data bricks data sets these are data sets that are available out of the box um we are uh loading those uh sample data sets into these tables okay now that uh looks like the query is um query ran successfully okay um let's go ahead and look at uh query history here okay so you can see here um that you know whatever queries that we ran um you know you you'll be able to uh find it here and um with query history um you could explore uh something called uh Query profile where you can dive deep into uh the query plan um and uh go each step of uh you know how the query is executing and this really helps to uh troubleshoot things and you know performance optimize things if if necessary okay and you can also see uh you know this query has been executed by the user and it's using uh this serverless um uh Warehouse compute that uh I I showed uh just before um and it you know it lets you know the duration of the Run etc etc okay so that's a query history now let's actually go ahead and explore the catalog um this is the unity catalog um you know um this this is how it looks um so we went ahead and created uh some uh sample data uh in raw so as you can see there are three cataloges um raw development and production created and uh inside uh the raw uh C cat log uh in the default schema sorry not the default schema the retail schema you'll be able to find um two tables that are created one is the customers and other one is the sales orders you could definitely click on that explore and um you know uh these are all the different options our catalog provides um you can even uh create a I suggested uh descriptions like this um yeah this looks good let me just go ahead and accept it and that's that's that will be the description for the table you can also do the same for the you know the for the columns you know you can AI generate um you know all the comments and stuff uh for the columns um and uh you can explore let's say you know this the sample data that's that's in the customers's uh table here um and uh all the details of uh where this table is and you know uh the size and stuff like that um for permissions uh you know you can just go ahead and Grant uh different you know whatever access you need this is how it looks um if if you have additional account users um you can search for those principles and then you know provide the you know uh access necessary and uh of course there's also history on you know what what happened so far with this table and then uh you got other other stuff like lineage Etc um you know uh based on uh the queries that ran as you can see these queries that executed um used uh this customer um uh table so that's why you see it here uh you can also see it in the lineus graph this how it looks let's say this table is used Downstream um in um you know uh with some other um uh views or functions Etc all of that will show up uh on the lineage uh doesn't matter if it's a SQL python our Scala it will show up on our lineage um that's really unique to data breaks okay so that's that's basically at a at a high level what what the catalog looks like and you know uh the data sets that we created now let's jump into uh partner connect which is where we're going to be um signing up for DVD uh Cloud trial so click on the DVD typ you could also uh search it here DBT as you can see once you click on it um select the development uh catalog um and click next and you can see a SQL Warehouse is automatically picked for you um you can add the schema uh default uh here okay and then click next and as you can see um these These are privileges that are needed and it's going to be you know a new service principle is going to be created as part of the partner connect flow and um uh there's a personal access token that will be generated that way you know uh dbd Cloud can uh uh you know uh access these data sets uh within data braks and transform them um this is all the information that is going to send to dbd Cloud uh through the partner connect flow once you click on connect to dbd Cloud it will take us to a sign up page uh for a dbd cloud trial uh and this is where you create your account um and uh once the account is created again uh very similar to uh the data Bri trial uh you will be able to see a DVD um environment set up uh just for you uh but uh the good part is um you know within that environment there is already an existing connection to your datab bre workspace that you click through uh through the partner connect flow um and um you know it's already ready and set up for you so you can you know work on the Transformations create dbd models and stuff all right thanks now that you've seen how we can quickly and easily create a trial account of DBT Cloud directly from datab bricks partner connect let's hop into DBT cloud and take take a look at how we can start to develop and test data pipelines the first thing I'll want to do from our dbd Cloud interface is Click into our develop Tab and open our cloud-based IDE from here the first thing we'll want to do is use our git integration in the top right this is going to be our One-Stop shop for interacting with Version Control as this is a new DBT project the first thing I'll need to do is initialize the structure so DBT can find all of the files it's expected hitting that project initialization will create some of the foundational configuration files we need such as this DBT project.

8:49 DBT Project Initialization

Yml as well as creating the folder hierarchy that we'll use to organize our transformation logic going forward clicking into models we'll find a couple of simple example DBT models that we can use to quickly test our connection to data RS opening these up you'll see the simple declarative style that DBT transformation is written in in this instance we're just describing the shape of the data we want and letting DBT handle how this should be materialized first I'll preview this model just to make sure that the code itself is running and then I'll go ahead and hit run this will take this code and actually execute it against data bricks we can see here that run was successful meaning that we're able to connect and run this SQL directly against that data bricks instance we just spun up now I'm going to hop ahead a little bit and pull down some pre-written code that will help us walk through the data modeling techniques used within DBT now that we've pulled in some code I wrote previously which will make available after this demo for anybody that wants to walk through it in more detail I want to highlight some of the features and functions alties of this DBT project the first thing I want to do is hop into some of the key configuration files that DBT uses the first is this DBT project. yml this file will allow us to control a lot of the configuration options for the models that we're writing in DBT this is a key advantage of working with DBT as we separate the type of code that builds or describes the data we want from the code that will control how these objects are materialized and this is a key to letting users of DBT focus on what they do best writing Transformations and working with data the next key piece of configuration to start working with DBT is this packages file this packages file allows us to specify and pull in pre-written packages which are similar to libraries from other from other programming languages these pack packages allow us to use pre-built functions and functionality right out of the box with DBT now there's two packages for this project I know I want to use our DBT utils and our spark utils which will provide a lot of good functionality I'll use throughout the data modeling project there are dozens if not hundreds more of these packages so as you start your journey with DBT I'd encourage you to dive in here is it can really help bootstrap a lot of your data modeling in data projects the first thing to do this is going to be defining where our source data lives so I'll hop into my DBT models folder which contains all of our transformation logic and within there we'll hop into staging as we're looking at our source data and the lightweight staging models that we'll use to transform and sanitize that Source data let's first start with this source.

12:31 Staging Source Data

Yml file this is where we're going to define the locations within data bricks where our raw data will live in this instance I'm going to give this data set a name retail we'll use this to refer back to this data source throughout our DBT modeling that name will be associated with a specific database schema and the tables within that schema by doing this I can start to refer to this data source through this DBT Source function instead of with raw references to the data this makes our code much more portable as we move it up from a development to a QA and eventually to run in production we can do all of this without making any substitutions to the actual text of our transformation code now that we've defined these data sources let's start to make some staging models on top of them staging models are the first step within a DBT project this is where we'll take that Source data and start to transform it you can see within this model we're going to rename some columns recast data types as well as remove any duped or null values from our data set this type of cleansing of our data is the type of transformation that we'd expect to find within the staging layer of our DBT project importantly you can see how we use this Source function to refer to that retail raw data we just defined without having to hardcode references to the schema database or tables themselves down along the bottom we can see how DBT is already starting to build out our dag or the graph of these data pipelines simply because we're using these inbuilt source and reference functions within DBT with this model written let's let's go ahead and hit preview so we can get a sense of one if this code will execute and two if it's returning the type of data we'd expect so far in here everything looks correct so let's go ahead and run this model which will actually materialize it within our datab bricks instance clicking down into our run records we can look at the exact details of what ran against data bricks and pull out the spefic specific ddl or DML that we should see within the data bricks query logs as well now that we've ran this staging model let's take a look at how we can add tests to some of these columns within DBT setting the stage for strong resilient data pipelines right from the start similar to other types of configuration we've seen within DBT our data tests will be configured within these yml files in this instance I'm going to refer to the specific models we've built for example this STG retail customers model we were just looking at and I'll specify specific columns and the types of tests I want applied to each of these columns in this instance we can see that we're using our customer ID key is a primary key and so we want to make sure that field is both unique and not null in addition to these generic tests with ship out of the box with DBT we also provide a flexible testing framework where you can write any type of test you want as long as it can be written in SQL and these tests will be executed as part of your DBT pipeline as an example I might want to write an aggregated test against this retail customer table to make sure that the sum of any individual customer order is always greater than equal to zero now that we've applied some tests to this model let's take a look at this DBT build command this will both run or materialize this model as well as any of the associated data quality tests with it now that our build's successful we can take a look at our Run results and see not just that this model built correctly but also that notnull and unique test was run against that customer ID field should any of these tests be violated DBT will stop running that Pipeline and roll back the results meaning that you can always guarantee highquality resilient data is available for the people who need it now that I've been able to build and test the staging model let's take a look at how we can start to join these various staging models and build larger more meaningful analytic structures on top of them to do this I'll hop into this Marts folder as this is how we've organized models within my organization within this core folder is where I know I can find any of our main fact tables for this project opening up fact customers you can see at the top how we're able to refer back to that previous staging model similar to our source function this means we don't have to hard code exactly what object we're referring to and rather we can let DBT compile and interpret that information based on the environment and the commands I've issued to DBT in this case since I'm working in development you can see it's pulling that data from this raw DBT lay own schema again we can apply tests directly to this fact table while we build it continuing that Foundation of data quality throughout our DB pipelines DBT will also keep track of the lineage so I can very quickly refresh both this fact table and any of the models up or Downstream this means that I can ensure consistent data quality and fresh data as often as people need it while still being mindful of not running up waste within our warehouse as we're only running those models which are needed to refresh the fact tables in question we've just seen how DBT can help you quickly stage new source data and build fact tables on top of those staging models with ease all while ensuring consistent quality data at every step of your data Pipeline and this is very crucial for the type of collaboration we're talking about today in just a few moments I'll hand it off to and to show you how they can take these fact tables and quickly analyze them within Sigma but this type of collaboration also extends Upstream as any of the any of the models we've written today will be executed against data bricks as any other SQL query meaning that any existing workflow or framework we have for monitoring cost or quality DBT will plug directly into and what's even better is all of the metadata generated by this DBT project will integrate directly with unity catalog meaning that there's no extra steps to manage all of these new objects outside of data breaks thanks uh appreciate you walking us through DBT and how the DBT partner connect flow Works with Sigma Computing and from here we're actually going to step back into our data bricks environment and show how we can spin up Sigma to analyze our data that's running through our DBT pipelines from data bricks so let me go ahead I'll pull my face out of the uh frame here and what we're going to do is actually go to our data bricks trial environment um we'll navigate back to our catalog and we can see where this DBT data is actually stored so as we navigate to our catalog um if we go to production here um we'll see that we have um our DBT partner connect schema here and we have our fact customer so this is the same data that we were actually looking at within DBT one thing to point out here is the actual descriptions and metadata that was talking about so all of this is actually able to be passed through data bricks into Sigma to be able to analyze this further Sigma is a bi and analytics platform that allows non-technical and business users to interact with data at data bricks scale that they traditionally not have access to so if we actually look at our sample data here we can see all of the data that um previously produced through our DBT pipeline and start to be able to analyze this within a spreadsheet within Sigma so from here I'm actually going to navigate down to partner connect we'll go ahead and select this and then what we want to actually choose if we scroll down here is Sigma under bi and visualization we're going to go ahead and set this up with our production catalog so we'll hit next here we're use the SQL Warehouse so we can see we have a serverless SQL Warehouse that's already been spun up within our datab bricks trial environment um this is going to be used to actually interact with our data um Sigma is Al live VI an analytics platform so everything that you see within Sigma is live in real time against your data bricks data we'll then choose which catalog and schema we want this to default to within Sigma so I'll go ahead and hit add here we'll hit next and then what's going to happen on the back end is we'll actually generate a personal access token so that can connect to data BRS I'll hit next and we can actually see those connection details here if we click the drop down so here here you can see the user principle that gets created and then all of the credentials that need to be generated to create the connection so we'll go ahead and connect to Sigma Computing this is going to take us to our trial page here so from here we'll actually be able to spin up a new trial so I'm just going to call this webinar for Foundry we'll go ahead and hit continue I'm going to apply a strong password and as we create this this will bring us into our Sigma environment and we can begin to interact with that DBT data that we were looking at previously within a spreadsheet UI so we'll go to our data bricks connection you can see I have access to all of the cataloges um that I would traditionally within datab bricks this looks very similar to the data bricks data Explorer um if I click the drop down here on production we'll navigate back to our DBT partner connect data again this is live against data BRS in real time so we fired off a quick qu query to bring this data back you can see we have 100 rows of data there's nine Columns of data and then additionally all of those column descriptions that we were able to generate within data bricks are passed through to Sigma this is beneficial folks that might not necessarily be interacting with data bricks and understanding this data they can start to get an understanding of what is um contained within this data set and what all of these different columns represent additionally we can build metrics so say we had some metrics that we wanted to build build on this table that we wanted to be able to be used by multiple workbooks we could actually build that here and add additional metrics and then as we begin to build and develop further we could actually see all the lineage so all the workbooks that get produced from Sigma on this data set you'd be able to see those here as well we'll go ahead and step into this data and explore it so I'm just going to go ahead and hit explore this brings us into our spreadsheet type UI being able to have data at data brick scale but then have folks that aren't traditionally familiar with data languages like python SQL R Scola can actually go in and interact with this and what we're doing underneath the hood is actually machine generating SQL to be able to interact with this so you can see I have a column here for total order amount um I'll go ahead and convert this to currency um we also have our first order and last order date these are coming through initially as text I'm going to go ahead and change the format to date although it's not allowing me to do that there um additionally we can go and hit our transform button so I'll go ahead and convert our first order date and our last order date to dates and then from here we can actually start to interact with this just like a spreadsheet so say I wanted to understand what the difference was between the last order and first order date you'll see some of these customers only have one order so they're going to be the same but we can start to understand this a little bit further and start to do the type of analysis we would in Excel so I'll go ahead and type date in here and if we do date diff we'll choose day and then our starts going to be our first order date and then the end's going to be our last order date and this is going to give us you know a nice snapshot of what the difference is between the order dates we can actually sort this if we wanted to as well I'll just rename this column diff we could add some conditional formatting here as well if we really wanted this to pop so if I come in here I can say color scale so you can see this digital house Corporation has the most orders we can see that they've actually been customers with us for the longest period of time as we start to interact with and understand this data further we can also see that we have a mixture of both individuals and corporations here and this is kind of denoted by this tax IDE I'm going to add one more column here to kind of help delineate between these two um we'll do a quick if statement and then for our tax ID I'm going to say if this equals null this is a person and then if it equals if it's not null we're going to call this a corporation so now we can actually give this a heading and say entity type and from here we can actually start to do some spreadsheet type pivot analysis so I can go ahead and group on these so when I group these it brings them to the front and then we can look at our total ordered amount so we can actually see based on these two different types of entities who's ordering most of our product we can also take a look at our order count so we can see our Corporation are ordering at a higher volume and also have more orders additionally we could create calculations here so let's say I want to understand kind of what our average order amount is based on entity type I'll go ahead and create a calculation here and we're going to do the same kind of thing is before so you can see we're in our formula bar I'll go ahead and do a quick average order here the other part to point out here before we step into the visualization pieces we can actually see all of the aggregations and everything that's happening underneath the hood so as I go and interact with this like a spreadsheet um I can see pretty much what's happening so a lot of this is actually being calculated within the browser but our initial query down to data bricks um is here so you can actually see how long it took for Sigma to render this versus how long um it spent in the warehouse and then what that results F fetch time was um so here's you know our machine generated sign additionally we have all of our queries signed um with this Sigma um signature which then allows further debugging from here we can go ahead I'll just drag this up a little bit and we can create a visualization off this so let's say I want to build just a quick visual to help understand this this is really helpful from a spreadsheet type interface but say we need to put this in a report I'll drag our entity type up here for color and then we can actually add our value here so now we get a nice chart of this additionally we can also add some other visuals here to help this kind of pop and start to actually build out dashboards what this allows is you don't necessarily need a bi developer to actually build this so your traditional analyst and business user that wants to understand your data further can actually build their own reporting the based on the data that's coming from DBT and data brecks so I'll add one more quick visualization here just going to drag this over we'll trim our space here and then instead of having our grouping or our data be set up on that grouping I'm actually going to go ahead and add all Source columns and from here what we'd like to actually take a look at is based on our first order date I'll drag this up to our xais and we'll go by total order amount so then this gives us kind of a picture over time how customers are ordering for their first order this is obviously set up on day but I can truncate this down to month to get a better picture and visual of this during this demo we've walked through being able to take data from data bricks be able to process that through a DBT Pipeline and then finally analyze that data further within Sigma via data bricks partner connect this is very powerful because it allows non-technical and business users access to this data in a way that previously they weren't able to interact with this thank you very much to Foundry for hosting and we appreciate you watching this video

Learn more about the Databricks Data and AI platform.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.