Skip to content
Docs menu

Connecting data

PostgreSQL and MySQL

Connect your product or operational database. Datachef queries a synced copy, not your production database.

Connecting your product database is how you put usage data next to your CRM and marketing data. Datachef syncs a copy of the tables you choose, and every query runs against that copy. So analysis, whether it's yours or an AI agent's, never competes with your customers' traffic.

Connection fields

FieldPostgreSQLMySQL
Host
Port54323306
Database
User
Password
SSL modeSee belowSee below

SSL mode

ModeBehaviour
requireEncrypted. The server's certificate isn't checked. This is the default.
verify-fullEncrypted, and the server's certificate and hostname are verified.
preferEncrypted if the server supports it.
disableNot encrypted. Only use this for local servers.

Use a read-only user

Create a user that can only SELECT from the tables you want to sync. In PostgreSQL:

CREATE USER datachef WITH PASSWORD '...';
GRANT CONNECT ON DATABASE app TO datachef;
GRANT USAGE ON SCHEMA public TO datachef;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO datachef;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO datachef;

Point it at a read replica if you have one.

Table names

Tables in the default schema (public in PostgreSQL) are named as they are in the source. Tables in any other schema keep the schema as a prefix, so sales.orders in a connection named warehouse becomes warehouse.sales_orders. The connection's page shows the name each table was given.

Column types

JSON, JSONB and XML columns arrive as text. To read fields out of them, use DuckDB's JSON functions:

SELECT json_extract_string(properties, '$.plan') AS plan
FROM app.accounts

Incremental sync

Choose a column that increases whenever a row changes, typically updated_at. Datachef suggests date, timestamp and integer columns. A table without one should use full refresh. See sync settings.

Something missing or wrong on this page? Tell us