SQL Connections
SQL Connections allow you to connect directly to Microsoft SQL, PostgreSQL, and MySQL databases and use them as data sources for your DataQI assistants. This enables real-time data querying and visualization directly within your conversations.
What You Can Do
- Connect to Multiple Database Types: Support for Microsoft SQL Server, PostgreSQL, and MySQL
- Browse Database Structure: View and select specific tables when adding SQL data sources
- Real-time Data Visualization: Generate charts and tables directly in chat conversations
- Persistent Results: Visualizations remain in your chat history for future reference
Supported Visualizations
- Tables
- Bar charts
- Line graphs
- Pie charts
- Donut charts
Getting Started
- Navigate to the Connections page in your DataQI dashboard
- Click Add SQL Connection
- Enter your database connection details
- Browse and select the tables you want to use as data sources
- Assign the SQL data source to your assistant
What Information Do I Need?
You’ll need:
- Database server hostname/IP
- Port number
- Database name
- Username and password
- (Optional) SSL configuration details
Can I Use Existing Database Credentials?
Yes, you can use any existing database user account that has appropriate read permissions for the tables you want to query.
Intent Detection
SQL Connections work seamlessly with DataQI’s Intent Detection feature, which automatically determines when to query your database based on user questions.
How Intent Detection Works
When you ask a question, the assistant:
- Analyzes your question for data-related intent
- Evaluates available data sources to determine if they can provide relevant information
- Automatically decides whether to query your SQL database or use existing knowledge
- Executes the appropriate action without requiring explicit instructions
What Triggers Database Queries
The assistant will automatically query your SQL database when it detects:
- Specific data requests: “Show me sales for Q3”, “What’s our current inventory?”
- Analytical questions: “Which products are performing best?”, “How are we trending?”
- Real-time information needs: “What’s the status of…”, “How many users are currently…”
- Comparative queries: “Compare this month to last month”, “Which region has the highest…”
Configuration Tips
Data Source Descriptions
The more descriptive and precise your data source descriptions are, the better the assistant can detect intent:
Good Example:
“Sales database containing customer orders, product information, and revenue data from 2020-present”
Poor Example:
“Database”
Assistant Instructions
Provide clear context about when to use data sources:
Good Example:
“Use the sales database when users ask about revenue, orders, customers, or product performance”
Poor Example:
“This assistant can access data”
Examples
Automatic Data Querying
User Question: “What were our top 5 products last month?”
Assistant Response:
- Detects intent to query sales data
- Automatically runs SQL query against sales database
- Returns formatted results with product names and sales figures
General Knowledge Questions
User Question: “What is machine learning?”
Assistant Response:
- Detects this is a general knowledge question
- Uses global knowledge without querying your database
- Provides educational response about machine learning
Context-Dependent Decisions
User Question: “How do I improve customer satisfaction?”
Assistant Response:
- Analyzes available data sources
- If customer feedback data is available, queries it for insights
- If no relevant data sources, provides general best practices
Use Cases
SQL Connections enable powerful data-driven conversations by allowing assistants to query your live database directly. Here are practical examples of how organizations are using this feature.
Business Intelligence and Reporting
Sales Performance Analysis
Scenario: A sales manager wants to understand quarterly performance trends.
Setup: Connect to your CRM database with sales tables.
Example Questions:
- “Show me sales by region for Q3”
- “What’s our top-performing product this month?”
- “Generate a chart showing monthly revenue trends”
Customer Analytics
Scenario: Marketing team needs insights into customer behavior patterns.
Setup: Connect to customer database with purchase history and demographics.
Example Questions:
- “What’s the average order value by customer segment?”
- “Show me customer acquisition trends over the past 6 months”
- “Which products are frequently bought together?”
Operations and Monitoring
Inventory Management
Scenario: Operations team needs real-time inventory insights.
Setup: Connect to inventory management system database.
Example Questions:
- “Which products are running low on stock?”
- “Show me inventory turnover rates by category”
- “What’s our current inventory value by warehouse?”
System Performance Monitoring
Scenario: IT team wants to monitor application performance metrics.
Setup: Connect to monitoring database with performance logs.
Example Questions:
- “Show me average response times for the last 24 hours”
- “Which endpoints are experiencing the most errors?”
- “Generate a chart of system load over time”
Financial Analysis
Budget Tracking
Scenario: Finance team needs to monitor spending against budgets.
Setup: Connect to financial system with budget and expense data.
Example Questions:
- “How are we performing against Q4 budget targets?”
- “Show me spending by department this month”
- “What’s our burn rate for the current quarter?”
Revenue Analysis
Scenario: Executive team wants revenue insights for board meetings.
Setup: Connect to billing and revenue databases.
Example Questions:
- “Show me monthly recurring revenue trends”
- “What’s our customer lifetime value by acquisition channel?”
- “Generate a breakdown of revenue by product line”
Customer Support
Support Ticket Analysis
Scenario: Support team wants to understand common issues and response times.
Setup: Connect to helpdesk system database.
Example Questions:
- “What are the most common support issues this week?”
- “Show me average resolution times by priority level”
- “Which agents have the highest customer satisfaction scores?”
Customer Health Monitoring
Scenario: Customer success team needs to identify at-risk accounts.
Setup: Connect to customer database with usage and engagement metrics.
Example Questions:
- “Which customers haven’t logged in for 30+ days?”
- “Show me usage patterns for customers who churned”
- “What’s the correlation between support tickets and churn risk?”
Research and Development
Product Usage Analytics
Scenario: Product team wants to understand feature adoption.
Setup: Connect to product analytics database.
Example Questions:
- “Which features are most popular among our users?”
- “Show me user engagement trends for new features”
- “What’s the conversion rate from trial to paid users?”
A/B Testing Results
Scenario: Marketing team needs to analyze campaign performance.
Setup: Connect to marketing database with campaign and conversion data.
Example Questions:
- “Show me conversion rates for our current A/B test”
- “Which email subject lines performed best last month?”
- “What’s the ROI for each marketing channel?”
Best Practices
Data Preparation
- Ensure your database tables have clear, descriptive names
- Add meaningful column descriptions where possible
- Consider creating views for complex queries that you use frequently
Assistant Configuration
- Provide clear descriptions of your data sources
- Set up specific instructions for how to interpret your data
- Configure appropriate knowledge modes for your use case
Security Considerations
- Use read-only database accounts for SQL connections
- Limit access to only necessary tables
- Regularly review and audit connection permissions
Beta Status
⚠️ This feature is currently in beta. We welcome your feedback to help us improve the experience.
During the beta phase, we recommend:
- Limiting to one SQL data source per assistant for optimal performance
- Testing with smaller datasets initially
- Reporting any issues or unexpected behavior
Troubleshooting
My Connection Test Failed. What Should I Check?
- Verify your database server is running and accessible
- Check that your credentials are correct
- Ensure the database name exists
- Verify network connectivity and firewall settings
- Check if SSL/TLS configuration is required
Assistant Not Querying Database When Expected
- Check that your data source descriptions are detailed enough
- Verify your assistant instructions mention the specific use case
- Ensure the SQL connection is properly connected and accessible
- Review the assistant’s knowledge mode settings
Assistant Querying Database Unnecessarily
- Review your data source descriptions for overly broad language
- Refine assistant instructions to be more specific about when to use data
- Consider the context of questions that trigger unwanted queries
- Check if the assistant’s knowledge mode is set appropriately
Why Can’t I See All My Tables?
Make sure the database user account has appropriate permissions to read the tables you want to access. Some tables may be hidden if the user doesn’t have sufficient privileges.
How Do I Update My Connection Settings?
You can edit your SQL connection settings from the Connections page. Changes will take effect immediately for new conversations.
Performance Issues
Why is performance slow with large datasets? Large datasets require more processing time for query execution and result formatting. We’re working on optimizations for better performance with large data volumes.
Why do I sometimes see duplicate responses? This is a known beta issue where the assistant may generate similar responses multiple times. We’re improving the response generation logic to eliminate this behavior.
What should I do if I see “I was unable to create a response”? This is another known beta issue where the assistant may display this message even after providing an answer. The response is usually still valid - this is a display issue we’re working to fix.
Security and Data
Is My Database Data Secure?
Yes, all database connections are encrypted and your data remains within your secure environment. DataQI only reads the specific tables you’ve configured and doesn’t store your database data.
Can I Control Which Tables Are Accessible?
Yes, when setting up a SQL connection, you can browse and select only the specific tables you want to make available to your assistants.
What Happens If My Database Is Temporarily Unavailable?
If your database is unavailable, the assistant will inform you that it cannot access the data source and suggest alternative approaches or ask you to check the connection.