SQL: PostgreSQL and MySQL
For Studio users who want agents to answer from a PostgreSQL or MySQL database, such as a positions and risk store, using a database user whose grants match what agents may read. The form is the same for both; only Database type differs.
Before you start: make the database reachable over TLS from the deployment. On a private deployment it must sit inside the deployment's internal service ranges (Data Bridge); a public one must accept the deployment's egress address (shown as Deployment egress IP on the Snowflake form). Studio connects with sslmode=require to PostgreSQL and with TLS by default to MySQL; with verify-ca or verify-full it also trusts the certificate authorities an administrator added to the deployment.
Steps
- In Data Bridge, click Create connector, choose SQL Database as the Connection type, and fill Name, Description and Connector Guide. Write what the database holds, for example "Daily positions, P&L attribution and realised volatility per desk"; step 5 expands it.
- Under Connection settings ("Where the database lives. Credentials are entered below and stored in AWS Secrets Manager."), fill:
- Database type: PostgreSQL or MySQL.
- Host (placeholder
localhost) and Port (placeholder5432). Leave Port blank for the database's default, or enter a whole number from 1 to 65535. - Database Name: required.
- Schema (Optional) (placeholder
public): for PostgreSQL, Studio's own queries use it as the search path; leave it blank for MySQL.
- Under Credentials and validation, enter Username and Password.
- Click Test connection. It is enabled once the name, description, guide, database type, database name, username and password are filled and the port is valid. Studio connects with a 10-second timeout and runs
SELECT 1; a Passed box shows the result. Nothing is saved yet. - Click Explore schema and improve guide. Studio reads tables, columns, relationships and a five-row sample per table, and streams a proposed guide under "Guide in progress", then shows "Review the enriched guide below. You can edit it before accepting." Edit it and click Use this guide, or Discard to keep your own text. The result reads "Schema exploration and guide enrichment completed successfully!"
- Click Create connector. It stays disabled until the test has passed, the schema has been explored and you have used the drafted guide.
- Add the connector to an agent from its Agent Map (Agents: configure and activate).
What you should see
The list shows the connector as SQL, "Version 1", Active. On its page, Configuration shows Database type, Host, Port, Database and Schema, and Credentials shows the username and a hidden password you can reveal for a moment.
In chat
Ask the agent a question about the data, for example "Which desks breached their realised volatility limit last week?". The agent runs read-only queries through its connector query tool, which executes each statement on Studio's connector service and returns only the rows (200 by default, at most 1,000); the guide tells it which tables and columns to use. When a step needs more than that, its code in the Kernel can connect itself with SQLAlchemy and the PostgreSQL or MySQL driver, but only on a port the Kernel may use: 443 always, and on a private deployment the internal service ports an administrator approved (Kernel). Credentials are read from the run's environment and are never printed or shown to you.
Notes
- Read-only at run time. Queries through the connector accept one statement per request, and only
DESC,DESCRIBE,EXPLAIN,SELECT,SHOWandWITH(aWITHmay not contain data-modifying or DDL keywords). Anything else is refused: "Statement type 'INSERT' is not allowed. Only read-only statements are permitted: DESC, DESCRIBE, EXPLAIN, SELECT, SHOW, WITH." There is no write mode. When a process must write, have the agent write its proposals as run files and load them with your own process (the loader pattern). - Timeouts and caps: 10 seconds to connect (test and exploration); 60 seconds per statement on Studio's own queries (a PostgreSQL statement timeout set server-side; a MySQL read and write timeout); 1,000 rows returned; 5 sample rows per table.
- Two things connect to the database: Studio's connector service (Test connection, exploration and the agent's query tool), and agent code in the Kernel. The connector service reaches any port; the Kernel reaches 443 and, on a private deployment, the approved ports to the internal service ranges. So a test can pass while agent code cannot connect on 5432 or 3306: ask an administrator to approve the port, or let the agent use its query tool.
- Changing any connection setting or credential after a test clears the result and the drafted guide: test and explore again.
- A Failed box reads "Connection failed: ..." with the driver's error after the colon; check the host, port, firewall, TLS and credentials. A failed exploration shows its error line, or "No guide was returned. Try again."
- On Update, leave Username and Password blank to keep the stored pair, or enter both to replace it. Saving an update also needs a passing test, an exploration and Use this guide (Versions, Test connection and guides).