r/SQL • • 36m ago

Discussion Should SQL clients open connections read-only by default?

Most GUI clients I've used treat every connection as read-write. You're one wrong tab away from running an UPDATE on prod.

In the client I'm building (Row Patrol, disclosure: I'm the dev), every connection opens read-only, and writes are an explicit switch. Some people love it. Others find it annoying for local dev databases.

How do you handle this today? Separate read-only DB users, client settings, colored prod tabs, or just being careful? Does read-only by default help, or does it get in the way?

5 Upvotes

6 comments sorted by

View all comments

4

u/juu073 29m ago

Anyone who needs to switch to a different app because they can't handle a checkbox in settings probably has AI connected to prod anyway.

3

u/bourbonandpistons 20m ago

Me trying to get the owner of the company to stop using the SA account for his ai stuff on production.

0

u/xike456 15m ago

the SA account on prod. good luck man

0

u/xike456 15m ago

sure, if you remember to tick it every time. But sometime thing slips and catch fire

1

u/juu073 9m ago

How many people recreate a connection every time they open an app to have to remember it?

You make it the default setting. Every app I've used has this feature. Workbench, Datagrip, TablePlus, Coda, VSCode plugins. If you run an INSERT/UPDATE/DELETE/etc. query, they all warn/warned you and gave you the ability to execute the command one off or turn off the block temporarily. They even protected you by not giving you the option to turn it on forever from the banner warning.

Or you make the default setting to use transactions.

If someone doesn't know to take the two seconds to set the default setting when they add the DB connection to their app, they should not have access to prod.

0

u/xike456 5m ago

fair point, i undersold how many tools already do this. the one-off execute from the warning banner is a nice touch, hadn't thought about blocking "always allow" from there