# Connecting Data Sources

How to connect your databases, data warehouses, SaaS sources and CSV files to Contextflo, so your whole team can query them from Claude or ChatGPT.

Source: https://contextflo.com/docs/data-sources/connecting

Connect your data to Contextflo so your team can query it in natural language from Claude or ChatGPT.

## Supported Data Sources

### Databases and warehouses

Contextflo connects to the following SQL databases and cloud warehouses:

- **PostgreSQL** - Popular open-source database
- **MySQL** - Widely used relational database
- **Snowflake** - Cloud data warehouse
- **Amazon Redshift** - AWS data warehouse
- **Google BigQuery** - Google Cloud data warehouse
- **Databricks** - Lakehouse platform (Unity Catalog)
- **ClickHouse** - High-performance columnar database

### CSV upload

No database? Upload a CSV directly and Contextflo hosts it as a queryable table. See [Query a CSV with Claude](https://contextflo.com/blog/query-csv-with-claude) for the workflow.

### SharePoint

Connect a SharePoint site once for your organization and pull its CSV files into Contextflo as queryable tables. See [Connect SharePoint](https://contextflo.com/docs/data-sources/sharepoint-setup.md).

### API connectors

Beyond databases, Contextflo connects to **Amplitude** so you can query product analytics the same way as your warehouse. See [Connect Amplitude to Contextflo](https://contextflo.com/docs/data-sources/amplitude-setup.md).

If you use **Klaviyo**, Contextflo ships a prebuilt Klaviyo data dictionary you can layer onto your warehouse tables, so your Klaviyo tables come pre-described without writing the context yourself.

## General Connection Process

### Step 1: Gather Connection Details

For a database or warehouse you'll typically need:

- **Host/Endpoint**: Server address
- **Port**: Database port (default varies by type)
- **Database Name**: Specific database to connect to
- **Username**: Database user
- **Password**: User password

### Step 2: Configure Firewall

Ensure your database allows connections from Contextflo:

1. Add Contextflo IPs to your allowlist
2. Enable remote connections
3. Configure security groups (for cloud databases)

### Step 3: Test Connection

Before saving:

1. Click **Test Connection**
2. Verify the success message
3. Check for any error messages

### Step 4: Sync Tables

After connecting:

1. Browse available tables
2. Select the tables to sync
3. Click **Sync Selected**
4. Wait for completion

## Connection Security

### SSL/TLS

Contextflo supports encrypted connections:

- **PostgreSQL**: SSL mode (prefer, require, verify-ca, verify-full)
- **MySQL**: SSL/TLS encryption
- **Cloud databases**: Automatically use SSL

### Credentials Storage

All credentials are:

- Encrypted at rest
- Never logged or displayed
- Stored securely, accessible only by your organization

### Read-Only Access

**Best practice:** Create a read-only database user for Contextflo:

```sql
-- PostgreSQL example
CREATE USER contextflo_readonly WITH PASSWORD 'secure_password';
GRANT CONNECT ON DATABASE your_database TO contextflo_readonly;
GRANT USAGE ON SCHEMA public TO contextflo_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO contextflo_readonly;
```

The per-database setup guides below include a full read-only script for each source.

## Troubleshooting

### Connection Timeout

**Possible causes:**

- Firewall blocking connection
- Incorrect host/port
- Database not accepting remote connections

**Solutions:**

1. Check firewall rules
2. Verify host and port
3. Enable remote access in the database config

### Authentication Failed

**Possible causes:**

- Wrong username/password
- User doesn't have permissions
- SSL required but not configured

**Solutions:**

1. Double-check credentials
2. Grant the necessary permissions
3. Enable SSL if required

### Tables Not Showing

**Possible causes:**

- Wrong database/schema
- User lacks SELECT permissions
- Tables are in a different schema

**Solutions:**

1. Verify the database name
2. Check user permissions
3. Specify the schema in the connection settings

## Per-Database Setup Guides

Each source has a step-by-step guide covering the read-only user and connection details:

- [PostgreSQL](https://contextflo.com/docs/data-sources/postgres-setup.md): default port `5432`
- [MySQL](https://contextflo.com/docs/data-sources/mysql-setup.md): default port `3306`
- [Snowflake](https://contextflo.com/docs/data-sources/snowflake-user-setup.md): account, warehouse, role
- [Amazon Redshift](https://contextflo.com/docs/data-sources/redshift-setup.md): default port `5439`
- [Google BigQuery](https://contextflo.com/docs/data-sources/bigquery-setup.md): service account JSON, project ID, dataset location
- [Databricks](https://contextflo.com/docs/data-sources/databricks-setup.md): workspace URL, HTTP path, access token
- [ClickHouse](https://contextflo.com/docs/data-sources/clickhouse-setup.md): HTTP port `8123` / HTTPS `8443`
- [Amplitude](https://contextflo.com/docs/data-sources/amplitude-setup.md): API key and secret key

## Next Steps

- [Define metrics](https://contextflo.com/docs/after-connecting-data.md#metrics-and-business-concepts)

## Need Help?

Contact support if you're having trouble connecting:

- Email: <support@contextflo.com>
