Skip to content
Docs

Connect Postgres

Early access setup guide: create a read-only login and a schema of views in your own Postgres database, connect it, and fix what the shape check finds.

Amdahl reads calls, emails, notes, accounts, contacts and deals from views you create in your own Postgres database. It signs in with a read-only login that can read one schema and nothing else, and it never writes to your database.

Postgres is in early access. Ask your Amdahl contact to turn it on for your workspace.

Before you start

  • You need the editor role or higher in your Amdahl workspace (editor, admin or owner).
  • You need a database role that can create roles and schemas, such as the owner of the database.
  • Amdahl connects over TLS and checks the server's certificate. It accepts certificates from public certificate authorities, Supabase and Amazon RDS.
  • Amdahl connects over IPv4 from one address. The setup page in Amdahl shows it. Allow inbound connections from it on your Postgres port.

Connect it

The setup page in Amdahl, under Settings, then Connections, then Postgres, takes you through these steps. Your host and schema choice stay in the page's link, so you can leave and come back.

Run the login SQL

Pick where your database runs: Supabase, Neon, Amazon RDS or Aurora, or another host. The choice changes the notes and the example connection string. The SQL is the same for every host.

The login SQL creates the read-only login Amdahl uses (amdahl_reader), an empty schema for your views (amdahl), and the grants. Replace <password> with a new password for this login, in single quotes, then run the SQL once. If a statement fails, nothing is created. A second run stops at CREATE ROLE and changes nothing.

If one database feeds several Amdahl workspaces, open One database for several workspaces and give each workspace a schema name. Amdahl then reads amdahl_<name> and signs in as amdahl_reader_<name>.

Connect and check

Enter the host, the port, the database and the password for the login. You can paste a connection string from your host to fill the host, the port and the database. Leave sslmode out, or set it to verify-full.

Press Save and check. Amdahl saves the connection string and starts a shape check. The check signs in as the login, reads the views in the schema, and lists what is missing or wrong. It writes nothing to your database. The check usually starts within a minute.

If Amdahl cannot reach the database, sign in or verify the certificate, the page names the step that failed and how to fix it. A firewall that blocks Amdahl looks like a database Amdahl cannot reach.

Create the views

Run the view SQL as the same role that ran the login SQL, so the login can read each view you create. Fill each <...> with your own table or column, and leave out a column marked optional, and the comment line above it, when you do not have that column.

ViewNeededOne row per
conversationsRequiredCall, email or note. A type column that holds call, email or note tells them apart. Without it, every row is read as a call.
accountsRequiredCompany.
contactsOptionalPerson. Conversations can link to an account through a contact's email.
dealsOptionalDeal. Needed for questions about deal stage.

After each view, press Check again. Repeat until both required views are ready.

Review

The review shows what Amdahl will read before the first sync run, and an estimate of how many of the newest conversations have no account, deal or matching email. Research hides those. Add account_id or participants to the conversations view to link them.

Wait for the first sync run

A person at Amdahl reviews each new Postgres connection before its first sync run. Amdahl emails the workspace admins when the first sync run starts and when it finishes. The first sync run reads every row of each view, so it can take a while. When it finishes, Amdahl processes the conversations it read. Research can find them once processing finishes, usually within about 15 minutes. The connection page shows the progress, then how many conversations Research can find.

Host notes

  • Supabase: in Supabase, open Connect and copy the Session pooler string, port 5432. The user is the login, a dot, then your project ref: amdahl_reader.<project-ref>.
  • Neon: use the host name Neon gives you, not an IP address. Neon finds your database from that name.
  • Amazon RDS and Aurora: the inbound rule goes in the security group of the database.
  • Other hosts: your server needs a certificate from a public certificate authority.
  • Every host: add an index on updated_at to each table behind a view, so sync runs find changed rows quickly. You can point the connection at a read replica, so sync runs put no load on your primary database.

Use an AI coding assistant

Copy for AI agent on the setup page copies a prompt with the login SQL, the view SQL and the steps. The assistant looks at your tables with read-only queries, fills in the views, and shows you each statement to run yourself. With Amdahl's MCP tools, it can run the shape check (check_database_shape, then get_shape_check) and propose a fix for each problem until the check passes. When a check fails later, Copy problems for AI agent on the connection page copies the problems and their fixes.

Remove Amdahl's access

Disconnect Postgres in Amdahl. That deletes the connection string Amdahl stored. Amdahl keeps the conversations, accounts, contacts and deals it already read until your workspace's data is deleted. Research stops showing this connection's conversations, and Amdahl leaves them out of conversation counts. That usually takes a few minutes. Amdahl also stops using this connection's accounts, contacts and deals. If you connect this database again, Amdahl reads it from the start as a new connection. POST /connections/:id/reconnect on the disconnected connection restores that same connection instead, and its conversations come back to Research. That usually takes under 2 hours. Its accounts, contacts and deals come back too. Then, in your database, run these as the role that ran the login SQL, one at a time:

sql
DROP SCHEMA amdahl CASCADE;
DROP ROLE amdahl_reader;

DROP SCHEMA removes the views in the schema. It does not touch the tables behind them.