betodealmeida commented on code in PR #33340:
URL: https://github.com/apache/superset/pull/33340#discussion_r2079792728
##########
superset-frontend/src/components/Datasource/DatasourceEditor.jsx:
##########
@@ -698,6 +706,23 @@ class DatasourceEditor extends PureComponent {
this.validate(this.onChange);
}
+ async onQueryRun() {
+ this.props.runQuery({
+ client_id: this.props.clientId, // How this is generated?
Review Comment:
```suggestion
client_id: this.props.clientId,
```
It's generated here:
https://github.com/apache/superset/blob/4ed05f4ff16805b1253a902172a53e973cf41f1e/superset/utils/core.py#L1384
##########
superset-frontend/src/components/Datasource/DatasourceEditor.jsx:
##########
@@ -698,6 +706,23 @@ class DatasourceEditor extends PureComponent {
this.validate(this.onChange);
}
+ async onQueryRun() {
+ this.props.runQuery({
+ client_id: this.props.clientId, // How this is generated?
+ database_id: this.state.datasource.database.id,
+ json: true,
+ runAsync: false,
+ catalog: this.state.datasource.catalog,
+ schema: this.state.datasource.schema,
+ sql: this.state.datasource.sql,
+ tmp_table_name: '',
+ select_as_cta: false,
+ ctas_method: 'TABLE',
+ queryLimit: 1000,
Review Comment:
I feel 100 rows here is more than enought, since the user probably just want
to see a few samples? What's the use case for why this feature is being
implemented?
```suggestion
queryLimit: 100,
```
##########
superset-frontend/src/components/Datasource/DatasourceEditor.jsx:
##########
@@ -1078,14 +1103,60 @@ class DatasourceEditor extends PureComponent {
<TextAreaControl
language="sql"
offerEditInModal={false}
- minLines={20}
+ minLines={10}
maxLines={Infinity}
readOnly={!this.state.isEditMode}
resize="both"
tooltipOptions={sqlTooltipOptions}
/>
}
+ additionalControl={
+ <div
+ css={css`
+ position: absolute;
+ right: 0;
+ top: 0;
+ z-index: 2;
+ `}
+ >
+ <Button
+ css={css`
+ align-self: flex-end;
+ height: 24px;
+ padding-left: 6px;
+ padding-right: 6px;
+ `}
+ size="small"
+ buttonStyle="primary"
+ onClick={() => {
+ this.onQueryRun();
+ }}
+ >
+ <Icons.CaretRightFilled
Review Comment:
I think for consistency it would be better to have a button that says "Run",
like in SQL Lab (no need for the dropdown options):
<img width="290" alt="Screenshot 2025-05-08 at 10 21 23 AM"
src="https://github.com/user-attachments/assets/9fb9439d-03c2-41f8-8cda-91f9f66601ab"
/>
Then, in the future we could add the limit dropdown as well, it could be
useful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]