fitzee opened a new pull request, #40194:
URL: https://github.com/apache/superset/pull/40194

   ### SUMMARY
   
   When a user sets the SQL Lab row limit to 100,000 (the value of 
`CSV_STREAMING_ROW_THRESHOLD`), the CSV export fails with a stream error on 
PostgreSQL. Smaller row limits work fine because they use the non-streaming 
path.
   
   **Root cause:** The streaming export code called `get_sqla_engine()` without 
passing `catalog` or `schema`. The non-streaming path 
(`SqlResultExportCommand`) correctly passes `self._query.catalog` and 
`self._query.schema` to `get_df()`. For PostgreSQL, 
`get_sqla_engine(schema=...)` sets the `search_path` on the connection — 
without it, any query against a non-`public` schema fails with a "relation not 
found" error, which the streaming generator catches and surfaces as a 
`__STREAM_ERROR__` marker to the frontend.
   
   **Fix:** Thread `catalog` and `schema` from the `Query` object (SQL Lab) and 
`datasource` (charts) through to `get_sqla_engine()`, matching what the 
non-streaming path already does.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend-only fix.
   
   ### TESTING INSTRUCTIONS
   
   1. Connect Superset to a PostgreSQL database with a non-`public` schema 
(e.g., `my_schema`)
   2. In SQL Lab, run a query against a table in that schema (e.g., `SELECT * 
FROM my_table`) with the row limit set to 100,000
   3. Click "Download to CSV"
   4. **Before:** Export fails with "Export failed. Please try again in some 
time."
   5. **After:** Export succeeds and downloads the CSV correctly
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
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]

Reply via email to