GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — google-cloud-java/java-bigquery/samples at main · googleapis/google-cloud-java

Expand file tree

/

samples

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

samples

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
install-without-bom
install-without-bom
 
 
snapshot
snapshot
 
 
snippets
snippets
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Getting Started with BigQuery Samples

Running a sample using Cloud Shell

The Google Cloud Shell has application default credentials from its compute instance which will allow you to run an integration test without having to obtain GOOGLE_APPLICATION_CREDENTIALS. Go to BigQuery Client Readme to run each sample in the Cloud Shell.

Running a sample using command line

First set up GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_CLOUD_PROJECT environment variables before running any samples.

To run a sample:

  1. cd samples/snippets - all samples are located in java-bigquery/samples/snippets directory.
  2. mvn compile exec:java -Dexec.mainClass=com.example.bigquery.SimpleQuery - this runs the SimpleQuery sample which runs the BigQuery query method. You can update the developer's TODO section in the snippet if you wish to run a different query.

Running a sample integration test using command line

Note that some samples require environment variables to be set. For instance, in CreateDatasetIT.java:

private static final String GOOGLE_CLOUD_PROJECT = System.getenv("GOOGLE_CLOUD_PROJECT"); - this sample integration test requires you to specific the Google Cloud Project you would like to run the test in.

Make sure to set environment variables, if necessary, before running the sample, or else you will get an error asking you to set it.

To run a samples integration tests:

  1. cd samples/snippets - all samples are located in java-bigquery/samples/snippets directory.
  2. mvn -Dtest=GetTableIT test - this runs the integration test of GetTable.java sample.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.