Microsoft SQL Server
Esta página aún no está disponible en español. Se muestra la versión en inglés.
Connect Querri to your Microsoft SQL Server database, choose the tables to load, and ask questions about them in plain language.
Overview
Section titled “Overview”The SQL Server connector copies the tables you choose into Querri. It uses SQL Server authentication (a username and password) over the ODBC Driver 18 for SQL Server, and can reach private databases through an OpenVPN tunnel.
Prerequisites
Section titled “Prerequisites”- A SQL Server instance Querri can reach, with TCP/IP enabled
- A SQL Server login, ideally read-only (see Database user setup)
Network access
Section titled “Network access”If your server only accepts connections from known addresses, allow Querri’s outbound IP address in its firewall. For a server reachable only over a private network, use Connect via VPN (Advanced).
To enable TCP/IP on an on-premises server:
- Open SQL Server Configuration Manager.
- Go to SQL Server Network Configuration → Protocols.
- Enable TCP/IP.
- Restart the SQL Server service.
Creating the connector
Section titled “Creating the connector”-
Open the connector. Click Connect in the app rail and pick Microsoft SQL Server under Connect a data source, or click Connect on it in Settings → Connectors (admins).
-
Enter connection settings:
Field Default Connector Name SQL Server Host * Port 1433 Username * Password Database Optional; leave blank to discover from the server Trust Server Certificate On Encrypt Connection Off Connect via VPN (Advanced) Off The driver is fixed to ODBC Driver 18 for SQL Server.
-
Test the connection. Click Test connection and discover access. This creates the connector, then tests it and lists the databases and schemas the login can read.
-
Select data. Pick a database and schema (the schema defaults to
dbo). All Tables is on by default; turn it off to choose tables. Add Custom SQL Queries to load a query’s result as its own source. -
Check advanced settings. Limit rows per table is off, so every row loads.
-
Load your data. Click Save and Load Data. A progress card shows each table loading, then offers View in Library and Sync daily.
Database user setup
Section titled “Database user setup”Read-only user (recommended)
Section titled “Read-only user (recommended)”-- 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”-- 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 analytics views and access.
Verify permissions
Section titled “Verify permissions”SELECT 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';Sync scheduling
Section titled “Sync scheduling”The connector’s owner can keep SQL Server data up to date on the Schedule tab, with Full Refresh, Incremental, or both. For incremental syncs, use a cursor column that changes whenever a row does, typically a datetime2 or datetimeoffset column like ModifiedDate, or an IDENTITY column for append-only tables.
Scheduled syncs use credits when they run. See the Sync Scheduling guide.
Troubleshooting
Section titled “Troubleshooting”Cannot connect to server
Section titled “Cannot connect to server”- Check that the firewall allows Querri’s address, or that the VPN files are loaded.
- Check that SQL Server is running and TCP/IP is enabled.
- For named instances, check that the SQL Server Browser service is running.
- Check that port 1433 (or your custom port) is open.
Login failed
Section titled “Login failed”- Check the username and password.
- Check that SQL Server authentication is enabled on the server.
- Check the login exists:
SELECT * FROM sys.server_principals; - For Azure SQL, try the
username@servernameformat.
Cannot open database
Section titled “Cannot open database”- Check the database name.
- Check that the user has access to the database and that it’s online.
Certificate or encryption errors
Section titled “Certificate or encryption errors”- If the server uses a self-signed certificate, keep Trust Server Certificate on.
- If the server requires encrypted connections, turn on Encrypt Connection.
- For the strictest setup, install a valid certificate on the server, turn on Encrypt Connection, and turn off Trust Server Certificate.
Security best practices
Section titled “Security best practices”- Use read-only credentials, such as the
db_datareaderrole. - Encrypt connections with a valid server certificate where you can.
- Grant only the tables and schemas people need.
Next Steps
Section titled “Next Steps”- Database Best Practices: analytics views and access
- Connecting Databases: the shared database form in detail
- Managing Connections: change and refresh your connectors