HUE-3996 [libdbms] Offer downloading query results

Review Request #9844 - Created March 16, 2017 and submitted

Adrian Yavorskyy
hue
master
hue
enricoberti, erickt, romain
commit 0cfe1289f3b62b8afc6e5f9fa7a451861192e2e2
Author: Adrian Yavorskyy <ayav@softserveinc.com>
Date:   Thu Mar 16 18:45:02 2017 +0200

    HUE-3996 [libdbms] Offer downloading query results

:100644 100644 ab6e359... f7c55f6... M	desktop/libs/notebook/src/notebook/connectors/rdbms.py
:100644 100644 48f5d56... c9b34de... M	desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

Manually in Chrome

  • 0
  • 0
  • 9
  • 1
  • 10
Description From Last Updated
  1. Nice!

    There is probably an easy way to re-use a bit more.

  2. nit: below beeswax

  3. nit: new line before 'import notebook'

  4. How about we reuse https://github.com/cloudera/hue/blob/master/apps/beeswax/src/beeswax/data_export.py#L34 more

    and provide an optional content_generator there?

    def download(handle, format, db, id=None, file_name='query_result', content_generator=None):

    1. Thanks for a suggestion !

  5. 
      
  1. 
      
  2. apps/beeswax/src/beeswax/data_export.py (Diff revision 2)
     
     

    if content_generator is None:
    ...

  3. apps/beeswax/src/beeswax/data_export.py (Diff revision 2)
     
     
     

    Could you add those properties in your data2generator?

    (might need to create a class for it to be cleaner)

    1. I was thinking about implementing a class, but didn't know if it was a real need. So, thanks for a comment, I will add it to a review !

  4. 
      
  1. Nice one!

    One last thing, looking at the code, wondering if we could refactor a bit and get some of the truncation logic for free (which is very useful on datasets that are a bit large and might crash Hue)

  2. If we want to the truncation on lines and columns for free of https://github.com/cloudera/hue/blob/master/apps/beeswax/src/beeswax/data_export.py#L102
    , would it actually work if we provide a custom 'db' and 'result'? (and dont actually create a custom Content Generator)

    class FixedDBResult():

    def init(self, result):
    self.result = result
    # result.has_more = False
    self.has_more = False

    def fetch(self...)
    return self.result

  3. 
      
  1. Really nice!

    I just put a few nit comments, feel free to tweak them and attach the patch afterwards!

    1. Great issue, I really loved it :) A patch is attached !

  2. apps/beeswax/src/beeswax/data_export.py (Diff revision 4)
     
     

    Revert line change?

  3. Remove @query_error_handler?

  4. Add @query_error_handler?

  5. FixedDBResult --> FixedResult?

  6. 
      
  1. Ship It!
  2. 
      
Review request changed

Status: Closed (submitted)

Loading...