Connect your database to your automations
Most automations end with data that needs to go somewhere. Autonoly has database nodes for MySQL, PostgreSQL and MongoDB, so a workflow can write scraped or processed data straight into your tables, or read records to drive the next steps.
Runs happen in Autonoly's cloud, so the database has to accept connections from the internet. A database that only listens on a private network or localhost cannot be reached. If you can only open SSH to your server, you can use the SSH nodes to run a command-line client there instead.
The quick path: SQL_QUERY
SQL_QUERY runs one SQL statement against PostgreSQL or MySQL and returns the rows. It is the node the AI agent uses when you ask it to read or write a SQL database.
Dialect:
postgres(default) ormysql.Connection: a saved credential with host, port, user, password, database and optional SSL, or a connection string.
Parameters: use
$1, $2placeholders for PostgreSQL or?for MySQL and pass the values as a params array. Values are never pasted into the query text.One statement per node. Multiple statements in one query are rejected.
Results:
rows,rowCount,fieldsand atruncatedflag. Results are capped at 5,000 rows, so page through larger tables withLIMITandOFFSET.
Example: after the agent scrapes a product list, it can insert each row with INSERT INTO products (name, price, url) VALUES ($1, $2, $3).
The record nodes
For finer control in the workflow builder, use a connection-based set of nodes. Open a connection once with DB_CONNECT (MongoDB, PostgreSQL or MySQL; optional connection check), then reference it by name.
| Node | What it does |
|---|---|
DB_CONNECT / DB_DISCONNECT | Open or close a named connection |
DB_USE_DATABASE | Switch database or schema on that connection |
FIND_RECORDS | Query with a filter, projection, sort and limit |
INSERT_RECORDS | Insert one or more records |
UPDATE_RECORDS | Update matching records, with optional upsert |
DELETE_RECORDS | Delete matching records. Requires you to type the confirm phrase DELETE |
DISTINCT_RECORDS | Return the distinct values of a field |
AGGREGATE_RECORDS | Run a MongoDB aggregation pipeline (MongoDB only) |
DB_TRANSACTION | Run several find/insert/update/delete steps in one transaction |
DB_BULK_OPERATIONS | Bulk insert, update or delete |
DB_INDEX | Create, list or drop indexes |
DB_EXECUTE_SCRIPT | Run a script, a raw command, or a stored procedure |
A few details worth knowing:
Transactions take an isolation level (read uncommitted, read committed, repeatable read or serializable), a timeout and a retry count.
Aggregation pipelines are MongoDB only. For SQL databases, use
SQL_QUERYwithGROUP BY, or group the rows afterwards with the data processing nodes.Deletes are guarded.
DELETE_RECORDSwill not run unless the confirm phrase is set to DELETE. Always add a filter.
Common patterns
Scrape to database. The agent extracts listings with data extraction, cleans them, and inserts them with SQL_QUERY. Convert the chat into a workflow and schedule it to keep the table current.
Database to report. Query yesterday's orders, group them by product, and write the result to Google Sheets or a PDF report, then post a summary to Slack.
Database to web form. Read rows that still need processing, have the browser enter each one into a web app that has no API, then update the row's status.
Sync between systems. Read from MongoDB, map the fields, and upsert into PostgreSQL, all in one workflow with error handling around each step.