简体   繁体   中英

How can I let my clients export BigQuery query results as CSV

So I have developed a backend API in java on Google App Engine. The API is used to return real time stats by running queries on BigQuery.

I have also developed Front End in AngularJS which communicates with the backend API and allows users to login, and view aggregated stats.

I would like to let my users export data as CSV from BigQuery (directly through my front end application).

I'm not sure what's the best way to achieve that. Your help is highly appreciated.

I could see you doing this one of two ways, depending on your needs:

  1. Run an export job to Google Cloud Storage in CSV format, then download the exported CSV from GCS.

  2. Read data from tabledata.list API , converting the fv format into CSV on your server and creating a downloadable CSV file.

I'd probably recommend the first option. Export jobs are likely to scale better, since they are generally more performant for large tables than repeated calls to tabledata.list. It also avoids the need to write custom code to convert your data to CSV.

Exporting to GCS is currently our scaled solution, maybe you can contact the team to have some special quota for you. tabledata.list returning direct CSV output is about to be deprecated, an alternative is using bq cli's head command with --format=csv, but that is not a solution for scale.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM