mistercrunch commented on a change in pull request #7438: Fixes problem in 
Datasource YAML export of sorting by lists of varying types by stringifying the 
list
URL: 
https://github.com/apache/incubator-superset/pull/7438#discussion_r281920202
 
 

 ##########
 File path: superset/models/helpers.py
 ##########
 @@ -212,7 +212,7 @@ def export_to_dict(self, recursive=True, 
include_parent_ref=False,
                             include_defaults=include_defaults,
                         ) for child in getattr(self, c)
                     ],
-                    key=lambda k: sorted(k.items()))
+                    key=lambda k: sorted(str(k.items())))
 
 Review comment:
   Sorting by the list of items makes no sense though. If the list is 
   ```python
   [
       {'id': 2, 'name': 'test2'},
       {'id': 1, 'name': 'test2'},
   ]
   ```
   it would sort based on 
   ```
   [
       [2, 'test2'],
       [1, 'test1'],
   ]
   ```
   which is totally weird, logic is flawed here

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to