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_r281708904
 
 

 ##########
 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:
   Wow this method is pretty heavy/opaque.  I'm confused as to why we sort. I'm 
guessing it's to have the nested object be somewhat deterministic (though not 
sure why it matters). Now why sorting based on the `items` makes no sense to 
me. Why not `lambda k: k.get('id')` or something like that? If `id` isn't 
exported, maybe it could be added.
   
   But does the ordering matter 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