ferjanin opened a new issue, #38672:
URL: https://github.com/apache/superset/issues/38672

   ### Bug description
   
   When scheduling a **dashboard** report (PNG/PDF) and enabling **“Ignore 
cache when generating report”**, Superset still serves **cached** chart results.
   
   From the webserver access logs, the report execution loads the dashboard and 
requests chart data via `/api/v1/chart/data`, but **no `force=true` (or 
`force=1`) is included** in the chart-data request, so the cache is not 
bypassed.
   
   In contrast, for **chart reports** (PNG/PDF/CSV) with the same setting 
enabled, we do see `force=true` propagated to `/api/v1/chart/data`, which 
correctly bypasses cache (and in our test environment leads to a datasource 
error because the query actually runs).
   
   This suggests that the `force` flag is correctly propagated in the **chart 
report / Explore flow**, but not in the **dashboard report flow**.
   
   ---
   
   ## Expected behavior
   With **“Ignore cache when generating report”** enabled:
   
   - Dashboard reports should fetch chart data with `force=true` (or 
equivalent) and bypass the data cache.
   - The generated dashboard report should reflect fresh datasource results, 
not cached values.
   
   ---
   
   ## Actual behavior
   - Dashboard reports still use cached results.
   - Webserver access logs show `/api/v1/chart/data` requests **without 
`force`**, even though “Ignore cache…” is enabled.
   
   Example from dashboard report run:
   
   ```
   POST /api/v1/chart/data?form_data=...&dashboard_id=9 200
   ```
   
   No `force=true` is present.
   
   Example from chart/explore run:
   
   ```
   POST /api/v1/chart/data?form_data=...&force=true 400
   ```
   
   Here the query **does bypass cache** and hits the datasource.
   
   ---
   
   ## Reproduction steps
   
   1. Configure Redis caching for Superset chart results (`DATA_CACHE_CONFIG`) 
with a noticeable TTL (e.g. several hours).
   2. Create a **dashboard** containing at least one chart that queries a 
datasource.
   3. Load the dashboard once so the chart results are **cached**.
   4. Create a **scheduled report** for the dashboard (PNG or PDF).
   5. Enable **“Ignore cache when generating report”** in the report 
configuration.
   6. Execute the report once to confirm it works normally.
   7. **Remove access to the underlying data** for the report execution user 
(in our case by revoking Lake Formation access / removing RBAC tag on the 
table).
      - This step ensures that **cached results would still work**, but **fresh 
queries should fail**.
   8. Execute the scheduled **dashboard report again**.
   
   Observe:
   
   - The dashboard report **still succeeds** because cached results are used.
   - Server logs show `/api/v1/chart/data` without `force`.
   
   Now compare with a **chart report**:
   
   9. Create a scheduled report for the **chart** (PNG/PDF/CSV) with **Ignore 
cache enabled**.
   10. Execute the chart report again after access was removed.
   
   Observe:
   
   - The chart report **fails** because it bypasses cache and actually queries 
the datasource.
   - Server logs show:
   
   ```
   POST /api/v1/chart/data?...&force=true
   ```
   
   which triggers a datasource error (expected in this test scenario).
   
   ---
   
   ## Evidence from logs
   
   ### Dashboard report run
   
   Dashboard loaded without `force`:
   
   ```
   GET /superset/dashboard/<dashboard_id>/?permalink_key=<key>&standalone=3 200
   ```
   
   Chart data fetched without `force`:
   
   ```
   POST /api/v1/chart/data?form_data=...&dashboard_id=9 200
   ```
   
   ---
   
   ### Chart report run
   
   Explore page loaded with `force`:
   
   ```
   GET /explore/?form_data=...&force=true&standalone=true 200
   ```
   
   Chart data fetched with `force=true`:
   
   ```
   POST /api/v1/chart/data?form_data=...&force=true 400
   ```
   
   Datasource query executed and failed (Athena):
   
   ```
   pyathena.error.OperationalError: TABLE_NOT_FOUND
   ```
   
   This confirms that **cache bypass works correctly for chart reports**.
   
   ### Screenshots/recordings
   
   Not available at the moment.
   The behavior is demonstrated via server access logs and report execution 
results.
   
   ### Superset version
   
   6.0.0
   
   ### Python version
   
   3.10
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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