dosubot[bot] commented on issue #40583: URL: https://github.com/apache/superset/issues/40583#issuecomment-4595021879
<!-- Answer --> This is a confirmed issue that matches a detailed bug report in [#40465](https://github.com/apache/superset/issues/40465#issuecomment-4554592705) [[1]](https://github.com/apache/superset/issues/40465#issuecomment-4554592705), which identifies two root causes in the streaming CSV export path introduced by PR #35478: 1. **No `mutate_sql_based_on_config()` call** — the streaming path sends raw SQL (including trailing semicolons) directly via `connection.execute(text(sql))`, bypassing the standard pipeline that strips semicolons and applies sqlglot reformatting. Trino rejects trailing semicolons with `SYNTAX_ERROR`. 2. **No user context on engine acquisition** — the streaming path calls `get_sqla_engine()` without passing `user_name`, so impersonation headers are never set and queries run as the service principal. A partial fix landed in PR #40194 [[2]](https://github.com/apache/superset/pull/40194) to handle PostgreSQL prequeries on streaming connections, but it did **not** address SQL mutation or user impersonation — so the Trino failure and the context issues you've identified remain unresolved. Your workaround of raising `CSV_STREAMING_ROW_THRESHOLD` above the maximum practical `row_limit` is the correct short-term mitigation. Your suggested fixes align well with the analysis in #40465 — particularly routing the streaming path through the existing `mutate_sql_based_on_config()` pipeline and passing user context to the engine. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).* --- Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset). [](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=e8e6ce23-7966-439a-80f1-2036df48c4b4) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset) -- 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]
