Confusing interface when both "Allow run Sync" and "Allow run Async" checked for datasource #5836
Closed
3 tasks done
Labels
inactive
Inactive for >= 30 days
Make sure these boxes are checked before submitting your issue - thank you!
Superset version
0.28.0rc5
Expected results
The button displayed in the SQL Lab view's hover text corresponds with the actual type of execution that will happen. SqlEditor.runQuery() passes the proper argument into SqlEditor.startQuery()
Actual results
When you have a database that has both "Allow Run Sync" and "Allow Run Async" enabled, src/SqlLab/components/RunQueryActionButton.jsx:L67 will render the asyncBtn. The asyncBtn has the onClick action of SqlEditor.runQuery(true). This method, if I understand SqlEditor:L136 correctly, doesn't actually accept that parameter to do anything. Instead, it calls startQuery(!(this.props.database || {}).allow_run_sync). If you have allow_run_sync enabled, it runs startQuery(runAsync = false). Meaning that even though you have enabled async running on the database configuration, it still runs as sync. Basically, if I'm understanding the code correctly, this means that the "Allow Run Async" option is essentially useless, as it will always just execute !database.allow_run_sync.
However, if you toggle sync to effect the method of execution, the button rendered won't update to the correct version, meaning you can very easily end up with situations where the hover on the button says "Run Query Asynchronously" and it runs synchronously, or "Run Query Synchronously" and it runs async. This is confusing behavior.
I'll caveat all of this with a giant "I'm not great at JS" sticker however, so I very well could have misunderstood what's happening, even though I'm confident that the behavior is wrong.
Steps to reproduce
Set up an async backend. Create a datasource. Mark both "async" and "sync" in the database config. Run a SQL Lab query. Even though the button's hover text says "async", the arg passed in the form in POST for runAsync will be set to "false"
The text was updated successfully, but these errors were encountered: