Menu

#406 export result of SQL directly to a file (bypass showing)

Git
closed-fixed
nobody
None
5
2014-12-12
2014-05-07
Martin
No

It would be fine if I could export the result of my SQL directly to file instead of displaying it first.
Sometimes I create the resulting table too big (on purpose) so it takes the browser a lot time to crunch through it but then I still aim for an Export button.

Discussion

  • Mathieu Rochette

    +1 for very large result sets it may even crash (or at least freeze) the browser and it's not possible to export the data.

    An alternative to bypassing the result view would be to optionally set a "browser limit". Adminer would just stop rendering the results.

    If you think this might be an interesting solution, please tell me and I'll try to make a PR

     
  • Jakub Vrána

    Jakub Vrána - 2014-12-03
    • status: open --> closed-invalid
     
  • Jakub Vrána

    Jakub Vrána - 2014-12-03

    This is already implemented. Just select "save" instead of "open" in export output.

     
    • Mathieu Rochette

      Hi!

      You might have misunderstood the problem. we are aware of the 'save' export. the problem is when you are exporting data from a query you entered manually in the SQL command textarea (this one : http://www.adminer.org/static/screenshots/sql.png )

      Let say I have a query that return 10 000 000 rows: "SELECT * FROM large_table AS lt LEFT JOIN other_table AS ot ON ot.lt_id = lt.id". If I press execute, Adminer will try to render the result page but it will be way to large for the browser to handle and I will not be able to access the export button (because the browser will either crash or froze)

      so I have to add a LIMIT: eg: "SELECT * FROM large_table AS lt LEFT JOIN other_table AS ot ON ot.lt_id = lt.id LIMIT 50" now Adminer will render to result page with 50 rows and the browser will be able to handle it and I will have access to the export button, but the export will contains only 50 rows as specified in the query.

      my proposition is to add a "browser limit" input along the SQL command textarea. in my case I will enter the query: "SELECT * FROM large_table AS lt LEFT JOIN other_table AS ot ON ot.lt_id = lt.id" and set the "browser limit" to 50. when I press 'execute' i want Adminer to process the query and only render the first 50 rows. but when i choose 'save', 'export' i want to download the CSV file containing 10 000 000 rows

      I hope I've explained it better this time :)

       
  • Jakub Vrána

    Jakub Vrána - 2014-12-04
    • status: closed-invalid --> open
     
  • Jakub Vrána

    Jakub Vrána - 2014-12-04

    I see. Now it makes sense.

     
  • Jakub Vrána

    Jakub Vrána - 2014-12-06
    • status: open --> closed-fixed
     
  • PMickael

    PMickael - 2014-12-12

    Hi,

    I just try you're update, it's not completely fixed, because the query system seems to make the full requests also, instead of just the limited one, and not only do the full request for export.

    And for a query with 2millions of rows, that not good :)

    Mickael

     

Log in to post a comment.