Skip to content

Commit

Permalink
fix: custom host for resumable uploads (#2696)
Browse files Browse the repository at this point in the history
* fix: custom host  for resumable uploads

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
Tlaquetzal and gcf-owl-bot[bot] committed May 15, 2023
1 parent 61bb385 commit 2b4eff1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -60,13 +60,13 @@ implementation 'com.google.cloud:google-cloud-bigquery'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-bigquery:2.25.0'
implementation 'com.google.cloud:google-cloud-bigquery:2.26.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.25.0"
libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.26.0"
```
<!-- {x-version-update-end} -->

Expand Down Expand Up @@ -348,7 +348,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.25.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.26.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Expand Up @@ -77,8 +77,7 @@
public class HttpBigQueryRpc implements BigQueryRpc {

public static final String DEFAULT_PROJECTION = "full";
private static final String BASE_RESUMABLE_URI =
"https://www.googleapis.com/upload/bigquery/v2/projects/";
private static final String BASE_RESUMABLE_URI = "upload/bigquery/v2/projects/";
// see:
// https://cloud.google.com/bigquery/loading-data-post-request#resume-upload
private static final int HTTP_RESUME_INCOMPLETE = 308;
Expand Down Expand Up @@ -725,7 +724,11 @@ public QueryResponse queryRpc(String projectId, QueryRequest content) {
@Override
public String open(Job loadJob) {
try {
String builder = BASE_RESUMABLE_URI + options.getProjectId() + "/jobs";
String builder = options.getHost();
if (!builder.endsWith("/")) {
builder += "/";
}
builder += BASE_RESUMABLE_URI + options.getProjectId() + "/jobs";
GenericUrl url = new GenericUrl(builder);
url.set("uploadType", "resumable");
JsonFactory jsonFactory = bigquery.getJsonFactory();
Expand Down

0 comments on commit 2b4eff1

Please sign in to comment.