Thanks to visit codestin.com
Credit goes to github.com

Skip to content

writeFileToTable in BigQuerySnippets.java needs to close channel #4918

@kamarkaka

Description

@kamarkaka

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(); }

Metadata

Metadata

Labels

api: bigqueryIssues related to the BigQuery API.type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions