Microsoft SQL Server
Connect Querri to your Microsoft SQL Server database to analyze data using natural language. Once connected, simply ask questions—Querri handles all the T-SQL for you.
Overview
Section titled “Overview”The SQL Server connector supports:
- SQL Server 2016+: All modern SQL Server versions
- SQL Server 2019: Full support including new features
- SQL Server 2022: Latest version support
- Azure SQL Database: Managed SQL Server on Azure
- Azure SQL Managed Instance: Enterprise features on Azure
- Amazon RDS for SQL Server: Managed SQL Server on AWS
Prerequisites
Section titled “Prerequisites”- SQL Server database instance
- Database credentials with appropriate permissions
- Network access to the database
IP Whitelisting
Section titled “IP Whitelisting”Important: For cloud-hosted databases or databases behind firewalls, whitelist the following IP address:
18.189.33.77This is Querri’s outbound IP address. Add this to your database firewall rules or security group.
Creating the Connector
Section titled “Creating the Connector”-
Navigate to Connectors
- Go to Settings → Connectors
- Click “Add Connector”
-
Select Microsoft SQL Server
- Choose “Microsoft SQL Server” from the database connectors
-
Configure Connection
Host: your-server.database.windows.netPort: 1433 (default SQL Server port)Database: your_database_nameUsername: your_usernamePassword: your_passwordOptional Settings:
- Authentication: SQL Server Authentication or Windows Authentication
- Encrypt: Enable for encrypted connections (recommended)
- Trust Server Certificate: For self-signed certificates
- Application Name: Identify Querri connections
-
Test Connection
- Click “Test Connection” to verify
- If successful, click “Save”
-
Start Analyzing
- Tables appear in your Library
- Create a project from any table
- Ask questions in natural language
Network Configuration
Section titled “Network Configuration”Azure SQL Database
Section titled “Azure SQL Database”Add firewall rule:
Rule Name: QuerriStart IP: 18.189.33.77End IP: 18.189.33.77Via Azure Portal:
- Go to your SQL Database
- Click “Set server firewall”
- Add the IP address
- Click “Save”
AWS RDS SQL Server
Section titled “AWS RDS SQL Server”Add inbound rule to security group:
Type: MS SQLProtocol: TCPPort: 1433Source: 18.189.33.77/32Description: Querri AccessOn-Premises SQL Server
Section titled “On-Premises SQL Server”Configure Windows Firewall:
New-NetFirewallRule -DisplayName "SQL Server" ` -Direction Inbound ` -Protocol TCP ` -LocalPort 1433 ` -RemoteAddress 18.189.33.77 ` -Action AllowEnable TCP/IP in SQL Server Configuration Manager:
- Open SQL Server Configuration Manager
- SQL Server Network Configuration → Protocols
- Enable TCP/IP
- Restart SQL Server service
Database User Setup
Section titled “Database User Setup”Read-Only User (Recommended)
Section titled “Read-Only User (Recommended)”Create a dedicated read-only user for Querri:
-- Create loginCREATE LOGIN querri_readonlyWITH PASSWORD = 'SecurePassword123!';
-- Switch to your databaseUSE your_database;
-- Create userCREATE USER querri_readonlyFOR LOGIN querri_readonly;
-- Grant read permissionsALTER ROLE db_datareader ADD MEMBER querri_readonly;
-- Allow view of database metadataGRANT VIEW DEFINITION TO querri_readonly;Restricting Access to Specific Tables
Section titled “Restricting Access to Specific Tables”For tighter security, grant access only to specific tables or schemas:
-- Create user with no default roleCREATE USER querri_readonly FOR LOGIN querri_readonly;
-- Grant access to specific tables onlyGRANT SELECT ON dbo.orders TO querri_readonly;GRANT SELECT ON dbo.customers TO querri_readonly;GRANT SELECT ON dbo.products TO querri_readonly;
-- Or grant access to an analytics schema onlyGRANT SELECT ON SCHEMA::analytics TO querri_readonly;See Database Best Practices for detailed guidance on creating analytics views and restricting access.
Verify Permissions
Section titled “Verify Permissions”-- Check loginSELECT * FROM sys.server_principalsWHERE name = 'querri_readonly';
-- Check user permissionsSELECT dp.name as username, dp.type_desc, o.name as object_name, p.permission_name, p.state_descFROM sys.database_permissions pJOIN sys.database_principals dp ON p.grantee_principal_id = dp.principal_idLEFT JOIN sys.objects o ON p.major_id = o.object_idWHERE dp.name = 'querri_readonly';Troubleshooting
Section titled “Troubleshooting”Cannot Connect to Server
Section titled “Cannot Connect to Server”Problem: A network-related or instance-specific error
Solutions:
- Verify IP
18.189.33.77is whitelisted - Check SQL Server is running
- Verify TCP/IP is enabled
- Check SQL Server Browser service is running (for named instances)
- Verify firewall allows port 1433
Login Failed
Section titled “Login Failed”Problem: Login failed for user
Solutions:
- Check username and password
- Verify SQL Server authentication is enabled
- Check user exists:
SELECT * FROM sys.server_principals; - Verify database name is correct
- For Azure SQL, ensure format:
username@servername
Cannot Open Database
Section titled “Cannot Open Database”Problem: Cannot open database requested by login
Solutions:
- Verify database name
- Check user has access to database
- Ensure database is online
- Grant permissions to database
SSL/TLS Errors
Section titled “SSL/TLS Errors”Problem: Certificate validation failed
Solutions:
- Enable “Trust Server Certificate” option
- Install proper SSL certificate on server
- Update connection string:
Encrypt=true;TrustServerCertificate=true;
Security Best Practices
Section titled “Security Best Practices”Enable Encryption
Section titled “Enable Encryption”Encrypt: YesTrust Server Certificate: No (use valid certificate)Use Row-Level Security
Section titled “Use Row-Level Security”For multi-tenant scenarios or data isolation:
-- Create security policyCREATE FUNCTION dbo.fn_securitypredicate(@tenant_id AS INT)RETURNS TABLEWITH SCHEMABINDINGASRETURN SELECT 1 AS resultWHERE @tenant_id = CAST(SESSION_CONTEXT(N'tenant_id') AS INT);
CREATE SECURITY POLICY TenantFilterADD FILTER PREDICATE dbo.fn_securitypredicate(tenant_id)ON dbo.ordersWITH (STATE = ON);Audit User Activity
Section titled “Audit User Activity”-- Enable database auditingCREATE DATABASE AUDIT SPECIFICATION querri_auditFOR SERVER AUDIT [Audit-Querri]ADD (SELECT ON DATABASE::your_database BY querri_readonly)WITH (STATE = ON);SQL Server Versions
Section titled “SQL Server Versions”Tested and supported:
- SQL Server 2022 ✓
- SQL Server 2019 ✓
- SQL Server 2017 ✓
- SQL Server 2016 ✓
- Azure SQL Database ✓
- Azure SQL Managed Instance ✓
Next Steps
Section titled “Next Steps”- Database Best Practices — Create analytics views and optimize for natural language queries
- Data Connectors Overview — See all available connectors
- Managing Connections — Edit and monitor your connectors