feature: read only connections #92

Open
opened 2026-07-15 17:45:34 -05:00 by noe.trevino · 0 comments
Owner

Did you check the docs?

  • I have read all the dadbod-ui.nvim docs

There are databases i should never be writing to. Right now the only thing stopping me is me being careful, and that stops working around 5pm on a friday.

I want to say "this one is read only" once and have it actually enforced.

Describe the solution you'd like

Mark a connection read only. Any statement that mutates gets refused. No override, no confirm, just no.

Blocked by #101, which answers "does this statement mutate".

The flag itself lives on the connection, since its a property of that database and not of the engine. The classifier lives on the adapter spec. Worth keeping those two halves apart.

This is opt in, so it only protects the connections i remembered to mark. Thats why it doesnt replace dangerous statement detection (#96).

Acceptance Criteria

  • can mark a connection read only
  • persists across restarts
  • stored in connections.json
  • mutating statements are refused with a message that says why
  • selects still work
  • a script with any mutating statement in it is refused, not half run
  • implemented in all adapters where their cli allows
    • postgres
    • MySQL
    • MariaDB
    • SQL Server
    • SQLite

Describe alternatives/other solutions you've considered

Per adapter instead of per connection? Needs deciding before this gets built. Per adapter means all my postgres connections are read only, which is rarely the point, the connection worth protecting is prod and not an engine. Counter argument is its one setting instead of a field on every connection.

Confirm instead of refuse. Thats dangerous statement detection (#96), separate issue. This one is meant to be the hard no.

Skipping the per connection flag and making it global. Too blunt, i want to write to dev.

### Did you check the docs? - [X] I have read all the dadbod-ui.nvim docs ### Is your feature request related to a problem? Please describe. There are databases i should never be writing to. Right now the only thing stopping me is me being careful, and that stops working around 5pm on a friday. I want to say "this one is read only" once and have it actually enforced. ### Describe the solution you'd like Mark a connection read only. Any statement that mutates gets refused. No override, no confirm, just no. Blocked by #101, which answers "does this statement mutate". The flag itself lives on the connection, since its a property of that database and not of the engine. The classifier lives on the adapter spec. Worth keeping those two halves apart. This is opt in, so it only protects the connections i remembered to mark. Thats why it doesnt replace dangerous statement detection (#96). ### Acceptance Criteria - [ ] can mark a connection read only - [ ] persists across restarts - [ ] stored in `connections.json` - [ ] mutating statements are refused with a message that says why - [ ] selects still work - [ ] a script with any mutating statement in it is refused, not half run - [ ] implemented in all adapters where their cli allows - [ ] postgres - [ ] MySQL - [ ] MariaDB - [ ] SQL Server - [ ] SQLite ### Describe alternatives/other solutions you've considered Per adapter instead of per connection? Needs deciding before this gets built. Per adapter means all my postgres connections are read only, which is rarely the point, the connection worth protecting is prod and not an engine. Counter argument is its one setting instead of a field on every connection. Confirm instead of refuse. Thats dangerous statement detection (#96), separate issue. This one is meant to be the hard no. Skipping the per connection flag and making it global. Too blunt, i want to write to dev.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
noe.trevino/dadbod-ui.nvim#92
No description provided.