From 6a7ffefc4281319dc7528cb53a16724da110ec75 Mon Sep 17 00:00:00 2001 From: Tylor <31300576+Tylorjg@users.noreply.github.com> Date: Thu, 2 May 2024 06:25:29 -0700 Subject: [PATCH] Fix for #143: Let the driver determine the dataset location if non given (#301) * Removed the else statement from the open function. Based on the Google Simba driver documentation, the location is automatically handled based on where the dataset exists. * Removed the location variable that wasn't used and refactored the if condition for the open function. --- .../ext/bigquery/database/BigqueryConnection.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/liquibase/ext/bigquery/database/BigqueryConnection.java b/src/main/java/liquibase/ext/bigquery/database/BigqueryConnection.java index fd82c548..682efd49 100644 --- a/src/main/java/liquibase/ext/bigquery/database/BigqueryConnection.java +++ b/src/main/java/liquibase/ext/bigquery/database/BigqueryConnection.java @@ -20,7 +20,6 @@ */ public class BigqueryConnection extends JdbcConnection { - private String location = "US"; private S42Connection con; public BigqueryConnection() { @@ -87,10 +86,8 @@ public Connection getUnderlyingConnection() { @Override public void open(String url, Driver driverObject, Properties driverProperties) throws DatabaseException { if (driverProperties.stringPropertyNames().contains("Location")) { - this.location = driverProperties.getProperty("Location"); - } else { - this.location = getUrlParamValue(url, "Location", "US"); - driverProperties.setProperty("Location", this.location); + String locationValue = getUrlParamValue(url, "Location"); + driverProperties.setProperty("Location", locationValue); } Scope.getCurrentScope().getLog(this.getClass()).fine(String.format("Opening connection to %s driverProperties=%s", url, driverProperties));