-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[FLINK-38516][Table SQL/Gateway] Add config for read-only sql gateway #27118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks like a useful feature for some use cases. Left some comment.
</tr> | ||
<tr> | ||
<td><h5>sql-gateway.read-only</h5></td> | ||
<td style="word-wrap: break-word;">5 min</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You meant false
as default value?
<tr> | ||
<td><h5>sql-gateway.read-only</h5></td> | ||
<td style="word-wrap: break-word;">5 min</td> | ||
<td>Duration</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<td>Duration</td> | |
<td>Boolean</td> |
|
||
if (isReadOnlyMode) { | ||
throw new SqlExecutionException( | ||
"SQL Gateway is in read-only mode. Modify operations are not allowed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it's useful to show the modifyOperations
in the error message in case it's unclear to users which are actually violating the read-only mode.
https://issues.apache.org/jira/browse/FLINK-38516
What is the purpose of the change
The Flink SQL Gateway currently lacks native support for read-only mode to restrict ModifyOperations (e.g., INSERT, DELETE). This feature allows ad-hoc querying on shared session clusters without risk of data modification.
This pull request adds a a configuration parameter
sql-gateway.read-only
such that if enabled, it rejects SQL statements attempting to modify data or schema.Brief change log
Creates read-only sql gateway configuration that blocks execution of modification queries if enabled.
Verifying this change
Submit a FlinkSQL modification query to a session cluster and check that executing the query throws an exception i.e.

sql-gateway.read-only: true
) and if the query is a modifying operation.Full stack trace:
Click to expand
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation