villebro opened a new pull request #16614:
URL: https://github.com/apache/superset/pull/16614


   ### SUMMARY
   
   Currently the temporal wrapper class used by the sqla model returns 
`Type[TypeEngine]`, although it should be returning an instantiated 
`TypeEngine`, which results in an incorrect string representation of the type 
object. This doesn't affect regular query generation (it's possible nest 
multiple `type()` calls and still get the correct type), but causes trouble in 
the Presto db engine spec here:
   
https://github.com/apache/superset/blob/3fe2e6ec731529ae228904b9b5e39baec073ae8d/superset/db_engine_specs/presto.py#L385-L407
   
   and more specifically here:
   
https://github.com/apache/superset/blob/3fe2e6ec731529ae228904b9b5e39baec073ae8d/superset/db_engine_specs/presto.py#L293-L303
   (notice how the expected data type for `data_type` is `types.TypeEngine`, 
not `Type[types.TypeEngine]`)
   
   Without this fix the new test fails with the following error:
   
   ```
   >       assert str(new_type) == str(orig_type)
   E       assert "<class 'supe...WrapperType'>" == 'DATETIME'
   E         - DATETIME
   E         + <class 
'superset.models.sql_types.base.literal_dttm_type_factory.<locals>.TemporalWrapperType'>
   ```
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: closes #16258
   - [ ] 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