This directory contains a simple Java tool to interact with BigQuery via the JDBC driver. It can be used to execute queries and inspect database metadata.
To compile the client, run:
makeThis will generate JDBCClient.class.
The Makefile provides convenient targets to run the client. You can override default variables on the command line.
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 tofalseto suppress query result output (defaults totrue)EXTRA_ARGS: Extra arguments to pass to the client (e.g.,EXTRA_ARGS="--table my_table")
make query QUERY="SELECT 1"make query-generated ROWS=10 COLS=5Useful for performance testing.
make query QUERY="SELECT * FROM my_dataset.my_table LIMIT 1000" OUTPUT=falseThe tool supports calling DatabaseMetaData methods.
make metadata METHOD=getTablesmake metadata METHOD=getColumns EXTRA_ARGS="--table my_table"Methods that take no arguments can be called via reflection.
make metadata METHOD=getDatabaseProductNamemake metadata METHOD=getJDBCMajorVersion