Repository navigation
add postgresql and mysql integrations - #73
Merged
Merged
Conversation
a database is connected with its host, port, database, user, password and encryption, checked by signing in first. agents get its tables as a tree of rows, written as column: value lines and found by primary key, and a query tool that runs one statement that reads inside a read-only transaction. the host is resolved and private addresses refused unless ALLOW_PRIVATE_HOSTS is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds PostgreSQL and MySQL (MariaDB too) as two integrations on one code path. A database is connected with its host, port, database, user, password and encryption, signing in first with a Test connection like the mailbox form; agents get its tables as a tree, a table holding its rows, each written as "column: value" lines and found again by its primary key, and a query tool that runs one statement that reads inside a read-only transaction, 200 rows back as JSON lines.
The host is resolved and checked before connecting, so a connection can't be pointed at something on the api's own network: private addresses are refused unless the new
ALLOW_PRIVATE_HOSTSvariable says otherwise, and the connection goes to the checked address with the typed host used for certificate verification. MySQL's read-only transaction lets DDL through, so the statement check (one statement, starting with SELECT, WITH, SHOW, EXPLAIN, DESCRIBE, TABLE or VALUES) is what keeps a query to reading; the docs ask for a read-only database user as well.Along the way: a collection's
readaction became optional and anewcommand can be markedreadOnly, for the queries collection; the api's error envelope now carriesmessagewhere an error has one, so agents see the database's own words; Bun's SQL client is given an explicit URL, since with only host and port fields it merges the api's ownDATABASE_URLquery parameters into the connection. Both databases were tested end to end against local Postgres 17 and MariaDB 10.11 servers with TLS, and the pages checked in a browser.Open workspace in Conductor