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

writeFileToTable in BigQuerySnippets.java needs to close channel #4918

Closed
kamarkaka opened this issue Apr 5, 2019 · 0 comments
Closed

writeFileToTable in BigQuerySnippets.java needs to close channel #4918

kamarkaka opened this issue Apr 5, 2019 · 0 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. type: docs Improvement to the documentation for an API.

Comments

@kamarkaka
Copy link

File: google-cloud-java/google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java

Issue: (at Line: 430)
In the example of writing a local file to a table (public long writeFileToTable(String datasetName, String tableName, Path csvPath, String location) throws IOException, InterruptedException, TimeoutException), TableDataWriteChannel needs to be closed.

Solution: replace line 428-430 with the following code snippet:
try (OutputStream stream = Channels.newOutputStream(writer)) { Files.copy(csvPath, stream); } finally { writer.close(); }

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Apr 6, 2019
@sduskis sduskis added type: docs Improvement to the documentation for an API. api: bigquery Issues related to the BigQuery API. and removed triage me I really want to be triaged. labels Apr 8, 2019
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 BigQuery API. type: docs Improvement to the documentation for an API.
Projects
None yet
Development

No branches or pull requests

3 participants