Docs
Sign in

SQL

SQL database connects TAO to a database you already run. It works with MySQL, MariaDB, Oracle, PostgreSQL and SQL Server. TAO can read freely, and can change data only after a person approves.

Screenshot to add: The Add SQL database form with Engine, Host, Port, Database, Username and Encryption fields.

What you can do

Illustrative examples.

  • Ask Nexus "How many open invoices are over 60 days old?" and have it write and run the query.
  • Check which tables exist in a schema and what columns they have.
  • Request a change, such as marking a batch of rows as reviewed. You approve it before it runs.
  • Use the Run DB query workflow node for the same job inside a workflow. See App nodes.

Before you connect

You need:

  • The engine (the kind of database). The form offers postgresql, sqlserver, oracle, mysql and mariadb.
  • The host, port, database or service name and username, or a single connection string that holds them.
  • The password.
  • A database login limited to the schemas and actions TAO needs. Reads follow what this login is allowed to see.

Connect it

  1. Open Connectors

    Go to Settings > Connectors and find SQL database. Click Add.

  2. Pick the engine

    Choose the Engine. The other fields depend on it. Ports are not filled in for you.

  3. Enter the details

    Fill in Host, Port, Database or service, Username and Password. Or turn on Use a connection string and paste one instead. A saved connection keeps the form it was created with. To switch, add a new connection.

  4. Choose encryption

    Under Encryption (TLS), keep require unless your database has a certificate from a public authority. Then pick verify-full (PostgreSQL only). disable means no encryption and is not available for SQL Server.

  5. Save

    Save the connection. A password is stored encrypted and is not shown again.

Reads versus writes

KindExamplesWhat happens
ReadSELECT, or a read-only WITH ... SELECTRuns at once in the chat
WriteINSERT, UPDATE or DELETE with a WHERE, supported CREATE and ALTERQueued for approval. Always, even in bypass mode
DestructiveDROP, TRUNCATE, UPDATE or DELETE with no WHERE, ALTER ... DROPQueued for approval. You must also confirm the target name

Other statements are refused outright. These include permission changes, transaction control, procedures, and anything that touches the server's files or network. Only one statement is allowed at a time.

Values are passed as named placeholders such as :customer_id, not pasted into the SQL. That stops a typed value from changing the query.

Tools

Tool nameWhat it doesRead or Write
sql_list_connectionsLists your SQL connectionsRead
sql_list_schemasLists visible schemasRead
sql_list_tablesLists tables in a schemaRead
sql_describe_tableShows a table's columnsRead
sql_run_queryRuns one read queryRead
sql_execute_writeRuns one write statementWrite, waits for approval
sql_execute_destructiveRuns a destructive statement after target confirmationWrite, waits for approval, cannot be undone

Total: 7 tools. 5 read, 2 write.

Limits and good to know

  • Row limit. sql_run_query accepts a row limit of 1 to 200. The Run DB query node also caps reads at 200 rows.
  • Optional row cap on writes. A write can state the most rows it may change. If it would change more, it fails.
  • Checked again at approval. Before an approved change runs, TAO re-checks the target. If it changed since you approved, it stops and says "target changed since approval; nothing was run".
  • Some engines save DDL at once. On Oracle and MySQL or MariaDB, a statement that changes structure (DDL) or truncates a table is saved immediately. The approval card says so.
  • Encryption. With require, traffic is encrypted but the server's certificate is not checked. Only PostgreSQL verify-full also proves the server's identity. SQL Server is always encrypted and its certificate is never verified.
  • Schema allow-list. An administrator can limit which schemas writes may touch. The portal catalog does not show this setting to users. Reads are not limited by it.
  • Private networks. TAO refuses its own internal addresses. Use a full DNS name.
  • The product notes say the address check after connecting is not applied for SQL Server and Oracle. This is an admin concern, not a setting you can change.