michael-s-molina opened a new pull request, #38984:
URL: https://github.com/apache/superset/pull/38984

   ### SUMMARY
   
   When `_sanitize_filters` evaluates Jinja templates during access validation, 
and when the datasets API renders SQL/metrics/columns via 
`include_rendered_sql`, the template processor was created without a `table` 
argument. This means `self._schema` is `None` in processors like 
`PrestoTemplateProcessor`, so partition function references like `{{ 
presto.latest_partition('my_table') }}` — where the table name has no explicit 
schema prefix — cannot resolve the schema and fail.
   
   Passing `table=self.datasource` / `table=table` gives the processor the 
schema context it needs to correctly resolve unqualified table references.
   
   **Files changed:**
   - `superset/common/query_object.py` — `_sanitize_filters` template processor 
now receives the datasource table
   - `superset/datasets/api.py` — `include_rendered_sql` template processor now 
receives the dataset table
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A
   
   ### TESTING INSTRUCTIONS
   
   1. Configure a Presto/Trino datasource with a dataset whose schema is set on 
the dataset (not inlined in the table name).
   2. Add a saved filter using `{{ presto.latest_partition('my_table') }}` (no 
schema prefix in the argument).
   3. Open a chart using that dataset — previously the template processor had 
no schema context and could not resolve the table reference.
   4. After this fix, the processor picks up the schema from the datasource and 
resolves the reference correctly.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] 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