Read-only connections

Open a database so that Datark refuses to change it, and what that does and does not guarantee.

Updated Written for Datark 1.0.5 for Mac and 1.1.1 for iPhone and iPad

A read-only connection is for looking at a database that must not change: production, a replica, or a database you are only exploring. Datark refuses writes on it instead of sending them.

Turn it on

  • Mac: in the connection form, turn on Read-only connection.
  • iPhone and iPad: in the connection form, turn on the read-only switch.

You can change it later by editing the connection.

What it blocks

  • Editing cells, adding and deleting rows, and importing data.
  • Table design on Mac: creating, altering and dropping tables and columns, and mock data.
  • Running SQL statements that change data. The database session itself is set to read-only, for example default_transaction_read_only on PostgreSQL and PRAGMA query_only on SQLite, so a write fails even if you type one.
  • On Redis, commands that could write or change the connection state.
  • On Mac, a read-only SQLite or DuckDB connection opens the file read-only, which also avoids creating journal files next to it.

Statements that name the guard itself

On read-only PostgreSQL, MySQL and MariaDB connections, Datark also refuses any statement that names a setting or function able to switch the read-only guard off, such as set_config, transaction_read_only, dblink, lo_import or lo_export. This applies even to a harmless read like SHOW transaction_read_only. If you need to run that statement, use a connection that is not marked read-only.

When to use a read-only database user

These checks stop accidents. They are not a security boundary against a deliberately disguised statement. When the data must be protected, connect as a database user that only has read privileges, and use read-only mode as a second layer.

Download Datark. It's free.

Free for Mac, iPhone and iPad. No account required.