Connect ClickHouse to ContextFlo
Step-by-step guide to create a read-only ClickHouse user and connect to ContextFlo
Last updated: 2/13/2026
Connect your ClickHouse database to ContextFlo with a dedicated read-only user.
Prerequisites
- Admin access to your ClickHouse server
- ClickHouse HTTP interface enabled (port 8123 or 8443 for HTTPS)
Setup Script
Run this in your ClickHouse client. Update the variables before running.
-- =====================================================
-- ContextFlo ClickHouse Setup Script
-- =====================================================
-- UPDATE THESE before running:
-- 1. Create a read-only user
CREATE USER IF NOT EXISTS contextflo_user
IDENTIFIED WITH sha256_password BY 'your-secure-password';
-- 2. Grant SELECT on your database
GRANT SELECT ON your_database.* TO contextflo_user;
-- 3. (Optional) Grant access to additional databases
-- GRANT SELECT ON another_database.* TO contextflo_user;
What This Script Does
- Creates a dedicated user -
contextflo_userwith password authentication - Grants read-only access - SELECT permissions on your database
Connection Details for ContextFlo
After running the script, use these details to connect:
- Host: Your ClickHouse server hostname or IP
- Port:
8123(HTTP) or8443(HTTPS) - Protocol: HTTP or HTTPS depending on your setup
- Database: Your database name (defaults to
default) - Username:
contextflo_user - Password: The password you set in the script
ClickHouse Cloud
If you're using ClickHouse Cloud:
- Find your hostname in the Cloud console (ends in
.clickhouse.cloud) - Use HTTPS protocol with port 8443
- Use the credentials from your Cloud service
Verify Permissions
To check what permissions were granted:
SHOW GRANTS FOR contextflo_user;
To test as the new user:
SELECT * FROM your_database.your_table LIMIT 10;
Security Notes
- Read-only access: This setup only grants SELECT permissions. ContextFlo cannot modify or delete your data.
- Password security: Use a secure password with at least 16 characters.
- Network access: Ensure your ClickHouse server allows connections from ContextFlo's IP addresses.
Troubleshooting
Connection Refused
Possible causes:
- HTTP interface not enabled
- Firewall blocking port 8123/8443
- Incorrect host or port
Solutions:
- Check that
http_portorhttps_portis configured in your ClickHouse server config - Verify firewall rules allow inbound traffic on the port
- Test connectivity:
curl http://your-host:8123/ping
Authentication Failed
Possible causes:
- Wrong username or password
- User doesn't exist
Solutions:
- Double-check credentials
- Verify user exists:
SELECT name FROM system.users
Permission Denied
Possible causes:
- User lacks SELECT permissions on the database
Solutions:
GRANT SELECT ON your_database.* TO contextflo_user;