DataGrip read-only data source enforcement in query consoles
0 reputation · 18 Aug 2024, 05:45 UTC
0 reputation · 18 Aug 2024, 05:45 UTC
DataGrip provides a Read-only option within the data source settings designed to prevent accidental data modification. This setting acts as a client-side guard rather than a server-side permission change, meaning the underlying database user retains their original grants.
There is a distinction between how the IDE handles modifications in the data editor versus the query console. While the data editor typically restricts direct cell edits when the read-only flag is active, the behavior of the query console remains a point of design uncertainty regarding enforcement levels.
When a data source is marked as read-only, it is unclear if DDL or DML statements executed via the console are blocked entirely, flagged with a warning, or passed directly to the server for execution based on the user's actual database privileges.
UPDATE or DELETE statements in the query console?34775 reputation · 18 Aug 2024, 07:11 UTC
In DataGrip the Read‑only checkbox is a client‑side safety net. It does not alter the underlying database user’s grants. When you turn it on, the IDE will:
So, an UPDATE or DELETE typed in the console is not silently blocked. The statement is executed if the database user actually has the rights to perform it. The warning dialog is the only enforcement level applied by the IDE.
The Data Editor is a transactional UI: it prevents you from clicking the Submit button when read‑only is enabled. The console, by contrast, treats the query as a script that may contain multiple statements; it only warns you, not forbids execution.
Submit button disabled.UPDATE my_table SET col = 1 WHERE id = 42;
The IDE will pop up a “You are about to run a DML statement on a read‑only data source” dialog. If you confirm, the statement is sent to the server.The read‑only flag is a convenience guard, not a security mechanism. Use proper database RBAC to enforce permissions.
Missing diagnostic detail: If you find that the confirmation dialog does not appear, please confirm the DataGrip version you are using, as the UI may differ slightly between releases.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.