> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tablepro.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Safe Mode

> Per-connection query execution controls, from no restrictions to full read-only lockdown

Six levels, one per connection. In the [connection editor](https://docs.tablepro.app/connections/connection-form.md#safe-mode), select the **Safe Mode** pane and set **Safe Mode**. The level decides what stands between a query and the server: nothing, a confirmation, Touch ID, or a refusal.

## Levels

| Level | Write queries | Read queries | Authentication |
| - | - | - | - |
| **Silent** | Execute immediately | Execute immediately | None |
| **Alert** | Confirmation dialog | Execute immediately | None |
| **Alert (Full)** | Confirmation dialog | Confirmation dialog | None |
| **Safe Mode** | Confirmation + Touch ID | Execute immediately | Touch ID / password |
| **Safe Mode (Full)** | Confirmation + Touch ID | Confirmation + Touch ID | Touch ID / password |
| **Read-Only** | Blocked entirely | Execute immediately | None |

New connections start at **Silent**, which is the right choice for a local database you own, or at **Alert** when **Environment** on General is set to **Production** before you pick a level. Move a shared staging connection to **Alert** and anything with real customer data in it to **Safe Mode** or **Read-Only**.

Four things the table cannot carry. The confirmation dialog shows the whole statement, syntax highlighted and scrollable, with a **Copy All** button and a line naming the connection and whatever asked to run it. Touch ID falls back to your macOS password on a Mac without it.

![Confirmation dialog over a query tab, showing a fourteen line UPDATE with Cancel and Execute](https://mintcdn.com/ngquct/n0OqtaDC_N5JwDNA/images/safe-mode-confirmation.png?fit=max\&auto=format\&n=n0OqtaDC_N5JwDNA\&q=85\&s=a5745063fec505aef4e13a49f9045436)

The statement arrives whole, however long it is

**Silent** is not a free pass: `DROP`, `TRUNCATE`, `CREATE OR REPLACE` of a table, schema or database, `INSERT OVERWRITE`, and a `DELETE` with no `WHERE` still raise the built-in dangerous query warning even there. On an engine without SQL, so do deleting an index, a collection, a table, many items at once or the items a query or prefix matches; deleting one item by its ID is an ordinary write. So does a [Structure](https://docs.tablepro.app/features/table-structure.md#saving-changes) save that drops a column, changes a column's type or character set, adds NOT NULL, changes the primary key, adds or rewrites a check constraint, converts a table's existing columns to another character set, or removes a MongoDB field. And **Read-Only** goes past queries to the interface itself, disabling inline cell editing, adding, deleting and duplicating rows, table truncate and drop, and import.

## Connections that are always read-only

A connection that cannot take a write runs at **Read-Only** whatever level it was given. The connection editor shows the level as fixed text, and **Read-Only** is the only level the padlock and **Database > Safe Mode Level** offer. The level you chose stays saved and applies again once the condition no longer holds.

| Connection | Condition |
| - | - |
| [Beancount](https://docs.tablepro.app/databases/beancount.md) | The ledger is a projection of text files, and nothing writes it back |
| [Cloudflare R2 SQL](https://docs.tablepro.app/databases/cloudflare-r2-sql.md) | The engine runs read queries only |
| [SQLite](https://docs.tablepro.app/databases/sqlite.md) on **Remote Server over SSH**, opened **As a Read-Only Copy** | The file is a copy fetched over SFTP, and nothing writes it back |

## Agent mode raises the level

A connection open in [Agent mode](https://docs.tablepro.app/features/agent-mode.md) runs at **Alert** or stricter for as long as the mode is on, so every write the assistant proposes waits for an answer. The level you chose is untouched and applies again on the way out. A connection already at Alert or stricter keeps its own.

The reason for the floor shows in three places while the mode is on: under the level list, in the padlock's tooltip, and on the line above the agent's transcript.

## What the level gates

Safe Mode sits in front of query execution, saving cell edits, structure and table changes, sidebar operations, imports, and maintenance jobs, including the ones the [AI assistant](https://docs.tablepro.app/features/ai-assistant.md) and the MCP tools ask for.

It does not sit in front of reading metadata. Loading the sidebar, opening a table's structure, and exporting data are never confirmed, which is why a backup stays available on a Read-Only connection.

## What counts as a read

A statement runs as a read only when TablePro can tell for certain that it reads. Anything it cannot tell counts as a write: confirmed at the Alert and Safe Mode levels, blocked at Read-Only.

A read can still call a function that writes, such as `SELECT purge_orders()`. At **Read-Only** on PostgreSQL, PGlite, CockroachDB, KingbaseES, MySQL 5.6.5 and later, MariaDB 10.0 and later, SQLite, DuckDB and ClickHouse, the server refuses that write. Every read TablePro runs for you there runs in the engine's own read-only mode: Run, Run Selection, Run All, Explain, opening a table or view with its row counts and page turns, Fetch All, exports, Transfer, Data Compare, Copy Objects and dashboard tiles. Run All then opens no transaction of its own, and a SQL export reads table by table with no snapshot across tables. DuckDB and KingbaseES do this once their plugin in **Settings > Extensions** is updated for this release.

Oracle, Dameng, OceanBase, MySQL before 5.6.5 and MariaDB before 10.0 have no such mode, and their functions can write. At **Read-Only** there, a query that calls a function outside TablePro's list of built-ins is blocked, and so is a raw filter or the filter of an export, a Transfer, a Data Compare or a Copy Objects, before any row is read. The message names the level to switch to: **Alert**, or the lowest level a [configuration profile](#managed-by-an-organization) or Agent mode still offers, and it says the level is held when nothing below Read-Only is offered. Below Read-Only the query counts as a read, so only the two Full levels ask before it runs. The automatic row count of such a browse shows no total. On Oracle, `MATCH_RECOGNIZE` runs: inside it `PREV`, `NEXT`, `FIRST`, `LAST`, `CLASSIFIER` and `MATCH_NUMBER` are the clause's own, and outside it they are your functions.

Oracle and Dameng also run a function named without parentheses, as in `SELECT purge_orders FROM dual`, when no table the query reads has a column of that name. At **Read-Only** that name is blocked like a call: the database's own catalog says which names the session can call, read again at most once a minute per schema. A name that is a column of a table in the query, or a select-list alias in `ORDER BY`, runs. A dotted name that no table in the query starts, such as `pkg.purge_orders`, is blocked without asking the catalog. When the catalog cannot be read, the query is blocked.

SurrealDB's driver has no read-only mode either. At **Read-Only** a query that calls a `fn::`, `api::` or `file::` function is blocked, since its stored body can define or write; built-ins such as `time::now()` run.

`EXPLAIN` and `DESCRIBE` are reads until an option runs the statement. With `ANALYZE` they count as the statement they explain, so `EXPLAIN ANALYZE` of a `SELECT` is a read and of a `DELETE` is a write. An option TablePro does not recognize, or one in quotes, counts as running the statement, and an `EXPLAIN` whose statement cannot be found counts as a write. `ANALYZE` of a table stores statistics and is a write.

On MongoDB, a read is one call on a collection or database with literal arguments, such as `db.orders.find({status: "open"}).sort({at: -1}).limit(50)`, an `aggregate` pipeline without `$out` or `$merge`, `countDocuments`, `distinct`, `explain`, `show collections` and `use`. Any other JavaScript counts as a write: a variable, a function, `forEach`, `runCommand`. Run several reads at once and each one is checked. Shell state lasts as long as the connection, so a function you redefine in one statement runs redefined in every later one. A read still cannot write through it: the MongoDB driver refuses any write while it runs a statement as a read, once the plugin in **Settings > Extensions** is updated for this release.

Redis reads come from a fixed list of read commands, the reads of the modules Redis 8 bundles among them, such as `FT.AGGREGATE`, `TS.MRANGE`, `JSON.OBJLEN`, `BF.EXISTS` and `VSIM`. etcd reads are `get`, `watch`, and the commands that only list or report, such as `member list` and `endpoint health`. SAP HANA is read like any other SQL database.

The server runs the text inside a MySQL conditional comment, `/*! ... */` or MariaDB's `/*M! ... */`, so a statement holding one counts as a write even when the rest of it only reads. Remove the comment to run the statement on a Read-Only connection.

## Statements are counted the way the server counts them

Where a string, a quoted name or a comment ends depends on the engine. A backslash escapes a quote on MySQL and not on PostgreSQL, and block comments nest on PostgreSQL and SQL Server and not on MySQL. A query is split into statements by its own engine's rules. SQL Server needs no `;` between statements, so `SELECT 1` on one line and `DELETE FROM t` on the next are a read and a write, and Read-Only blocks the pair. When a session setting changes the answer, such as `NO_BACKSLASH_ESCAPES` on MySQL or `standard_conforming_strings` on PostgreSQL, the query is read under each setting and the strictest result applies: a query that holds a write under any reading asks for confirmation, and Read-Only blocks it.

## Changing the level while connected

A padlock in the toolbar carries the current level: open for **Silent**, closed for **Read-Only**, a warning triangle for the two Alert levels and a shield for the two Safe Mode levels. The icon is filled at the two **Full** levels, the ones that also ask before a read. Click it for the levels this connection may run at, with the current one ticked. **Database > Safe Mode Level** is the same list.

Four things can hold the level above the one you chose: a read-only engine, a read-only copy of a [remote database file](https://docs.tablepro.app/connections/remote-database-files.md), a [managed policy](#managed-by-an-organization), and [Agent mode](https://docs.tablepro.app/features/agent-mode.md). The weaker levels are then left out of both lists, the reason sits under them, and the padlock's tooltip carries the same sentence. Picking the level already in force writes nothing.

![Toolbar padlock with the six Safe Mode levels listed beneath it](https://mintcdn.com/ngquct/sezpSJY0oLylJ5LP/images/safe-mode-toolbar-badge.png?fit=max\&auto=format\&n=sezpSJY0oLylJ5LP\&q=85\&s=a56c3b04b5a9c7bfe05329d383253e31)

The padlock reads the level without opening the menu

There is no session-only override. A change here writes back to the saved connection, so it holds across tables and tabs, shows up in the connection form, and reaches your other Macs when iCloud Sync is on. Editing the level in the form works the same way round and reaches an open connection right away.

## Server read-only is not Safe Mode

Safe Mode runs inside TablePro. It cannot make a server accept a write the server itself refuses, and the wording tells you which one refused. "Cannot execute write queries: TablePro's Safe Mode is set to read-only for this connection" is the app. "Safe Mode is set to Read-Only for this connection, and the database refused the statement" is the server refusing a write inside the read-only mode that [Read-Only](#what-counts-as-a-read) runs in, with the server's own message as the detail. Anything else is the server alone, and the usual causes are these:

* You are connected to a read replica or a reader endpoint rather than the primary.
* The server runs with `read_only` or `super_read_only` turned on.
* The server or the session opens new transactions read-only.

TablePro opens its write transactions as read-write, on the Mac and on iPhone and iPad alike, so a server that only defaults new transactions to read-only accepts the save anyway. Truncate and Drop are the exception on MySQL and MariaDB. Both commit whatever is open before they run, so they land outside that read-write transaction and under the session's own default, and the server refuses them. Run those two on a connection whose sessions start read-write.

On MySQL and MariaDB this narrows down the rest:

```sql theme={null}
SHOW SESSION VARIABLES WHERE Variable_name IN
  ('transaction_read_only', 'tx_read_only', 'read_only', 'super_read_only', 'innodb_read_only');
```

`innodb_read_only` set to `ON` means you are on a replica. Connect to the primary to write.

Running in the engine's read-only mode changes a few things at **Read-Only**. PostgreSQL and MySQL refuse `SELECT ... FOR UPDATE` and `FOR SHARE`, and add a begin and a rollback round trip to each statement. On PostgreSQL, a `SET` or `set_config` that a function runs is undone after the statement. While the session holds an open transaction or a table lock, as a MySQL or MariaDB session with autocommit off does after its first statement, a read on PostgreSQL, MySQL or MariaDB runs inside it without the read-only mode, and a query that calls a function outside the built-ins is blocked there as on Oracle. SQLite reads inside the transaction too.

## Execution log

TablePro records each authorization decision, allowed or refused, to a local log: the time, the connection, the kind of operation, whether it was a write, and the outcome. The statement is stored as a SHA-256 digest, so the log is not a second copy of your data. Each record carries the hash of the one before it, so recomputing the chain shows whether a record was edited, reordered or removed.

> [!WARNING]
>
> This is tamper evident, not tamper proof. Anyone who can write the file can recompute every hash after the record they changed, and truncating the end leaves a chain that still verifies. Only storing it somewhere the audited person cannot write would fix that.

The log is local. It is not synced and not sent anywhere.

## Managed by an organization

An administrator can impose a minimum level through a macOS configuration profile, delivered by an MDM such as Jamf or Kandji. The profile targets the `com.TablePro` preference domain with one flat key:

| Key | Type | Value |
| - | - | - |
| `com.TablePro.policy.minimumSafeModeLevel` | String | `silent`, `alert`, `alertFull`, `safeMode`, `safeModeFull`, or `readOnly` |

The key counts only when the profile forces it; the same key written with `defaults write` sets no floor. A connection set below the floor runs at it, and a stricter choice is left alone: the policy is a floor, never a ceiling. A value TablePro does not recognize imposes no floor at all. While the policy is in force, the padlock, **Database > Safe Mode Level** and the connection form each list only the levels at or above it. The level you chose stays saved and applies again once the profile is removed.

This is a floor on TablePro's own behavior, not on the database. It stops the app issuing a write; it does not stop the same person connecting with `psql`. Pair it with server-side privileges for anything that has to hold.

## External clients

A write from an external client (Raycast, Cursor, Claude Desktop, any MCP client) clears three locks in order:

1. **External Clients** (per connection: **Blocked** / **Read Only** / **Read & Write**), the **Access** setting on the connection editor's [**AI & MCP**](https://docs.tablepro.app/connections/connection-form.md#ai-%26-mcp) pane. A Read Only connection rejects a write before the request reaches the database. Reads also use the driver's read-only mode where supported; see [What Read Only allows](https://docs.tablepro.app/developers.md#what-read-only-allows).
2. **Token scope** (per integration: `readOnly` / `readWrite` / `fullAccess`), issued by the [pairing flow](https://docs.tablepro.app/developers/pairing.md). The effective permission is `MIN(token.scope, connection.externalAccess)`.
3. **Safe Mode**, per query. Everything on this page then applies, Touch ID prompts and confirmation dialogs included.

Destructive statements go through [`confirm_destructive_operation`](https://docs.tablepro.app/developers/mcp-tools#writing-data), which needs a `fullAccess` token and the user's approval every time. No token scope skips it. See the [integration security model](https://docs.tablepro.app/developers.md#security-model).

A client that answers its own approval prompt has only answered its own. Only a `fullAccess` token stands in for TablePro's dialog. On every other token the dialog still appears on the Mac, so a `readWrite` client asks twice.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.