diff --git a/java-bigquery/google-cloud-bigquery-jdbc/.gitignore b/java-bigquery/google-cloud-bigquery-jdbc/.gitignore index 2c4fba513e11..52e30f1bcd64 100644 --- a/java-bigquery/google-cloud-bigquery-jdbc/.gitignore +++ b/java-bigquery/google-cloud-bigquery-jdbc/.gitignore @@ -4,4 +4,6 @@ target-it/** **/ITBigQueryJDBCLocalTest.java tools/**/*.class +tools/**/drivers/** +tools/**/logs/** tools/**/*.jfr \ No newline at end of file diff --git a/java-bigquery/google-cloud-bigquery-jdbc/tools/client/Makefile b/java-bigquery/google-cloud-bigquery-jdbc/tools/client/Makefile index 72e7cf928bb8..16460397b1ad 100644 --- a/java-bigquery/google-cloud-bigquery-jdbc/tools/client/Makefile +++ b/java-bigquery/google-cloud-bigquery-jdbc/tools/client/Makefile @@ -21,6 +21,12 @@ DRIVER_CLASS = com.google.cloud.bigquery.jdbc.BigQueryDriver URL ?= jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443; CREDENTIALS ?= $(GOOGLE_APPLICATION_CREDENTIALS) +# Default connection parameters +PARAMS = ProjectId=bigquery-devtools-drivers;OAuthType=0;OAuthServiceAcctEmail=;OAuthPvtKeyPath=$(CREDENTIALS); + +# Additional connection parameters +EXTRA_PARAMS ?= + ROWS ?= 10 COLS ?= 5 METHOD ?= getTables @@ -42,18 +48,9 @@ else JFR_FLAGS = endif -COMMON_FLAGS = --url "$(URL)" \ +COMMON_FLAGS = --url "$(URL);$(DEFAULT_PARAMS);$(PARAMS);$(EXTRA_PARAMS)" \ --driver-jar "$(DRIVER_JAR)" \ - --driver-class "$(DRIVER_CLASS)" \ - --ProjectId "bigquery-devtools-drivers" \ - --OAuthType=0 \ - --OAuthServiceAcctEmail="" \ - --OAuthPvtKeyPath="$(CREDENTIALS)" \ - --EnableHighThroughputAPI=1 \ - --HighThroughputActivationRatio=0 \ - --HighThroughputMinTableSize=0 \ - --MaxResults=20000 \ - --EnableSession=1 + --driver-class "$(DRIVER_CLASS)" query: classes $(J) $(JFR_FLAGS) -cp .:$(DRIVER_JAR) JDBCClient --action query $(COMMON_FLAGS) --query "$(QUERY)" $(OUTPUT_FLAG) $(EXTRA_ARGS) diff --git a/java-bigquery/google-cloud-bigquery-jdbc/tools/client/README.md b/java-bigquery/google-cloud-bigquery-jdbc/tools/client/README.md index a3d396acfe6d..c422a2c968d2 100644 --- a/java-bigquery/google-cloud-bigquery-jdbc/tools/client/README.md +++ b/java-bigquery/google-cloud-bigquery-jdbc/tools/client/README.md @@ -19,6 +19,8 @@ The Makefile provides convenient targets to run the client. You can override def Common variables: - `URL`: JDBC connection URL (defaults to public BigQuery endpoint) - `CREDENTIALS`: Path to service account JSON key (defaults to `$GOOGLE_APPLICATION_CREDENTIALS`) +- `PARAMS`: Default set of connection string params. +- `EXTRA_PARAMS`: Additional connection string parameters (e.g., `EXTRA_PARAMS="Timeout=30;LogLevel=6;"`) - `OUTPUT`: Set to `false` to suppress query result output (defaults to `true`) - `EXTRA_ARGS`: Extra arguments to pass to the client (e.g., `EXTRA_ARGS="--table my_table"`)