AI Meets SQL: Leverage GenAI at Scale to Enrich Your Data
Summary
- AI in SQL: Databricks SQL AI functions let SQL users access large language models and traditional machine learning directly in SQL, simplifying AI integration.
- Practical use cases: Sentiment analysis, opinion mining, forecasting, and retrieval augmented generation become accessible to SQL practitioners without specialized ML knowledge.
- Enterprise adoption: Over 60% of Fortune 500 companies use Databricks SQL, making AI functions available to millions who want to incorporate AI into data workflows.
AI Meets SQL: Leverage GenAI at Scale to Enrich Your Data

Talk by Sid Taneja, Senior Engineering Manager, Databricks ; Youngbin Kim, Software Engineer, Databricks
Integrating AI into existing data workflows can be challenging, often requiring specialized knowledge and complex infrastructure. In this video, we'll share how SQL users can leverage AI/ML to access large language models (LLMs) and traditional machine learning directly from within SQL, simplifying the process of incorporating AI into data workflows. We will demonstrate how to use Databricks SQL for natural language processing, traditional machine learning, retrieval augmented generation and more. You'll learn about best practices and see examples of solving common use cases such as opinion mining, sentiment analysis, forecasting and other common AI/ML tasks.
Here's more to explore:
The best data warehouse is a lakehouse: https://www.databricks.com/product/databricks-sql
How to migrate legacy data warehouses: https://www.databricks.com/resources/ebook/migrate-your-legacy-data-warehouse-databricks
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements
FAQs
What are Databricks SQL AI functions?
SQL AI functions are easy-to-use, self-managed AI capabilities that SQL users can invoke like any other function, providing access to LLMs and traditional ML without leaving SQL.
What use cases do SQL AI functions enable?
SQL AI functions enable practical use cases including sentiment analysis, opinion mining, forecasting, retrieval augmented generation (RAG), and other common AI/ML tasks.
Why is integrating AI into SQL workflows difficult?
Integrating AI typically requires specialized knowledge, complex infrastructure, custom model management, error handling, rate limiting, and provisioning—all of which SQL AI functions simplify.
Who benefits most from SQL AI functions?
Data warehouse users and SQL practitioners benefit most, including the 60% of Fortune 500 companies using Databricks SQL who want to use AI without leaving their SQL workflows.
Full transcript
All right, I'm super excited to have all of you guys today. Uh we are going to be talking about DBSQL AI functions. Um I hope you can learn a lot uh through this session. Um this session is going to be presented by me. I also have Yong Bin uh with me who will be joining in uh for the second half of the session uh to walk you through a demo show like the cool stuff and uh in the end we'll be talking about like the road map what you can expect from the space in the future.
Um we'll we would love to sort of like connect with you after the session uh to learn what your needs are uh to learn what your experience has been if you're using AI functions today. Um so please do connect with us after the session. All right. Standard information. All right. Um, so you know, databicks uh has been a leader in data analytics for more than a decade. Um, and all throughout that time, we have invested deeply in AI through company acquisitions like Mosaic or Fennel or even striking strategic partnerships uh with, for example, the one that we did with Anthropic earlier this year.
Um these deep investments in AI have helped us to build a very successful customer offerings um across MLflow to AI builder to doing fe feature engineering to doing model serving and so on and so forth. So within this cloud of like great technology uh we have this data warehouse DBSQL uh product which is amazingly successful. Um it is used by more than 60% of Fortune 500 companies. Um so as data warehousing or DBSQL owners uh we looked at our users and we wanted to figure out what did our users really want and we heard it loud and clear that they wanted to use AI but we found that they were struggling to use um AI within their SQL workflows.
Um obviously calling custom models um you know custom model endpoints is hard. Um, if you have your own model that you want to serve, even figuring out how to serve it is hard. Um, and then on top of that, you have to deal with things like errors, rate limiting, and then figure out how to sort of like provision your pipelines, provision your model endpoints to get like the right performance and to get your workflow uh working. uh we wanted to simplify this dramatically and we did so by integrating an easy to use almost self-managed set of AI functions that you could just invoke like any other SQL function from DBSQL and that is DBSQL AI um so you might have seen this presentation last year as well we've been working on it for a year year and a half now um over the course of last one and a half years we've brought you a framework that is embedded within DBSQL and that makes tasks such as um classification um analysis sentiment analysis data masking even doing forecasting of your time series data uh a very very simple and easy to task all you need to do is invoke one of these functions um so these are a set of fully managed uh functions that just work out of the box for um and let you focus on solving your use case using AI rather than trying to figure out how to make AI work for your use case which is the thing that we wanted to aim for.
So we have a lot of like great functionality that is packed into this box. Uh this is used today by some of the largest customers uh in data bricks. Um but it's not just the capabilities uh that power this entire uh you know framework. Uh we also have a backend engine uh that basically powers the entire framework and gives you all of these capabilities at scale. Um so firstly you get access to readytouse models u through these managed uh you know functions uh that are directly integrated into the SQL syntax.
Uh so you don't have to worry about how do I bring my model, what model I should use. You just call the function and we take care of the rest. Right? Um if you want you do get access to a lot of state-of-the-art models uh that are spread across database uh foundational model API and also external models like OpenAI, GPT. It's your choice, right? So we give you the flexibility but if you don't want to deal with all of that we also give you like a full set of manage functions uh that you can just use to get your work done.
Um, apart from this, the engine lets you focus on your use cases and the all the ML engineering that went into this engine handles everything related to infrastructure tuning, fitting, scaling your pipeline, right? You don't have to worry about any of that. And the system also autoscales. So as your use cases grow, as your business grows, uh we will automatically sort of like autoscale this entire stack so that you get the right performance uh and the right TCO for your use cases.
So to dive a little bit deeper uh we have basically two classes of function uh that are built into this AI functions framework. Um so the first category of functions is what we call as classic ML. Um these are essentially functions that are not backed by LLMs. Um so in classic ML uh we provide functions such as out of the box fully managed forecasting functions that let you forecast your time series data into the future.
So if let's say you have sales data, you can try to uh you know run forecasting over your sales data. It will automatically train over the time series data and you can ask it questions like what will my sales look like in the month of July and August, right? and it should be able to answer that. Um, similarly, we also allow you to leverage uh what vector search uh indices uh to perform uh state-of-the-art KN&N searches to group your data into similar sets.
The second suite of functions are these prepackaged and self-managed LLM functions. Um, with these functions, you don't have to worry about what the model backends are and how to query those models. Uh, you can focus on the functionality you need. For example, if you want to do sentiment analysis, you can just focus on that. Or if you want to generate summaries of your data or translate from one language to the other, all you need to do is just invoke these functions.
What models get used, how these models work, how we talk to the endpoints, that is all taken care of you behind these functions. Having said that, we also understand that the previous set of L&M functions and even classic ML functions may not suffice for all your use cases, right? Uh for that reason, we've built a very powerful function in DBSQL AI uh which is called AI query. Uh this is a very generalized flexible but parameterized function that allows you to query ML models uh across both the foundational model set of APIs that are available uh but also external models such as GPT.
Uh this function allows you to talk to your LM models and get your custom use cases solved uh while allowing you to alter tune response and request interpretation that we send to the models. Um so it's not just the flexibility of this model is of the function that is powerful um you can also use this function uh in various ways in DBSQL right so combining like the power of DBSQL for example you can use this function to filter out your data so the example on on my or on your left um is basically taking u sentiments uh from customer reviews and it is trying to only print uh sentiments that are positive, right?
You could have done that with negative sentiments as well. Um on the right uh we have an example where we're taking all of the reviews in aggregate and we're trying to sort of like get a feel factor for where are my reviews trending, right? Is this like generally positive? Is it mixed or is it generally negative? Um so with a combination of all the DBSQL uh flexibility and the flexibility of AI query you can do all of these powerful use cases and many many more right so with all of these AI functions in EBSQL you can easily integrate AI into your application workflows um you can use these out ofbox self-managed AI functions that take away all of work around LLM infra setup and workload tuning.
And our customers love this, right? Uh this is an example, a quote from a customer who's uh talking about like the self-managed nature of the framework and how it is accelerating their business. This is another quote uh you know from another customer who's talking like the scale that they are able to achieve uh with these uh self-managed AI functions. So this was all great, right? And but this was all in the past, right?
What's new this year? So this year uh we have turbocharged DC DBCQL AI. Uh the framework is backed by a powerful new engine called batch inference which reduces your workload processing time from hours to minutes. uh these set of uh AI functions on this new engine is 10x faster sometimes even up to 100x faster uh than the previous version and across like all of the industry performance benchmarks. Uh we are 3x more powerful or faster and performant than any other uh AI uh suite of function that exists out there.
And performance is not the only thing that we focused on. DBSQL AI now also supports multimodality. So with AI query, you can now perform image classification, image extraction and many other analysis right from SQL. Right? So the example at the bottom shows us asking uh about you know describing what this picture is and the model responds back it may not be readable but it responds back that this is like a grassy field with like a boardwalk in between.
Um so you can do a lot of like very powerful stuff on it. In addition to that, we are very excited to announce AI parse document. Uh this is a very powerful and multi-purpose interface to extract insights, tables, charts uh from your documents. Um so if you have unstructured data um sitting in PDFs and docs um and docx uh you can use this function to be able to extract like all the insights that you wanted to extract.
Um, again this function is like very simple to use, fully managed behind the scenes, uses the foundational model API, it's scalable, performant, and it supports a broad range of document types. We've also added support for many new models. Uh, for the first time, the cloud set of family of models are available through the foundational uh model API. Uh, the foundational model API now also supports Lama 4 Maverick. Um and as before all your favorite models are also available directly uh which are queryable through the external model endpoints and then there are many many more capabilities that we've added to enhance uh your experience with AI functions in DBSQL.
Um so one of them is we've added support for uh reasoning models. These are basically multi-step reasoning models. So now you can actually invoke them with an AI query and get like much more accurate and well thought of response. Um we've added capabilities for structured output. So you can actually tell the model how you would want to see your output like in a JSON format and all. And we found that this greatly sort of like improves the quality of results that you see uh returned back from the LLMs.
Um and we've doubled down on re reliability. Um so we've added much more uh better observability right in the dashboards that are visible to you better error reporting. We've added support for fail on error. Um so the all of this ensures that you can sort of like manage your production workloads with ease on these LLM functions. So in all through the introduction of unstructured processing and multimodality coupled with better performance and improved reliability, you can generate rich insights across all your data.
Whether your data is sitting in a structured format in the form of tables or it is sitting in a PDF or an image, you can now extract information from both of these sources, combine them to generate insights to solve your business use case. Now to show you some of this functionality in action, let me invite on stage who will walk you through a demo. Thank you. So now that we have seen what AI functions are, let me show you a complete example.
And here's what we are building an interactive dashboard that analyzes 11,000 Amazon laptop reviews using only AI functions. At the top we have filters for brand and products and this control everything below. And right below the filters we have counters showing the number of reviews by sentiment. And in the middle U is feature analysis. And this bar chart here shows a sentiment for specific features like battery, display, and performance.
And when I click on negative battery reviews, the table on the right shows only battery complaints. And here I see comments like battery will die after 2 hours and battery doesn't charge. And when I search for blue screens, for example, we get views with images showing blue screen problems. And search for cracks, we see physical damage. And here's how this works. Multimodel AI looks at customer images and creates descriptions.
And these descriptions feed into a vector search index. When I type keywords in the dashboard, it performs semantic search on that index, returning images semantically similar uh to my search keywords. And we will start by testing our approach in a SQL notebook. And first we will hide brand names using AI mask uh for the demo purpose. And great you can see mask where brand names used to be in the review text. Let me create a temporary view so I can use it for subsequent steps.
Uh next sentiment analysis. Uh we will use AI analyze sentiment on this reviews. Let's run it. And we seem to have reasonable results. Now, feature analysis defines what customers say about specific parts like battery or display. uh with detailed descriptions for better accuracy. Now we will also get sentiment for each feature comment. And for this we need to first unpack unpack the strct widget using the lateral view explode and JSON functions.
Then we can apply AI analyze sentiment to each feature com. Okay, let's look at this example. This review says if you want if you want to use it everywhere, not always in the desk, this laptop is for you. Uh and then if you look at the column on the right, AI correctly found um found that as a comment about portability. Uh same for great performance looks nice and battery dies when turned off. It got performance design and battery right.
And for each feature and comment pair uh we got correct sentiments negative for battery uh and positive for performance design and uh portability. So, we now have sentiment for specific features, not just overall reviews. And this looks great. It's now time to run it on all 11 thousand uh reviews. Okay, so um let's remove the limit 10 and apply these functions to the full data set and save results into tables. Uh we could also use delta live tables for incremental updates or complex pipeline management.
Um, yeah, let's fast forward a bit. Right now, let's build a dashboard. I will create a new dashboard. Uh, go to data tab and add tables we just created. Uh, and then I will add a counter for the total number of reviews. And let me clone this and add a filter for positive reviews. And I'll do the same for negative sentiments And for feature analysis, I'm adding a bar chart for sentiment by features. I'll also add a table with feature comments and let's verify clicking bars update the table as expected.
Now I will add uh filters for brand and products Now let's work with images. First we will use read files function to get images from Unity catalog volume and we will join this with sentiment data. uh focusing on negative views to find problems in images. We will ask AI query to analyze product images for problems. I'll set this response format to get structured output with severity and description fields and importantly uh we use fires parameter to provide the image as an input to AI query and great you can see how it finds defects in images.
This is very useful for quality control, customer service support, and other use cases. Let's run this on all images in the data set and fast forwarding a bit. Now, we could use the this table directly, but for better search, let's use vector index. Uh, this helps us find similar problems even when they are described in different ways. And to keep the demo simple, here's one I prepared earlier uh using what our image um analysis results.
Back in the dashboard, I will add the image search section. And to do that, I will create a query using vector search SQL command on our vector search index Let's go back to canvas and add a table that shows vector search widgets and let's also add a filter for the keyword parameter. Now you just can search images by typing keywords. Blue screen um finds blue screen images So this combines vector search with multimodal AI for powerful analysis tools.
And that's it. a complete analytics pipeline built with AI functions from text analysis to image processing all using simple SQL SQL queries. All right, next I want to talk about what's coming up. First, we are doubling down on unstructured data. Uh we will have more features for deeper insights from documents and other data types such as audio. And second, we will introduce serverless CPU inference. This means users don't need to set up model serving endpoints for inference.
You can just write your SQL query and let the AI functions handle the rest. We will also bring more traditional machine learning features directly into SQL uh making it easy to get insights from your data using classic models such as linear regression, random phase, logistic regressions and so on. And finally uh batsy vector search we will introduce scalable vector operation for large data sets. Okay. So if you are interested in um these upcoming features or have any feedbacks about uh existing features please share you please share your use case and connect with us using this QR code.
That's it. Thank you.
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.