Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I perform bigquery.tabledata().insertAll using the Cloud Bigquery API #429

Closed
shrgupta28 opened this issue Jun 9, 2020 · 5 comments
Assignees
Labels
api: bigquery Issues related to the googleapis/java-bigquery API. type: question Request for information or clarification. Not an issue.

Comments

@shrgupta28
Copy link

Hi Team,

@danoscarmike @stephaniewang526 @pmakani

I need help on an urgent basis.

As per your recommendation, we are migrating to the new Bigquery API https://github.com/googleapis/java-bigquery

Can you please help me how I can perform bigquery.tabledata().insertAll using the Cloud Bigquery API

Earlier we were using BigQuery V2 API to achieve this functionality.

Env:
Java 1.8
Google Cloud Bigquery

Thanks,
Shruti

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/java-bigquery API. label Jun 9, 2020
@pmakani pmakani self-assigned this Jun 9, 2020
@pmakani pmakani added the type: question Request for information or clarification. Not an issue. label Jun 9, 2020
@pmakani
Copy link
Contributor

pmakani commented Jun 9, 2020

@shrgupta28 you can use this example for insert data. InsertDataAndQueryTable

@shrgupta28
Copy link
Author

shrgupta28 commented Jun 9, 2020

Okay.. thanks for your response.
Is there an API that returns the number of inserts done successfully? can you help me with this.

@pmakani
Copy link
Contributor

pmakani commented Jun 9, 2020

@shrgupta28 there is alternative way to use getInsertErrors() , which returns number of rows were not inserted.

@shrgupta28
Copy link
Author

Okay, thanks for this information.
I am requesting similar information for #413

@pmakani
Copy link
Contributor

pmakani commented Jun 10, 2020

@shrgupta28 second approach is insert data through LoadJobConfiguration and Load Job example available in samples, once you execute load job , it will return LoadStatistics, please check below code.

LoadStatistics statistics = job.getStatistics();
long outputRows = statistics.getOutputRows();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/java-bigquery API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants