Klarety

PostgreSQL

Load tables from your Postgres database with a read-only login.

For everyone

Connect your PostgreSQL database and its tables come into to analyse and build apps on. The work runs on the copy, never loading the database your product runs on.

Your 's AI prepares the connection; you finish it with a user name and password that only reads.

Before you start

  • A . Its Studio's AI does the work. See Create a project.
  • A read-only database user. Never give Klarety the login your application uses. Ask your database administrator to create one, or run this as a database owner (change the names to yours):
read_only_user.sql
CREATE ROLE klarety_reader LOGIN PASSWORD 'choose-a-long-password';
GRANT CONNECT ON DATABASE your_database TO klarety_reader;
GRANT USAGE ON SCHEMA public TO klarety_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO klarety_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO klarety_reader;

The last line makes tables created later in that schema readable too, but only tables created by the user who runs these commands. Repeat the USAGE and SELECT lines for each schema you want to share.

  • The database's address (host name and port) and the database name.
  • The database must accept connections from outside your network. If it only accepts known addresses, talk to whoever runs it first.

Connect it

Open PostgreSQL

Go to Connectors, search for PostgreSQL and open it.

Send the request to a project's AI

Under Connect it with your Studio's AI, choose the Project that should use PostgreSQL. What the AI is asked starts as "Connect PostgreSQL to this project so it can load tables from your database with a read-only login." Edit it to say exactly what you want, for example: "Load the customers and orders tables from our production database, and refresh orders every night". Then select Send to AI.

The AI starts at once if the Studio is open, or when it next opens. Select Open Studio to go there.

Connecting PostgreSQL with a project's AI from the Connectors page

Finish the connection

The AI drafts the connection and never asks for a key in the chat. The draft shows as Waiting for you. Select Connect to open the Connect PostgreSQL dialog.

For a database, the dialog has two fields: User name and Password. Enter the read-only user you prepared. The dialog shows the only address the login is ever sent to, which is your database's address. Check it before you continue.

Choose what the AI may do

Under What the AI may do with it, choose Can read (nothing there changes) or Can read and change (the AI may also add, change and remove things). Then select Connect.

The Connect PostgreSQL dialog with the access choice

Test it and tell the AI

The dialog says PostgreSQL is connected. Select Test it, then Tell the AI so it carries on.

You can also start inside a project: in Settings, Keys, describe it in What do you want to connect? and select Ask AI to connect.

Keep it read-only

Choose Can read. Even with a read-only database user, this stops the AI trying to change anything.

What you get

Each table you ask for becomes a Nexus with the same columns. The AI reads it with one query per table, so you can ask for a slice: "only orders from 2025 onwards" or "only the columns we need for reporting".

  • Query the tables in the DataSQL editor and join them with your other data.
  • Ask the AI to keep a table fresh, for example every night. It builds an that reloads it on a schedule. See What agents do.
  • Decide who sees each table in Data access.

Test, pause and reconnect

A project's connections are listed in its Settings, under Keys, with their status.

A project's connections in Settings, Keys
StatusWhat it means
Waiting for youDrafted by the AI. Select Connect to finish it.
WorksConnected and usable by the project.
Needs reconnectingThe key or sign-in stopped working. Select Reconnect.
PausedNobody can use it until you select Resume.

From the same row: Test, Pause, Turn off here (this project stops using it) or Remove (deletes the key, and every Studio using it stops reaching PostgreSQL).

A connection belongs to the project it was made in. Owners and admins see all of them under Your connections on Connectors. It stays off for other projects until an admin switches it on under Projects that may use it.

If the test fails

Test reports one of these:

  • It works: the project reached the service.
  • The key was rejected: select Reconnect and enter a new one.
  • The service cannot be reached: check that it is up and accepts outside connections, then test again.
  • Internet is off: the project's internet is Off. Turn it on in its Settings. With Only allowed, the Studio reaches only its connections and the sites you add.
  • It is not connected yet: select Connect.

Specific to databases:

  • The login is refused. Check the user name and password, and that the user has CONNECT on the database. Select Reconnect to enter them again.
  • A table is missing. The read-only user cannot see it. Grant USAGE on its schema and SELECT on the table, then ask the AI again.
  • The address is not the one you expected. Do not continue. Tell the AI the correct host in the chat; the address is not a secret.

Where your key goes

The key or sign-in is encrypted with a managed key service the moment you select Connect, and not even the AI can read it. The Studio never holds the key. If the one site it is sent to is not the service's own address, Klarety warns you and asks you to type the site to confirm.

Next steps

On this page