Integrations

Postgres and warehouses

Give Memtro a read-only role on a database or warehouse: the agent reads the schema, writes the query, shows the SQL and remembers what worked.

Open Memtro

Connect a Postgres database (a warehouse, a reporting replica, an application database) and the model can read its schema and run read-only SQL. In agent mode it is told to look at the schema first, then query by the identifiers it found elsewhere (an email, an order id, a customer name).

1. Create a read-only role

Memtro runs every query in a READ ONLY transaction with a statement timeout and a row cap, but use a read-only role regardless:

create role memtro_reader login password 'choose-a-long-password';
grant connect on database warehouse to memtro_reader;
grant usage on schema public to memtro_reader;
grant select on all tables in schema public to memtro_reader;
alter default privileges in schema public grant select on tables to memtro_reader;

Repeat the grant usage and grant select lines for each schema you want visible.

2. Allow the connection

Memtro connects from its server's IP address. Allow it in your database firewall or security group, and require TLS where you can (?sslmode=require in the connection string).

3. Connect in Memtro

Dashboard → Connections → Postgres → paste the connection string:

postgresql://memtro_reader:...@db.example.com:5432/warehouse?sslmode=require

Give it a name the model will recognise ("warehouse", "reporting replica"). Optionally list the schemas to expose. Choose personal or shared.

4. Databases on a private network

If the database has no public address, open Connect through an SSH tunnel on the form and add a bastion host that can reach it: host, port (22 by default), user, and either the private key of a key pair you created for Memtro (paste the PEM file whole) or a password. Each query opens an SSH session to the bastion and forwards the Postgres connection through it. Keep the connection string pointing at the database host as the bastion sees it (often a private IP or an internal hostname), and limit the bastion account to port forwarding:

# on the bastion, in ~memtro/.ssh/authorized_keys
restrict,port-forwarding,permitopen="10.0.1.12:5432" ssh-ed25519 AAAA… memtro

The same option exists for MySQL, MariaDB and SQL Server.

What the model can do

  • postgres_schema: tables and columns, so it can write correct SQL.
  • postgres_query: one read-only SELECT or WITH query, rows capped, 20 second timeout.

Example

"Have a look at Help Scout ticket #2450 and see what you can find in the warehouse." The agent reads the ticket, takes the customer's email and order numbers, calls postgres_schema, then queries orders, shipments and payments for that customer and reports what it found and where.

Queries that worked are remembered

A query that runs and returns rows is kept in memory: an entity for the query, keyed by its text so the same query run again is one entity seen twice, and a memory saying what it was for, on which connection, over which tables, and how many rows it returned. Two things read it back. Memory search finds it like any other fact, so "how did we count Baltic's transactions last time" has an answer. And the schema tool, which the model is told to call before writing SQL, hands back the queries that worked on that connection, most recently used first, so the model adapts a join that is known to work rather than guessing it again. A personal connection's queries stay the person's own; a shared connection's are the organisation's. The same holds for MySQL, SQL Server, BigQuery, Snowflake, ClickHouse, Redshift and Athena.

Where agents remember your company

Sign in, add a provider key, create an API key and point your tools at Memtro. It takes about five minutes.

7-day free trial · card on file, nothing charged until it ends · cancel any time