{"id":4530,"date":"2025-01-18T07:11:39","date_gmt":"2025-01-18T07:11:39","guid":{"rendered":"https:\/\/cloudxlab.com\/blog\/?p=4530"},"modified":"2025-10-09T08:24:44","modified_gmt":"2025-10-09T08:24:44","slug":"text-to-sql-building-an-llm-powered-analytics-dashboard","status":"publish","type":"post","link":"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/","title":{"rendered":"Text to SQL: Building an LLM-Powered Analytics Dashboard"},"content":{"rendered":"\n<p>In today&#8217;s world, data is being generated at an unprecedented rate, and extracting meaningful insights from this data has become a crucial task for businesses and organizations. Traditional analytics tools can often be complex, requiring technical expertise to understand and use effectively. But what if we could simplify this process, making it as easy as asking a question?<\/p>\n\n\n\n<p>Imagine a tool that combines the power of natural language processing with the precision of structured data analytics. That\u2019s exactly what we can achieve by building an LLM-powered analytics dashboard. By leveraging large language models (LLMs) like OpenAI\u2019s GPT and integrating them with database querying capabilities, we can empower users to get valuable insights simply by asking questions in plain language.<\/p>\n\n\n\n<p><img src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXc8F74YdimDLMSrk6E2OrGfLKdwnrSsCgROQPPADG2Wl5DBNK7MnAxFqTl5nyhLrV0eghfKnYFOVt4NgjQ0db0fSfIFxug5p9Fi8CCbj6_LfMF-h_DqmQ61GqAfOeNKTy6-3Svc9Q?key=RUAoVYmguVxdA0WKc_9NVkBh\" width=\"624\" height=\"356\"><\/p>\n\n\n\n<p>In this blog, we\u2019ll walk you through the process of building an LLM-powered analytics dashboard using Langchain, OpenAI&#8217;s GPT models, and a simple SQLite database. Whether you&#8217;re new to LLMs or just looking to enhance your existing data tools, this guide will help you create a powerful, intuitive interface for querying and analyzing data. The github link to the project is at: <a href=\"https:\/\/github.com\/cloudxlab\/text-to-sql\">https:\/\/github.com\/cloudxlab\/text-to-sql<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div style=\"max-width: 1778px;\"><div style=\"left: 0; width: 100%; height: 0; position: relative; padding-bottom: 56.25%;\"><iframe title=\"Text to SQL: Building an LLM-Powered Analytics Dashboard for Your Company\" src=\"\/\/if-cdn.com\/YTKaFe6?maxheight=1000\" style=\"top: 0; left: 0; width: 100%; height: 100%; position: absolute; border: 0;\" allowfullscreen scrolling=\"no\" allow=\"accelerometer *; clipboard-write *; encrypted-media *; gyroscope *; picture-in-picture *; web-share *;\"><\/iframe><\/div><\/div><script type=\"text\/javascript\">window.addEventListener(\"message\",function(e){\n                window.parent.postMessage(e.data,\"*\");\n            },false);<\/script>\n<\/div><\/figure>\n\n\n\n<!--more-->\n\n\n\n<h3 id=\"block-a88b3ac1-9d9b-493a-8e4d-4b43f0d897bd\">What is LLM?<\/h3>\n\n\n\n<p>An LLM, or <strong>Large Language Model<\/strong>, is a type of artificial intelligence (AI) model designed to understand, generate, and process human-like text based on vast amounts of data it has been trained on. These models, such as OpenAI&#8217;s GPT (Generative Pre-trained Transformer), use advanced machine learning techniques, particularly deep learning, to predict and generate text based on given prompts.<\/p>\n\n\n\n<h3>Key Features of LLMs:<\/h3>\n\n\n\n<ol><li><strong>Natural Language Understanding<\/strong>: LLMs can interpret and respond to natural language inputs, making them ideal for conversational interfaces, summarization, and more.<\/li><li><strong>Context Awareness<\/strong>: They maintain contextual coherence in conversations, enabling meaningful and contextually relevant responses.<\/li><li><strong>Versatility<\/strong>: LLMs can perform a range of tasks, including answering questions, generating text, code, and creative writing, and assisting in research.<\/li><\/ol>\n\n\n\n<h3>Application in Analytics Dashboards:<\/h3>\n\n\n\n<p>When integrated with analytics tools, LLMs enhance user experience by:<\/p>\n\n\n\n<ul><li>Allowing users to query data in plain language without requiring SQL or coding expertise.<\/li><li>Providing intuitive and human-like interactions.<\/li><li>Simplifying the process of extracting insights from structured and unstructured data.<\/li><\/ul>\n\n\n\n<p>For example, an LLM-powered analytics dashboard can translate a user&#8217;s plain-language question like &#8220;What were the top-selling products last quarter?&#8221; into a database query, retrieve the data, and present it in an easy-to-understand format. This integration democratizes data analytics, making it accessible to non-technical users.<\/p>\n\n\n\n<h3><strong>What is an LLM-Powered Analytics Dashboard?<\/strong><\/h3>\n\n\n\n<p>An <strong>LLM-Powered Analytics Dashboard<\/strong> is a smart solution that lets users ask questions in natural language, and in return, the system automatically generates and executes the corresponding SQL queries to retrieve the desired data. This creates a seamless, user-friendly interface that does not require any knowledge of SQL or database schema.<\/p>\n\n\n\n<p>For example, instead of manually crafting SQL queries like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\nSELECT COUNT(\"EmployeeId\") FROM employees; <\/pre>\n\n\n\n<p>Users can simply ask:<\/p>\n\n\n\n<ul><li>&#8220;How many employees are there currently?&#8221;<\/li><li>&#8220;Where does Andrew Adams live?&#8221;<\/li><\/ul>\n\n\n\n<p>The system will handle the rest, generating SQL queries, executing them, and providing an easy-to-understand response.<\/p>\n\n\n\n<h3><strong>What is Query Generation with LLMs?<\/strong><\/h3>\n\n\n\n<p><strong>Query generation with LLMs<\/strong> involves using AI models like GPT to transform natural language questions into database queries, such as SQL. This capability allows users to interact with databases using plain language, eliminating the need for advanced SQL knowledge.<\/p>\n\n\n\n<p><strong>1. System Prompt<\/strong>:<\/p>\n\n\n\n<p>The system prompt instructs the Large Language Model (LLM) on how to handle the user&#8217;s query. It provides the context that the LLM is a <strong>MySQL expert<\/strong>. The system prompt template is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>css Code:<\/strong>\n \"You are a MySQL expert. Given the database schema {database_schema} and below user's query, generate a SQL query. {user_question}\" <\/pre>\n\n\n\n<p>This means that the LLM will:<\/p>\n\n\n\n<ul><li>Understand the structure of the database from the <strong>Database Schema<\/strong>.<\/li><li>Use this knowledge to interpret the <strong>User&#8217;s Query<\/strong>.<\/li><li>Generate a valid and accurate <strong>SQL Query<\/strong>.<\/li><\/ul>\n\n\n\n<h4><strong>2. Database Schema<\/strong>:<\/h4>\n\n\n\n<p>The <strong>Database Schema<\/strong> defines the structure of the database. In this example, the schema describes a table named Orders:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\n CREATE TABLE Orders (\n &nbsp;&nbsp;&nbsp; OrderID INTEGER NOT NULL AUTO_INCREMENT,\n &nbsp;&nbsp;&nbsp; UserID INTEGER,\n &nbsp;&nbsp;&nbsp; OrderDate DATETIME NOT NULL,\n &nbsp;&nbsp;&nbsp; TotalAmount DECIMAL(10, 2) NOT NULL,\n &nbsp;&nbsp;&nbsp; PRIMARY KEY (OrderID),\n &nbsp;&nbsp;&nbsp; CONSTRAINT orders_ibfk_1 FOREIGN KEY(UserID) REFERENCES User(UserID)\n ); <\/pre>\n\n\n\n<h3><strong>3. User&#8217;s Question<\/strong><\/h3>\n\n\n\n<p>The <strong>User&#8217;s Question<\/strong> specifies the information they are looking for. In this case:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>plaintext Code:<\/strong>\n\"How many smartphones of model 10 were ordered in February?\" <\/pre>\n\n\n\n<p>This question implies:<\/p>\n\n\n\n<ul><li><strong>Smartphone Model<\/strong>: Focus is on &#8220;model 10.&#8221;<\/li><li><strong>Month<\/strong>: The month is February.<\/li><li><strong>Count<\/strong>: The result should return the number of such orders.<\/li><\/ul>\n\n\n\n<h3><strong>4. Final Prompt<\/strong><\/h3>\n\n\n\n<p>The <strong>Final Prompt<\/strong> is a combination of the <strong>System Prompt<\/strong>, <strong>Database Schema<\/strong>, and <strong>User&#8217;s Question<\/strong>. It provides all necessary context for the LLM to generate the SQL query.<\/p>\n\n\n\n<p>The <strong>Final Prompt<\/strong> combines:<\/p>\n\n\n\n<ul><li><strong>System Prompt<\/strong>: The LLM\u2019s role as a MySQL expert.<\/li><li><strong>Database Schema<\/strong>: The structure of the database.<\/li><li><strong>User&#8217;s Question<\/strong>: A natural language query, such as &#8220;How many smartphones with Model 10 were sold after February this year?&#8221;<\/li><\/ul>\n\n\n\n<p>The final prompt given to the LLM is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\nSystem Prompt + Database Schema + User's question <\/pre>\n\n\n\n<p><strong>Final Prompt<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>plaintext Code:<\/strong>\n \"You are a MySQL expert. Given the database schema:\n \n CREATE TABLE `Orders` (\n &nbsp;&nbsp;&nbsp; OrderID INTEGER NOT NULL AUTO_INCREMENT,\n &nbsp;&nbsp;&nbsp; UserID INTEGER,\n &nbsp;&nbsp;&nbsp; OrderDate DATETIME NOT NULL,\n &nbsp;&nbsp;&nbsp; TotalAmount DECIMAL(10, 2) NOT NULL,\n &nbsp;&nbsp;&nbsp; PRIMARY KEY (OrderID),\n &nbsp;&nbsp;&nbsp; CONSTRAINT orders_ibfk_1 FOREIGN KEY(UserID) REFERENCES User(UserID)\n );\n \n and below user's query, generate a SQL query.\n \n User's question: 'How many smartphones of model 10 were ordered in February?'\"<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1146\" height=\"525\" src=\"https:\/\/blog.cloudxlab.com\/wp-content\/uploads\/2025\/01\/image-1.png\" alt=\"\" class=\"wp-image-4535\"\/><\/figure>\n\n\n\n<h3><strong>5. LLM<\/strong><\/h3>\n\n\n\n<p>The <strong>LLM (Language Learning Model)<\/strong> processes the Final Prompt to generate an appropriate SQL query based on:<\/p>\n\n\n\n<ul><li>Its understanding of the database schema.<\/li><li>The user&#8217;s question.<\/li><\/ul>\n\n\n\n<h3><strong>6. SQL Query<\/strong><\/h3>\n\n\n\n<p>The <strong>SQL Query<\/strong> is the output generated by the LLM:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\n SELECT COUNT(*) AS NumberOfSmartphones\n FROM Orders o\n JOIN OrderDetails od ON o.OrderID = od.OrderID\n JOIN Products p ON od.ProductID = p.ProductID\n WHERE p.ProductModel = 10\n &nbsp; AND MONTH(o.OrderDate) = 2\n &nbsp; AND YEAR(o.OrderDate) = YEAR(CURRENT_DATE);<\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"1213\" height=\"568\" src=\"https:\/\/blog.cloudxlab.com\/wp-content\/uploads\/2025\/01\/image-2.png\" alt=\"\" class=\"wp-image-4536\"\/><\/figure>\n\n\n\n<h3><strong>Setting Up the Environment<\/strong><\/h3>\n\n\n\n<p>Before diving into the code, let&#8217;s first set up the necessary environment. You&#8217;ll need to install Langchain and OpenAI&#8217;s integration. You can do this easily using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>bash Code<\/strong>:\n !pip install --upgrade --quiet langchain langchain-community langchain-openai <\/pre>\n\n\n\n<p>After installation, set up your environment by importing the required libraries and configuring the connection to your OpenAI API key.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n import openai_config\n import os\n os.environ[\"OPENAI_API_KEY\"] = openai_config.OPENAI_API_KEY <\/pre>\n\n\n\n<p>Make sure you replace <code>openai_config.OPENAI_API_KEY<\/code> with your actual OpenAI API key.<\/p>\n\n\n\n<h3><strong>Connecting to the Database<\/strong><\/h3>\n\n\n\n<p>For this demonstration, we&#8217;ll be using an <strong>SQLite<\/strong> database (chinook.db), which contains a variety of data, such as artists, albums, customers, employees, invoices, and more. Langchain\u2019s <code>SQLDatabase<\/code> utility helps connect to the database and manage queries.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n from langchain_community.utilities import SQLDatabase\n \n db = SQLDatabase.from_uri(\"sqlite:\/\/\/chinook.db\")\n print(db.dialect)\n print(db.get_usable_table_names())\n db.run(\"SELECT * FROM Artists LIMIT 10;\") <\/pre>\n\n\n\n<p>Here, we list available tables and fetch some sample data from the &#8220;Artists&#8221; table to serve as our data source.<\/p>\n\n\n\n<h3><strong>Building the Query Chain with Langchain<\/strong><\/h3>\n\n\n\n<p>Next, we need to create a query chain that translates user input into SQL queries. This is done using Langchain\u2019s <code>create_sql_query_chain<\/code> function, which integrates an LLM-based model (e.g., OpenAI&#8217;s GPT) to help translate natural language questions into SQL queries.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n from langchain.chains import create_sql_query_chain\n from langchain_openai import ChatOpenAI\n from langchain_community.llms import OpenAI \n\n \n llm = ChatOpenAI(model=\"gpt-3.5-turbo\", temperature=0, verbose=True)\n chain = create_sql_query_chain(llm, db) <\/pre>\n\n\n\n<p>The <code>create_sql_query_chain<\/code> function takes care of both generating the query and interpreting the results, ensuring a seamless interaction.<\/p>\n\n\n\n<h3><strong>Understanding the Generated Prompts<\/strong><\/h3>\n\n\n\n<p>Langchain provides useful prompts that guide the LLM in generating the right SQL queries. Here\u2019s an example of a prompt that helps the model understand how to interact with the database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n chain.get_prompts()[0].pretty_print() <\/pre>\n\n\n\n<p>This prompt essentially tells the LLM to create syntactically correct SQLite queries and use the results to generate human-readable responses:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>css Code:<\/strong>\nYou are a SQLite expert. Given an input question, first create a syntactically correct SQLite query to run, then look at the results of the query and return the answer to the input question. <\/pre>\n\n\n\n<h3><strong>Answering User Questions with SQL<\/strong><\/h3>\n\n\n\n<p>Once the chain is in place, it can respond to user queries. For instance, when a user asks, &#8220;How many employees are there currently?&#8221;, the system generates the SQL query:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\n SELECT COUNT(\"EmployeeId\") FROM employees; <\/pre>\n\n\n\n<p>The query is executed on the database, and the result, such as <code>8<\/code>, is processed by the LLM, which then returns a response like: &#8220;There are currently 8 employees.&#8221;<\/p>\n\n\n\n<p>Here&#8217;s how the interaction works:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n invoke_chain(\"How many employees are there currently?\") <\/pre>\n\n\n\n<p>This would output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\n SQL query: SELECT COUNT(\"EmployeeId\") AS \"TotalEmployees\" FROM employees;\n Result: [(8,)]\n Response: There are currently 8 employees. <\/pre>\n\n\n\n<h3><strong>Handling More Complex Questions<\/strong><\/h3>\n\n\n\n<p>The LLM can also handle more complex queries. For example, if a user asks, &#8220;Where does Andrew Adams live?&#8221;, the system generates a query that filters the employees table based on the name and fetches the relevant fields.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n invoke_chain(\"Where does Andrew Adams live?\") <\/pre>\n\n\n\n<p>This would result in:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>sql Code:<\/strong>\n SQL query: SELECT \"Address\", \"City\", \"State\", \"Country\" FROM employees WHERE \"FirstName\" = 'Andrew' AND \"LastName\" = 'Adams' LIMIT 1;\n Result: [('11120 Jasper Ave NW', 'Edmonton', 'AB', 'Canada')]\n Response: Andrew Adams lives at 11120 Jasper Ave NW, Edmonton, AB, Canada. <\/pre>\n\n\n\n<h3><strong>Full Code for Invoking the Chain<\/strong><\/h3>\n\n\n\n<p>Here\u2019s the complete code for generating SQL queries and returning user-friendly answers:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>python Code:<\/strong>\n from langchain.prompts import PromptTemplate\n from langchain.chains import LLMChain\n \n def invoke_chain(user_question):\n &nbsp;&nbsp;&nbsp; # Generate SQL query from the user's question\n &nbsp;&nbsp;&nbsp; sql_query = chain.invoke({\"question\": user_question})\n &nbsp;&nbsp;&nbsp; print(\"SQL query:\", sql_query, end=\"\\n\\n\")\n \n &nbsp;&nbsp;&nbsp; # Execute the SQL query against the database and get the result\n &nbsp;&nbsp;&nbsp; result = db.run(sql_query)\n &nbsp;&nbsp;&nbsp; print(\"Result:\", result, end=\"\\n\\n\")\n \n &nbsp;&nbsp;&nbsp; # Create a prompt template to generate a response from the SQL result\n &nbsp;&nbsp;&nbsp; answer_prompt = PromptTemplate.from_template(\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \"\"\"Given the following user question, corresponding SQL query, and SQL result, generate a proper reply to give to user\n \n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Question: {question}\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL Query: {query}\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL Result: {result}\n &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Answer: \"\"\"\n &nbsp;&nbsp;&nbsp; )\n \n &nbsp;&nbsp;&nbsp; # Generate the answer using LLMChain\n &nbsp;&nbsp;&nbsp; llm = LLMChain(llm=OpenAI(), prompt=answer_prompt)\n &nbsp;&nbsp;&nbsp; ans = llm(inputs={\"question\": user_question, \"query\": sql_query, \"result\": result})\n \n &nbsp;&nbsp;&nbsp; # Print the final response\n &nbsp;&nbsp;&nbsp; print(\"Response:\", ans['text']) <\/pre>\n\n\n\n<h3><strong>Conclusion<\/strong><\/h3>\n\n\n\n<p>Building an <strong>LLM-Powered Analytics Dashboard<\/strong> combines the best of <strong>AI<\/strong> and traditional <strong>database querying<\/strong>. By integrating <strong>Langchain<\/strong> and <strong>OpenAI\u2019s GPT models<\/strong>, you can create a powerful tool that allows users to interact with data using natural language, eliminating the need to understand SQL syntax or database structures. This solution offers a streamlined approach to business analysis, customer support, or general data exploration, making data-driven decisions more accessible and efficient for all.<\/p>\n\n\n\n<p>By enabling <strong>faster<\/strong> and <strong>simpler<\/strong> access to valuable insights, this dashboard makes interacting with complex data systems easier and more intuitive for non-technical users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s world, data is being generated at an unprecedented rate, and extracting meaningful insights from this data has become a crucial task for businesses and organizations. Traditional analytics tools can often be complex, requiring technical expertise to understand and use effectively. But what if we could simplify this process, making it as easy as &hellip; <a href=\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Text to SQL: Building an LLM-Powered Analytics Dashboard&#8221;<\/span><\/a><\/p>\n","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Text to SQL: Building an LLM-Powered Analytics Dashboard | CloudxLab Blog<\/title>\n<meta name=\"description\" content=\"We\u2019ll walk you through the process of building an LLM-powered analytics dashboard using Langchain, OpenAI&#039;s GPT models, and a simple SQLite database.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Text to SQL: Building an LLM-Powered Analytics Dashboard | CloudxLab Blog\" \/>\n<meta property=\"og:description\" content=\"We\u2019ll walk you through the process of building an LLM-powered analytics dashboard using Langchain, OpenAI&#039;s GPT models, and a simple SQLite database.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/\" \/>\n<meta property=\"og:site_name\" content=\"CloudxLab Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cloudxlab\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-18T07:11:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-09T08:24:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXc8F74YdimDLMSrk6E2OrGfLKdwnrSsCgROQPPADG2Wl5DBNK7MnAxFqTl5nyhLrV0eghfKnYFOVt4NgjQ0db0fSfIFxug5p9Fi8CCbj6_LfMF-h_DqmQ61GqAfOeNKTy6-3Svc9Q?key=RUAoVYmguVxdA0WKc_9NVkBh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CloudxLab\" \/>\n<meta name=\"twitter:site\" content=\"@CloudxLab\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"9 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/#website\",\"url\":\"https:\/\/cloudxlab.com\/blog\/\",\"name\":\"CloudxLab Blog\",\"description\":\"Learn AI, Machine Learning, Deep Learning, Devops &amp; Big Data\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/cloudxlab.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXc8F74YdimDLMSrk6E2OrGfLKdwnrSsCgROQPPADG2Wl5DBNK7MnAxFqTl5nyhLrV0eghfKnYFOVt4NgjQ0db0fSfIFxug5p9Fi8CCbj6_LfMF-h_DqmQ61GqAfOeNKTy6-3Svc9Q?key=RUAoVYmguVxdA0WKc_9NVkBh\",\"contentUrl\":\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXc8F74YdimDLMSrk6E2OrGfLKdwnrSsCgROQPPADG2Wl5DBNK7MnAxFqTl5nyhLrV0eghfKnYFOVt4NgjQ0db0fSfIFxug5p9Fi8CCbj6_LfMF-h_DqmQ61GqAfOeNKTy6-3Svc9Q?key=RUAoVYmguVxdA0WKc_9NVkBh\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/#webpage\",\"url\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/\",\"name\":\"Text to SQL: Building an LLM-Powered Analytics Dashboard | CloudxLab Blog\",\"isPartOf\":{\"@id\":\"https:\/\/cloudxlab.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/#primaryimage\"},\"datePublished\":\"2025-01-18T07:11:39+00:00\",\"dateModified\":\"2025-10-09T08:24:44+00:00\",\"author\":{\"@id\":\"https:\/\/cloudxlab.com\/blog\/#\/schema\/person\/a40e04dd3cb31718b4b508e1d6fcd335\"},\"description\":\"We\\u2019ll walk you through the process of building an LLM-powered analytics dashboard using Langchain, OpenAI's GPT models, and a simple SQLite database.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/\",\"url\":\"https:\/\/cloudxlab.com\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@id\":\"https:\/\/cloudxlab.com\/blog\/text-to-sql-building-an-llm-powered-analytics-dashboard\/#webpage\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/#\/schema\/person\/a40e04dd3cb31718b4b508e1d6fcd335\",\"name\":\"Pavani Koduru\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/cloudxlab.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09cc4b0f8389a0c67c5ea52cc4818e87?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09cc4b0f8389a0c67c5ea52cc4818e87?s=96&d=mm&r=g\",\"caption\":\"Pavani Koduru\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/posts\/4530"}],"collection":[{"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/comments?post=4530"}],"version-history":[{"count":12,"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/posts\/4530\/revisions"}],"predecessor-version":[{"id":4797,"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/posts\/4530\/revisions\/4797"}],"wp:attachment":[{"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/media?parent=4530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/categories?post=4530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudxlab.com\/blog\/wp-json\/wp\/v2\/tags?post=4530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}