Connecting Databases
Connecting Databases
Section titled “Connecting Databases”Connect your relational and data warehouse databases to Querri for natural language querying and AI-powered analytics. Query production databases, data warehouses, and analytical stores without writing SQL.
Supported Databases
Section titled “Supported Databases”Querri supports the following database systems:
- PostgreSQL - Popular open-source relational database
- MySQL - Widely-used open-source database
- Microsoft SQL Server (MSSQL) - Enterprise relational database
- BigQuery - Google Cloud data warehouse
- Oracle Database - Enterprise relational database (development)
- Snowflake - Cloud data warehouse (development)
- Amazon Redshift - AWS data warehouse (development)
Each database type has its own connector configuration.
Adding a Database Connection
Section titled “Adding a Database Connection”Step 1: Navigate to Connectors
Section titled “Step 1: Navigate to Connectors”- Go to Settings → Connectors (
/settings/connectors) - Scroll to the Database category
- Click Connect on your database type
Step 2: Enter Connection Details
Section titled “Step 2: Enter Connection Details”You’ll need to provide the following information:
PostgreSQL / MySQL / MSSQL
Section titled “PostgreSQL / MySQL / MSSQL”Required fields:
- Display Name: Custom name for this connection (e.g., “Production DB”)
- Host: Database server address (e.g.,
db.example.comorlocalhost) - Port: Database port (default: PostgreSQL=5432, MySQL=3306, MSSQL=1433)
- Database Name: Name of the database to connect to
- Username: Database user with read permissions
- Password: Database password
Optional fields:
- SSL Mode: Enable SSL/TLS encryption (recommended for production)
- Connection Timeout: Maximum time to wait for connection (default: 30s)
Example configuration:
Display Name: Customer Analytics DBHost: analytics.mycompany.comPort: 5432Database: customer_dataUsername: querri_readonlyPassword: ••••••••••SSL Mode: requireBigQuery
Section titled “BigQuery”Required fields:
- OAuth authentication (handled automatically through popup)
- Project Selection: Choose your Google Cloud project
- Dataset: Select the dataset to query
- Table: Optionally select specific tables
Authentication process:
- Click “Connect” on BigQuery connector
- Sign in to your Google account
- Grant BigQuery permissions
- Select your project and dataset
- Connector is ready to use
Example:
Display Name: Analytics WarehouseProject: my-company-analyticsDataset: sales_dataStep 3: Test the Connection
Section titled “Step 3: Test the Connection”Before saving, click Test Connection to verify:
- Querri can reach the database server
- Credentials are correct
- The specified database exists
- Network/firewall rules allow access
Connection test results:
- ✅ Success: Connection established, connector ready to use
- ❌ Failed: Review error message and adjust configuration
Common connection errors:
Connection refused: Check host, port, and firewall settingsAuthentication failed: Verify username and passwordDatabase does not exist: Confirm database nameSSL required: Enable SSL mode in configurationTimeout: Check network connectivity or increase timeout
Step 4: Save the Connector
Section titled “Step 4: Save the Connector”Once the test succeeds, click Save to activate the connector. It will now appear in your active connections and be available to the AI assistant.
Credential Management
Section titled “Credential Management”Creating Read-Only Database Users
Section titled “Creating Read-Only Database Users”For security, create a dedicated read-only user for Querri:
PostgreSQL:
CREATE USER querri_readonly WITH PASSWORD 'secure_password';GRANT CONNECT ON DATABASE your_database TO querri_readonly;GRANT USAGE ON SCHEMA public TO querri_readonly;GRANT SELECT ON ALL TABLES IN SCHEMA public TO querri_readonly;ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO querri_readonly;MySQL:
CREATE USER 'querri_readonly'@'%' IDENTIFIED BY 'secure_password';GRANT SELECT ON your_database.* TO 'querri_readonly'@'%';FLUSH PRIVILEGES;MSSQL:
CREATE LOGIN querri_readonly WITH PASSWORD = 'secure_password';USE your_database;CREATE USER querri_readonly FOR LOGIN querri_readonly;ALTER ROLE db_datareader ADD MEMBER querri_readonly;Password Security
Section titled “Password Security”- Passwords are encrypted at rest in Querri’s database
- Use strong, unique passwords for database users
- Consider using database service accounts with limited permissions
- Rotate passwords periodically following your security policy
Query Permissions
Section titled “Query Permissions”Querri’s database connectors have read-only access by design. The AI can:
✅ Allowed operations:
- SELECT queries to retrieve data
- JOIN operations across tables
- Aggregate functions (SUM, COUNT, AVG, etc.)
- Filtering and sorting data
- View table schemas and metadata
❌ Restricted operations:
- INSERT, UPDATE, DELETE statements
- CREATE, ALTER, DROP commands
- Transaction management
- Stored procedure execution (unless explicitly read-only)
- Administrative commands
This ensures the AI cannot modify your data, even inadvertently.
Multiple Database Instances
Section titled “Multiple Database Instances”You can connect multiple instances of the same database type with different configurations:
Use cases:
- Environment separation: Production, staging, development databases
- Regional databases: Different databases per geographic region
- Departmental databases: Sales, marketing, operations databases
- Data warehouses: Separate OLTP and OLAP systems
Example setup:
PostgreSQL - Production OrdersPostgreSQL - Analytics WarehousePostgreSQL - Customer Support DBWhen querying, specify which database to use:
“From the Production Orders database, show me today’s orders” “Compare revenue in Analytics Warehouse with Production Orders”
Working with Connected Databases
Section titled “Working with Connected Databases”Once your database is connected, Querri automatically discovers your tables and schemas. Here’s how to start working with your data:
Tables Appear in Your Library
Section titled “Tables Appear in Your Library”After connecting a database:
- Navigate to your Library in Querri
- You’ll see all accessible tables from your connected database(s)
- Each table appears as a data source you can work with
- Tables are automatically refreshed to show the latest schema
Starting Projects from Database Tables
Section titled “Starting Projects from Database Tables”To analyze data from a database table:
- Go to your Library
- Find the table you want to analyze
- Click to Create Project from that table
- Start asking questions in natural language - Querri writes the SQL for you
Examples of what you can ask:
- “Show me the top 10 customers by revenue”
- “What’s the trend in sales over the last 6 months?”
- “Find all orders from last week”
- “Compare this month’s metrics to last month”
Querri handles all the SQL query writing automatically. You just ask questions naturally, and Querri translates them into optimized SQL queries against your database.
Best Practices
Section titled “Best Practices”Performance
Section titled “Performance”- Index important columns: Ensure frequently queried columns are indexed
- Limit result sets: Ask for specific data rather than full table dumps
- Use date filters: Narrow queries to relevant time periods
- Optimize views: Create database views for complex, repeated queries
Security
Section titled “Security”- IP whitelisting: HIGHLY RECOMMENDED - Whitelist Querri’s IP address (
18.189.33.77) in your database firewall - Read-only access: Always use read-only database users
- Least privilege: Grant access only to necessary tables/schemas
- Network security: Use SSL/TLS for connections over public networks
- Audit access: Monitor database logs for unusual query patterns
- Credential encryption: All passwords are encrypted at rest
Reliability
Section titled “Reliability”- Connection pooling: Use connection limits appropriate for your database
- Timeout settings: Configure reasonable timeouts for long-running queries
- High availability: Connect to load-balanced or replicated database endpoints
- Monitoring: Track query performance and connection health
Data Management
Section titled “Data Management”- Use replicas: Connect to read replicas instead of primary databases
- Schedule queries: For large analytics, consider scheduling during off-peak hours
- Archive old data: Keep tables small by archiving historical data
- Document schema: Maintain documentation of table structures and relationships
Troubleshooting
Section titled “Troubleshooting”Cannot Connect to Database
Section titled “Cannot Connect to Database”Check:
- Database server is running and accessible
- Host and port are correct
- Firewall allows connections from Querri
- Database accepts connections from remote hosts
- SSL/TLS settings match database requirements
Authentication Failures
Section titled “Authentication Failures”Check:
- Username and password are correct
- User has CONNECT permission on the database
- User account is not locked or expired
- Password doesn’t contain special characters that need escaping
Slow Queries
Section titled “Slow Queries”Optimize:
- Add indexes to frequently filtered columns
- Use specific column names instead of SELECT *
- Filter data early in the query (WHERE clauses)
- Avoid SELECT DISTINCT on large tables without indexes
- Consider creating materialized views for complex aggregations
Schema Not Visible
Section titled “Schema Not Visible”Check:
- User has SELECT permission on tables
- Tables exist in the correct schema/database
- PostgreSQL: User has USAGE permission on schema
- MSSQL: User has VIEW DEFINITION permission
Next Steps
Section titled “Next Steps”- Managing Connections - Edit, test, and remove database connections
- Data Cleaning - Clean and standardize database query results
- Data Enrichment - Enhance database data with external sources
Additional Resources
Section titled “Additional Resources”- PostgreSQL connection documentation: postgresql.org/docs
- MySQL connection parameters: dev.mysql.com
- MongoDB connection strings: mongodb.com/docs