korbit-ai[bot] commented on code in PR #32525:
URL: https://github.com/apache/superset/pull/32525#discussion_r1984109715
##########
superset/models/core.py:
##########
@@ -537,13 +537,7 @@
self.update_params_from_encrypted_extra(params)
if DB_CONNECTION_MUTATOR:
- if not source and request and request.referrer:
- if "/superset/dashboard/" in request.referrer:
- source = utils.QuerySource.DASHBOARD
- elif "/explore/" in request.referrer:
- source = utils.QuerySource.CHART
- elif "/sqllab/" in request.referrer:
- source = utils.QuerySource.SQL_LAB
+ source = source or get_query_source_from_request()
Review Comment:
### Query Source Determination Not Fully Centralized <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The `source` parameter overrides the value from
`get_query_source_from_request()`, which contradicts the intended
centralization of query source determination.
###### Why this matters
If a source is directly passed as a parameter, it bypasses the centralized
logic in `get_query_source_from_request()`. This defeats the purpose of having
a single source of truth for query source determination.
###### Suggested change ∙ *Feature Preview*
Remove the `source` parameter override and exclusively use
`get_query_source_from_request()`:
```python
source = get_query_source_from_request()
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/b53d0b3b-2d8a-47c5-b8e2-c25e94ed90cc?suggestedFixEnabled=true)
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:900a1621-6257-4c70-ab4e-4068a9f586bf -->
--
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]