Azure OpenAI Access Entire Database for Querying

hampton123 1,165 Reputation points
2024-07-25T21:05:26.23+00:00

Currently I want to use Azure OpenAI to be able to establish queries based on the tables on my database. Is there a way to allow Azure OpenAI to access my database? I eventually want users to enter in natural text through my HTML interface and then Azure OpenAI returns data based on that query.

Azure SQL Database
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,244 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. hossein jalilian 8,150 Reputation points
    2024-07-25T22:05:31.8833333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    Yes, it's possible to use Azure OpenAI to query your Azure SQL Database based on natural language input. Here's an approach to achieve this:

    1. Create a backend service that acts as an intermediary between your HTML interface, Azure OpenAI, and your SQL database
    2. When a user enters a natural language query, send it to your backend service.
    3. Use Azure OpenAI to generate a SQL query based on the user's input and your database schema
    4. Execute the generated SQL query on your Azure SQL Database
    5. Process the results and send them back to your HTML interface.

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


  2. AshokPeddakotla-MSFT 34,701 Reputation points
    2024-08-09T02:44:52.77+00:00

    hampton123 Greetings!

    Please have a look at the blogpost Revolutionizing SQL Queries with Azure Open AI and Semantic Kernel and ChatGPT + Enterprise data with Azure OpenAI and Cognitive Search and let me know if you are looking for the same.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.