SQL LLM App on Azure

Sai Supriya Vadali 45 Reputation points
2024-04-02T06:00:32.7366667+00:00

Hello,

I have a SQL LLM streamlit app deployed in Azure App Service. We give it a prompt, and the llm generates sql code. The LLM data source is Azure SQL Database. When I run this application locally (without deploying) it works fine, however after deploying in Azure, I keep getting this error:
User's image

Please help me and thanks.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,202 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,502 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,269 questions
0 comments No comments
{count} votes

Accepted answer
  1. Amira Bedhiafi 18,501 Reputation points
    2024-04-02T11:32:29.27+00:00

    Based on the error message you have shared, I think there is an issue with the connection between your Azure App Service and the Azure SQL Database.

    Verify that the connection string used by your application in the Azure App Service is correct and includes all necessary parameters. Sometimes, configurations that work locally might not be suitable for cloud environments due to differences in networking or security settings.

    If you are using a Managed Identity for authentication, ensure that it is properly configured and has the necessary permissions to access the Azure SQL Database.

    Or, if your Azure SQL Database is inside a virtual network, you may need to verify the VNet Integration for your Azure App Service.

    Old threads :

    https://stackoverflow.com/questions/50046158/pyodbc-login-timeout-error

    https://github.com/microsoft/msphpsql/issues/1459

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. ajkuma 24,396 Reputation points Microsoft Employee
    2024-04-04T14:01:24.82+00:00

    @Sai Supriya Vadali , Just following-up, please let us know if the suggestions shared by Amira helped, or share more details about the error.

    If the issue still persists, kindly try adding the follow-up start command
    Azure App Service Linux - Custom Startup Script for Nodejs & Python

    <startup command to launch your application>

    #!/bin/bash
    apt-get update
    apt-get install -y unixodbc-dev
    ACCEPT_EULA=Y apt-get install msodbcsql17
    
    
    

    If you’re running a (custom container), by default, if your container does not respond after 230 seconds, it will time out. (This time out can be increased by with the WEBSITES_CONTAINER_START_TIME_LIMIT app setting.) (up to a maximum of 1800)

    Kindly let us know how it goes with more info about your setup, I'll follow-up with you further.

    Please checkout this doc for more info:

    0 comments No comments

  2. Sai Supriya Vadali 45 Reputation points
    2024-04-10T03:16:26.2866667+00:00

    Hello,
    Providing the SQL DB's password fixed the issue for me.

    Thanks


  3. ajkuma 24,396 Reputation points Microsoft Employee
    2024-04-10T10:26:32.7866667+00:00

    @Sai Supriya Vadali ,Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer. They can only accept answers by others, I have summarized the answer with your solution, request you to Accept the answer, it will benefit the community find the answers quickly. Much appreciate you sharing the solution with the community.

    Scenario: Developed a SQL LLM streamlit application, which is deployed on Azure App Service. This application takes prompts from users and generates SQL code using the LLM. The data source for the LLM is an Azure SQL Database. The application works perfectly when run locally, but after deployment on Azure WebApp, it encounters an error.

    Issue:

    After deploying the SQL LLM streamlit app on Azure App Service, encounter the following error when providing prompts:

    Enter your prompt: "Posted a relevant prompt/question"

    Error: OperationalError: (pyodbc.OperationalError) ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect())') Background on this error at: https://sqlalche.me/e/20/e3q8

    Solution:

    @Sai Supriya Vadali confirmed and shared the solution that worked - thank you!
    Providing the SQL DB's password fixed the issue.

    --Please click Accept Answer - it will benefit the community to find the answers quickly.