Spanish Total.js
English
Documentation For AI agents
Contents

Choose how careful a connection is

Each connection has a care level, which says what may run on it, and an environment, which tells production from a copy at a glance. Both are in Care, when you edit the connection.

.md GitHub
On this page

The care level

Choose it in Changes:

LevelStatements that change dataStatements that destroy data
Run as written (destroying asks)RunAsk
Ask before any changeAskAsk
Read-onlyRefusedRefused

A new connection has Ask before any change. The line at the bottom of the window says Asks before changes or Read-only.

When a statement asks, you see it whole, with Changes data or Destroys data, and nothing runs until you press Run.

What destroys data

  • DROP and TRUNCATE
  • ALTER when it drops something
  • UPDATE and DELETE without WHERE

How a statement is judged

TotalSQL reads the words of the statement. What it does not know counts as a change, so it may ask for a statement that changes nothing, such as SET. EXPLAIN ANALYZE counts as the statement that it explains, because it runs it.

The words do not say what a function does. So, with Ask before any change and Read-only, a statement that reads runs in PostgreSQL, MySQL, MariaDB and SQLite in a way that lets nothing be changed. If a function that it calls changes data, the database refuses it, and TotalSQL asks or refuses as with any other change. In SQL Server, functions cannot change data.

In MySQL and MariaDB, this does not work inside a transaction that you have open, nor while you hold tables with LOCK TABLES: there, a SELECT runs as it is.

Read-only

Besides refusing statements, TotalSQL opens the database itself as read-only in PostgreSQL, MySQL, MariaDB and SQLite. SQL Server has no such thing for a connection, so there the only guard is TotalSQL. For real safety, use a database user that can only read.

On a read-only connection, the buttons that change rows and tables are not there.

The other changes always show their SQL

Saving rows and changing a table show you their statements before they run, with any level but read-only. The changes proposed by an AI always ask.

The environment

Choose it in Environment. It is a mark next to the database, and it changes nothing in what may run:

EnvironmentMark
Local, Development, TestingA green circle
StagingAn amber triangle
ProductionA red square
NoneNo mark
Made in Europe