You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/09/09 05:21:51 UTC

[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #8163: [SQLLab] Refactor sql json endpoint

mistercrunch commented on a change in pull request #8163: [SQLLab] Refactor sql json endpoint
URL: https://github.com/apache/incubator-superset/pull/8163#discussion_r322067490
 
 

 ##########
 File path: superset/views/core.py
 ##########
 @@ -715,6 +715,68 @@ def shortner(self):
 appbuilder.add_view_no_menu(R)
 
 
+class SQLJsonParams:
 
 Review comment:
   This class is a bit funky to me because it's super coupled with `request.form` which is super coupled with the that specific view. Conceptually, parsing `request.form` is typical view-related code.
   
   Knowing that the goal here is to compartmentalize a chunk of code to make it more readable, maybe using an inline function (function defined in the view itself) makes most sense. Something named `_create_query_instance(request.form)` and maybe passing it `request.form` explicitly just for clarity, trying to make the function feel actually "functional".
   
   Also to me assigning to self in the constructor and then to back to Query in `create_query` adds boilerplate and indirection. 
   
   I think stuff dealing with the session in `save_query` also should live in view-land. Ideally the view itself has the main handle on the session / transaction, meaning ideally commits and rollbacks are in view scope.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org