Skip to main content

Building Real-Time Trading Dashboards With DLT and Databricks Apps

Summary

  • Real-Time Data Pipelines: Delta Live Tables' new real-time mode enables simple, cost-effective streaming pipelines that load high volumes of data with very low latency.
  • OLTP Databases: The foreach_batch_sink allows real-time data to be loaded into OLTP databases, enabling immediate updates to dashboards and faster decision-making.
  • Secure Dashboards: Databricks Apps securely hosts real-time trading dashboards powered by the Databricks Data and AI platform, providing stakeholders with instantaneous insights.

Building Real-Time Trading Dashboards With DLT and Databricks Apps

Watch: Building Real-Time Trading Dashboards With DLT and Databricks Apps
Talk by Matt Slack, Senior Specialist Solution Architect, Databricks ; Matthew Moorcroft, Specialist Solutions Architect, Databricks
this video will demonstrate how the power of DLT new real-time mode, in conjunction with the foreach_batch_sink, can enable simple, cost-effective streaming pipelines that can load high volumes of data into our OLTP database with very low latency. Once in our OLTP database, this can be used to update real-time trading dashboards, securely hosted in Databricks Apps, with the latest stock trades - enabling better, more responsive decision-making and alerting.The session will walk-through the architecture, and demonstrate how simple it is to create and manage the pipelines and apps within the Databricks environment.
Here’s more to explore:
Production ready data pipelines for analytics and AI: https://www.databricks.com/solutions/data-engineering
The Big Book of Data Engineering: https://www.databricks.com/resources/ebook/big-book-data-engineering-2nd-edition
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements

Chapters

FAQs

How does DLT real-time mode improve performance?

DLT real-time mode enables streaming pipelines to load high volumes of data with very low latency, supporting near-instantaneous dashboard updates.

What is the foreach_batch_sink?

The foreach_batch_sink is a DLT feature that processes each micro-batch and loads real-time data into OLTP databases for immediate use in applications.

What are the key components of a production-ready AI agent?

Production-ready AI agents require several key components including reliable data pipelines, robust error handling, security controls, and continuous monitoring to ensure trustworthy results. This video demonstrates how Delta Live Tables combined with Databricks Apps creates production systems that maintain data quality, handle failures gracefully, and provide audit trails for compliance. The foundation includes governance through Unity Catalog and execution oversight through monitoring and alerting.

What is the ROI of eliminating data pipelines for real-time analytics?

The ROI of eliminating data pipelines for real-time analytics is achieved through faster data ingestion, reduced infrastructure complexity, and accelerated time-to-insight that enables faster business decisions. This video showcases how Delta Live Tables streamlines pipeline orchestration and maintenance compared to traditional orchestration tools, reducing the operational burden on data teams. By simplifying pipeline management, organizations free up resources to focus on analytics and AI rather than infrastructure maintenance.

Full transcript

0:00 Introduction

Hi everyone. Uh thank you for joining us. I know it's like the last session of the day and um or one of the last sessions of the day. You're probably fairly tired from uh the other talks and uh going around the booths. So um thank you for coming and uh you know coming to see what we've got to say and I hope like you can get one or two at least tidbits of useful information from this talk. Um, so first of all, I'd like to thank our friends here at Barclays who've agreed to come and chip in.
So that basically their use case inspired this talk and the demo we're going to be doing later. So we're grateful, really grateful to them to coming along and they're going to be talking a little bit about the use case shortly. Um, obviously thank you to my colleague who's uh done most of the leg work on this as you'll see later on. So yeah, if you've got any tricky questions there for him. Uh, so I actually have two versions of this talk because the first one got rejected because the reason it got rejected was like because I put it in and they said, "Well, hang on.
Your talk's on Tuesday. All this stuff's being announced on Wednesday or Thursday." So if we did this talk on Thursday, it'll probably be quite different. So where you see certain names, you'll by tomorrow you'll think, "Ah, okay, that's what they were talking about. there's a few things but anyway lots of these things are the worst kept secrets anyway so I'm sure it'll make some sense um but basically this talk is hopefully going to give you a flavor of lots of different components which are going to be announced uh in the keynotes Wednesday Thursday this is going to talk about a real life use case which uses a lot of those components so I hope in that sense it gives you a flavor for how they can be used why data bricks is building those in the first place um and like how you can join those components together in your own use cases is okay.
So, uh, surveys, please fill them in at the end. We'd love to hear how you rate the talk, whether it was useful, whether it wasn't useful. Please be honest. Um, so we can do better talks next year. So, here's the agenda for today. Um, I won't go through it in too much detail because obviously we want to focus on the content. We do have a live demo at the end. Fingers crossed. If the demo, gods bless us, it'll work. Um yeah, but you can see from there some of the topics we're going to cover today and hopefully there's some things in there which will resonate with your use cases.

2:08 Barclays data challenge

Okay, so over to our Barclays colleagues to introduce the uh well first introduce the relationship. Sure. Uh. Um I run data platforms and data management at Barclays. What that means is basically like standardization of data is a big thing, right? uh we look to standardize across multiple domains but more importantly within a given domain like for example the trade domain we offer about 350 different products right like we are one of the big market makers uh when it comes to banking markets word so across this like we standardize um largely based on ISO and FPML standards the data platform side of things is like where the most of this talk is about um is like authoritative data data sources which hold all sorts of authoritative data i. e. when a regulator comes in we we are able to stand behind this data knowing that the quality of the data is good and we are able to present that data right so we are talking about trade stores where like all the trades and the executions are kept orders quotes that we send out to the markets right and any all the payments journals wires all those data are kept in these different authoritative data sources that's what I manage and maintain and my team does um in terms of like what we are trying to achieve or what the objectives are and the business context.
I thought I'll take a couple of minutes to set that. Right. So one of like every other big organization like we have multiple platforms, multiple sources of the truth. I know that I just said talked about ads but still copies of the data are kept right. So we are trying to get to a stage where we have a unified data platform a single source of truth so to say right. So when we have to do AI ML use cases that we go to the same source of data uh same copy of data like when we have to do analytics and we wanted to have like the flexibility of the like as well as like the power and performance of the warehouse right so um that's one of the key aspects so that we can run not just analytical use cases but also operational use cases right uh we do have structured data but we also have lot of semi-structured data.
So a platform that supports seamlessly supports and efficiently supports both these right and as I was saying like we have a plethora of different platforms and like you know Hadoop lot of spark workloads. So we wanted something that had that can provide a seamless glide path so to say like for future migrations. Finally like or finally like you know real time engineering and real time analytics which is the topic of today wherein my colleague will present what the problem is what the use cases and are going to talk about the solution proposed solution and finally we were looking for a partner and vendor who is committed to open source interoperability will be key right we like even though I said like unified data platform we are under no illusion that it'll be a single uh vendor or signal technology platform.
So interoperability is key um commitment to open source is key and a great partner is what we were looking at who will work with us hand in hand in order to achieve these objectives. With that let me hand over to talk about the challenges with real time and the opportunities as well. Great. So hi I work closely with Harsha on the data platform for Barclays and as you know we talk about traditional warehouse right I mean every warehouse has three types of injections right one is end of day one is real time and one is near real time right so any I mean when we start the development on a warehouse I mean the real time the expectation is that you know the data basically is available in the warehouse say within milliseconds microsconds whatever but as the workloads increase you realize that you know the traditional warehouse has limitations on the number of sessions that you can you know run at a particular point of time and you know your real time never stays real time I mean it becomes you know you know a minute or in certain cases when the when the workloads increase I mean it's 5 minutes or whatever right and in most in 90% of the cases for catering to the real-time warehouse I mean you basically build a solution that is outside of the warehouse so that you know business has faster access to the data and what you're seeing over here is primarily a an architecture you know that is currently used to load this real-time data into a traditional warehouse right where you batch the data though the data comes real time to the data warehouse.

6:03 Legacy architecture pain points

I mean you don't load the data real time due to the limitations that the traditional you know warehouses have. You batch the data using you know camel and other frameworks and you basically use the batch oriented nature of the warehouse to get the data to the warehouse and business gets this data in dashboards I mean five or six minutes later. So the opportunity cost that the business has I mean to view the data and make informed decisions is lost over there right.
So that's where I mean you know we basically you know got engaged with data warehouse and you know we started looking at you know avenues or opportunities on how we can use the lakeos architecture that you know data bricks provides and also cater to the real-time use case right so everything remains within the lakeos architecture rather than moving out of the lakeos architecture right so the current model that we have I mean within the firm is for real-time use cases I mean we have KDB we have you know three forge we have myriad you know tool sets that are used for real-time data injection and to harsh that also be you know comes with multiple copies of the data.
The same data is maintained in three different places and that's what and that also increase the storage cost your compute cost and everything right so that's where you know we basically you know partnered with data bricks and you know they are helping us with coming up with that unified uh solution which will not only enable the near realtime and end of day you know sort of use cases but also enable the real-time use cases that the business can you know use for informed decision making in an more efficient manner.

8:02 Proposed lakehouse solution

So over to you. Yeah. I just wanted to say like volatility is like can go super high and like very very different from the average volumes that we see right. Liberation day for example saw 3x 5x uh volumes in each of the asset classes where and like you know when you combine that in a horizontal uh authoritative data source you are like talking about like 7 billion codes suddenly right when the average is about two billion right?
Okay. So when we first tackled this problem, this was like sort of back I think about Christmas time. Uh my first thought was like what kind of tools would we typically use on data bricks to solve this problem? And this probably is a fairly like common kind of architecture that people would sort of see. There's nothing really too new here. So the first tool in the box you'd go for is traditionally structured streaming, Spark structured streaming.

8:51 Streaming limitations

Um and you know that's typically what you'd go to to do real time you know, real-time dashboarding. But there's a few pain points here and it's not as smooth as as it can be. And although maybe Spark, you know, Spark structure streaming can do the low latency, there's some issues with this approach. And the first one is in terms of ingesting. So most of these data sources come in, very few of them come in on PubSub. Some do come in on PubSub, but lots of them like come in via APIs and websockets.
So traditionally uh it's been difficult to support those custom ingest ingestion without using Scala. So it's been difficult to implement that in Python at scale. So often Scala's been used. So that's a bit of a stumbling block because we don't really want we want to have Python end to end so that the users who use this platform don't need to learn Scala to do the ingestion. There's another problem with this approach and this is that actually although structured streaming can be super low latency you know if you're doing CFKA to CFKA with structured streaming then you know you can get to around under one second latency the issue is with this approach is that we if you want to create a dashboard off that data you have to persist it somewhere so you have to persist it to a delta table now we probably all know delta tables because you're going an API round trip to blob storage that realistically you're already adding on five, six, seven, maybe even 10 seconds of latency.
And as that volume increases, if you don't optimize it correctly, that can quickly increase. So already you've got some delays to your dashboards. And then traditionally, obviously, if you're data bricks users, the D you'll be familiar that the data bricks built-in dashboards can only refresh every minute. So that's fine for many use cases but lots of times the business will come to you particularly when they start like mentioned earlier when they start getting their hands on the data and they realize the benefit of it being real time they suddenly go actually that dashboard you created that updates every minute that's not good enough we want it quicker.
So what happens then is you end up the end user dashboards the end to end latency ends up being maybe 60 70 80 90 seconds and suddenly what you said to the business you were going to position as a real time dashboard suddenly is quite laggy and the customers start complaining and so then what happens is you end up having to use an alternative approach where perhaps you use structured streaming but you then push the data to maybe a NoSQL store uh and then you have another dashboarding tool.
Perhaps you use like the PowerBI API to do a real-time refresh. But the problem with all those approaches is you're then pushing the data outside the system. You need new technologies to support. You need new governance to support and it adds complexity and adds to the learning curve. So can we do better with some of the new components which are being added particularly to delta live tables and OLTP and data bricks apps.
So these are the five components we're going to talk about in this talk which allow us to actually move that dial from instead of being like a 90-cond lag to actually being like a one or two second lag. So the first thing we're going to look at is late flow DT. So there's a bunch of new features which come into DT and some of these apply to structure streaming as well which help us to get the latency down. So the first one is real time mode that enables us to reduce the latency from structure streaming was typically like maybe one second down to less than one second particularly if you're doing things like cafa cfka to cfka or cfka to an API we've got custom data sources these are in open source spark as well these allow you to so where that initial problem that I mentioned where actually you needed scalar skills to potentially to ingest from websockets python custom streaming data sources really nice way to create portable Python connectors which can talk to multiple data sources whether they be websockets, APIs, PubSub or some other technology.

12:23 New delta live table features

So previously DT couldn't write to JDBC directly. So you'll see we've now got the for each batch sync which allows us to write to date to JDBC and you'll see how that's used in the demo later on. And then finally, we've got the new transform with state in Pandanda's API, which allows us to do use Python to do some really complex stateful manipulations. Okay, so what are the benefits of this approach? So why do this? Why not use an existing tool?
Well, yes, there's some great tools out there, you know, Prometheus, Grafana, you know, the traditional ones for doing real-time dashboarding, those kind of technologies, and they're great for this use case. But obviously, they do add layers and they do add a bit of complexity. They need infrastructure management. The users need to understand them potentially. If you're modifying dashboards, that might be quite complex.
Um, what does this approach give us over those? Well, it's very simple because all those components can be deployed very easily. Lots of them are serverless or have the option to be serverless. They can take advantage of the autoscaling that you get within DT and things like schema revolution. And we don't need additional skill sets. So potentially this is where data bricks apps comes in is potentially your data analysts can create their own apps without necessarily requiring external developer resource.
And the final point on there is quite important is all these components can be deployed very simply with data bricks asset bundles. There'll be lots of talks on that if you're interested in it. It's a way of packaging up data bricks components using like a simple um YAML structure which allows you to define the data bricks components and deploy them as you would if you were using say Terraform. So all of these can be deployed using a simple CI/CD pipeline and of course you get the governance over the top.
So the governance then is you don't need if you add an extra technology in you've got to manage the governance of that technology with this one because they all tie in or can coexist with Unity catalog they'll use the same service principles and the same uh users and groups can be used as you've got defined in Unity Catalog. Okay,. Thank you. So I'm going to dive a little bit deeper into the different components that was talking about and starting with real-time mode and real-time mode is a new execution mode that is available in Spark and it differs from the standard macrobatch mode that was is standard with Spark as well.

15:53 Real-time mode explained

The reason we created real-time mode was because there was a gap in the Spark ecosystem where we wanted to achieve subsecond latency but microbatch like the standard mode wasn't capable of handling it. And don't get me wrong, analytical like the standard microbatch mode is great for analytical queries. It has amazing throughput, but there's some situations where subsecond literacy can be critical to different customers and use cases.
Specifically, real-time mode comes into play when you have lot of machine toachine communication like was mentioning where you may potentially want to have a layer of transformations within your analytical platform but sending it out for a system to take some actions on. in trading that could be signals, it could be alerts that may notifying different systems of anomalies in the market. For the dashboard specifically, the standard execution mode is more than enough because it can achieve one to two second latency.
So for the visual part of it, no need to go to real-time mode. It's only primarily when you're focusing on machine to machine communication. In terms of how that looks like under the hood and how does this execution mode work? Well, it differs significantly in the way that Spark originally was designed to work and is the microbatch mode is very similar to the standard batch mode as well where you're doing batch processing and it's basically sequential.
We parallelize the task between multiple workers but the execution will go in steady steps. So the first stage you may be reading from the source. Second stage you do some processing and then you write to a sync and you checkpoint the progress that has happened in that execution in order to achieve subsecond latency. We had to redesign how we approach this process. And the way that this is done for real-time mode is that we'll do reading and processing in parallel.
So you'll have tasks that are continuously reading from the source and tasks that are continuously writing and processing that data to the sync. And you may think why don't we go with the real-time mode all the time if it's going to be more efficient. Well, the reason we go it's we don't choose to go with real-time mode for most use cases is because it has some caveats to it. primarily that the checkpoint as it's not being written every time you process you now get at least once guarantees which means that you may get duplicates if the pipeline fails or you stop it and you restart it.
So realtime mode it's a time bound checkpoint where you specify the time you want it to run and after a specific time you'll checkpoint the progress that has happened whereas real with standard mode every time it processes it will checkpoint so you can get exactly once guarantees but in some situations having duplicates can be acceptable as part of your pipeline and achieving that subsecond literacy is more critical to build connectors within the Spark ecosystem.

19:01 Custom streaming sources

The same way that you do a read delta, you can actually read custom source. And there's specific classes that you can extend and implement to build up your own connectors. And the use cases that we tend to see this best suited for is things like GDBC where you may not have CDC natively available. So you implement your own rest APIs where they don't have a native connector. You may have websockets that you could design your own way of managing the streaming for it as well as many other systems.
The way that we design designed it for our uh pipeline is that we have two different sources. They're coming from the same API which is a trading API but we focus on two different sources and different schemas for it. One of them is a trade data source and the other one is a quote data source and each of these will have its own class and its own definition on how it should look like how what data you expect from the source.
And overlapping both of those we have a streaming reader. And that streaming reader is common between both data sources because it's just a way of interacting with the native API. This situ like this design I would mostly recommend for situations where you really don't have native connectors. I would treat it more of a as an extra for your pipelines instead of the go-to. The reason is because it has adds it level of complexity where you have to develop your custom sources but still it's a very powerful feature that extends a lot of what's possible in Scala into Python.
Now that we've ingested our source into the platform we don't necessarily need to use transform with state and pandas for everything that we do. We may have situations where we'll read from the source write it to a table or write it to our target uh dashboard. But there are situations where doing some state analytics and processing is required. Some of you may be familiar with applying pandas with states. Not sure if anybody in the room has ever used apply pandas.

20:53 Stateful processing

Yeah, I can see a few. Well, transform with states and pandas is the version two of that. It simplifies the way that we build states of processes but also actually extends its um capabilities compared to what you were able to do with applying pandas. Applying pandas is function based. Uh transform with state in pandas is again is a class where you define how you want your state to be managed based on what data you're reading and what you want it to do.
It has way more composite types whereas applying pandas only has single value but I will not go into too much depth in terms of what you can do. It has a way more features than applying pandas. So if you ever want to do custom state processing go with transform with state. The way that we implemented it for our pipeline is we use it for something more specific where we may receive tick tick data from our trading source and we want to do some analytics and spec specifically in this situation we want to do a time weighted average.
So we basically will be ingesting the data and as we ingest the data we tell the state processor that to lag for 5 seconds in order to stabilize and get an average of what we expect the price to be and then send it out to a sync. And the way to do this with the custom state is actually makes it so much easier and it makes it easy also to govern and build pipelines this way. If we go to for each bat sync once we've processed that data we've done some analytics and we've done some transformations we want to write it out to our uh custom sync for each batch is something that has been present for many many years in spark in structure streaming specifically but it was not there for dot and that of made it have significant limitations for many use cases where you don't necessarily want to write to delta you may want to write to other systems as well and it was a really pain and customers would not adopt it because of these limitations.

22:43 For each batch sink

Thankfully, we now have it part of DT which simplifies a lot of the processing that we do in terms of writing to custom syncs and it actually increases the adoption of DT which is what we want to do to make it easier for people to build pipelines as well. You may be asking yourself as well, well, can't I use the custom source to write to these things as well? And actually that's something that I didn't say but with the custom sources you can actually build syncs as well to communicate with those APIs.
So you could potentially be able to write as well to as read over there as well. But in some situations you don't want to do that. You want to simpl keep it simple. Well for each batch it's a way of um building um your outputs towards a specific sync. In our case, we're going to be writing to OLTP, which is going to be served as a caching layer for our datab bricks apps, but you could do it for different systems as well.
Another caveat to for each bat sync, which you can see that delta is there. I would recommend you write to delta directly instead of using for each bats sync if you can because if you write to delta you'll get exactly once guarantees whereas for each bat sync suffers from the same thing that real-time mode has which is ex at least once guarantees where we are not sure about the checkpoints so you need to keep that into consideration if you get duplicates as well how did we use it so in DT there's two components that you need to use in order to use for each batch And basically that's a for each batch sync component which is very similar to what you would have in structure streaming with for each batch where you put the logic of what you want it to do.
And specifically here we're writing it to an OOLTP so GDBC connection and pretty simple process in terms of writing it to um to that database. A pinflow is a common component between a lot of different features of DT. So you could use a penflow to ingest but you can also use it to write write to different um syncs and specifically here we're using a penflow to move the data from specific tables in DT towards our for each bat sync.
We can also do that to write to different things as well. Moving on to LTP on data at data bricks. Well, OLTP is one thing that we've created data bricks in order in order to mitigate some of the challenges customers have primarily on the new class of applications that we are seeing more and more and that is where you need to mix analytics and transactions in one platform. So by leveraging OLTP the initial use cases that drove this development in datab bricks was for ML and AI models where for feature store having an OTP system actually performs better for those customers but it actually has extended by far more than more than feature stores and I'll actually talk that about that in the next slide.

25:29 Databricks OLTP

In order of what it is underneath the hood, it's a managed process service, but it has significant benefits because of being as being part of data bricks which is first UC governance. So if you're using already UC for your data platform, you can also use that for OLTP. It also has disagregated compute and storage meaning being a Postgress ser service you can actually scale it vertically you and compute can scale at different rates than your storage as well and another great thing that it has it has unified data query what that means basically is that you're able to sync your delta tables with OTP so you write to delta and you tell it to basically sync to the database that you have the workloads that we tend to see with OLTP are first the reverse ETL which is the most common one feature store where you're writing it to OTP again but also serving data to applications and this is something that we're doing in this use case where we're populating an OOLTP cache in a way with trading data that will then be used on our real-time trading dashboard.
But also the most common OLTP use case as well is now something that you can use as well which is where you're storing application state and you use it to basically um manage your application and what is happening within it. And lastly the most standard OLTP system where it is why database was created in the first place which is you have your OLTP database and you want to do ETL within the analytics platform. The fact that you could sync between both of them makes it way easier to at least ingest into um delta.
The last component of our use case is datab bricks apps and data bricks apps was created basically for the same reasons where we again seeing more and more uh data applications that are built on analytics platforms. And what databicks apps does for you is basically makes it easy to host. It makes it e makes it easy to share within the company because you can have single sign on the same governance as you have with unity catalog.

27:57 Databricks apps

It has ooth off. So it has a lot of the features out of the box. So it makes it very simple to build these applications. It also is available for any web framework which again makes it way easier to use and custom build your own dashboard applications. Um and it is very very powerful in terms of what you can do with it. In principle we use it primarily. We don't think you should be using it for building the next Facebook or anything.
It's more primarily focused on building that extending those data application data applications on your organization and making it easy to release stuff instead of relying on other systems as well. And talking about that, this is where we have kind of this table to guide the decision- making in terms of when do we use databicks apps? Do we use it for everything? Do we use it for some things? Well, the idea is that you would have um I I tend to focus on simplicity.
So, if the dashboards is good enough, you don't need uh second latency, minute latency is good enough for your teams and your use case, go with dashboards. Don't over complicate building custom applications because then you're going to have to maintain that and that takes a lot of effort and capacity from teams. But when your use case requires it and Genie for example is not fit for purpose neither because you want to do more complicated stuff that is not enabled by what Genie can offer.
Well, we take you to app frameworks and specifically on our one we're using plotly but there's many open frameworks that you can use which basically by using them will already give you a set of files and configuration files and app for you to get started. When that is not enough and you require even more complexity, then that is where we go towards custom applications and where you could host your own web application as well.
But this is all theory. We're going to hand it over to the demo. Yeah. Okay. Okay. You're looking at me like the demo's not going to work. No, it's ready. It's good. So, okay. Yeah. So like was saying so we went with um Dash for our demos. Yeah before this is your app so you want to talk through it. So yeah this is built with plotly and dash. One of the great things about um this framework is you can specify custom refresh rates particularly in this real-time use case you can specify custom refresh rates for different components on the dashboard.

30:20 Demo and conclusion

So, for example, we can have a graph that maybe updates, I think it's in this case, every 5 seconds or something like that. Um, and then perhaps the tickers could update uh more frequently. I think in this case, we've got an example here. So, actually this table at the bottom, which is fairly meaningless in its own context, but um this is updating every 500 milliseconds. And you can see that right hand column there is actually showing the end toend latency measured from when the uh when the data was read off the API.
So you can see currently we've got end to end latency of about two seconds from when the data is being rendered on the dashboard to when it was loaded off the uh quotes API. So we're doing better than our 60 seconds there. So yeah, I mean you do you want to talk through anything else on this stuff? Um yeah so a lot of this is as was saying built through Dash and basically we are relying on that OLTP server to initially load the application because obviously we're not if the user starts using the application you need to preload the data from somewhere that's where OTP kicks in and then as you want the data to be updated we simplify it so that the logic of the sync itself can actually communicate as well with the application to basically update that more frequently so that you don't rely on that latency of the database itself.
Um but yeah that this is basically gives you an idea of how you can actually rely on web frameworks. This was very simple to build. We used what was available within data bricks. Deploying it took matter of seconds to do. Getting the dashboard to work. You could buy code does it's it actually gets most of the dashboards built for you. But you can actually extend it for um or any library that you would like to use with uh with dash as well.
And yeah, it's more not sure if there was anything that was done. Yeah. And then just kind of working backwards because we wanted to make sure we showed the dashboard. We're kind of working backwards because we got a few more minutes. So this is the DT pipeline which is populating this. So this is a nice thing here in that your DT pipeline can combine kind of slow paths of data and fast paths of data because obviously you only want to ingest the data once but you probably want to write it to a delta table which is like your long-term storage where you're perhaps going to build a gold layer off it but then also this uh sync at the bottom here.
So this is what's writing to the cache to the OLTP cache. So this is doing this bottom one here is doing a for each batch writing to JDBC and you still get the great latency even though this top one is going to be much slower because it's writing to blob storage. So there's going to be like you know five or six seconds latency on this bit. This bit's still doing the sub-second latency at the bottom and we're reading from one API over here.
So just to kind of show that code which I think had in the deck as well. So this is where we're writing to JDBC there. Super simple. Obviously, this could be optimized in a lot of different ways, but this is kind of a really simple approach. Um, and then we're reading from the quotes table here. And the quotes this is defined using the this here is the Python custom streaming sync which is reading from the API. Yeah.
And you can see that you extend from an existing class. So data source is a common data source uh common class where you which you extend to build your own ones and it actually has not only data source but it has like stream readers, stream writers, batch writers, batch readers. So you can actually choose which one is for which one you need for your use case and build it up. Um again like we went only for stream reader but if we wanted for example to make it easy to load from the trading API like basically any data only any trading data for the past like year then obviously you would want didn't want wouldn't want to use stream for that.
So you potentially could build a custom source which still links together with everything to read that all that year data in one go. Yeah. So one of the really nice things about this whole approach is that once you've defined it, you just do a spark readstream. And then you give it the name of your custom streaming source or sync. So this is a really nice way you can give it to users. You can package it up. So you can build a wheel file containing your custom data source.
You can package it up, give it to users. They just run this spark. datasource. register register with the class name and then they can use this spark readstream format. They can also use it in SQL in a in a SQL statement um use it DT structure streaming wherever they want like M was saying it supports batch as well and then um they can just use this in the same way. So it's a really nice way to package up these connectors.
So yeah, I think like if you have a team like a data team, multiple sources, you could think about this team building like all these native connect well not native connectors because native but all these connectors and made them available to all the teams within the organization so that they could basically pull data from systems that they couldn't do before. Obviously there's LakeFlow connect again native connectors lakeflow connect whatever is out of the box I would generally move towards that because then you don't have to build that massive class uh but still it's very powerful for anything that you're not is not supported and yeah okay I think that's everything so yeah big thanks again go on I was just going to say the moral of the story is don't be fooled by the way we dress we do some cool stuff at bath place and uh we are hiring so And if you want to, you can you can still wear t-shirts to work.

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.