Tabnine Logo
BigQueryOptions$Builder.build
Code IndexAdd Tabnine to your IDE (free)

How to use
build
method
in
com.google.cloud.bigquery.BigQueryOptions$Builder

Best Java code snippets using com.google.cloud.bigquery.BigQueryOptions$Builder.build (Showing top 20 results out of 315)

origin: googleapis/google-cloud-java

 return;
BigQuery bigquery = optionsBuilder.build().getService();
Object arg;
try {
origin: googleapis/google-cloud-java

@Before
public void setUp() {
 rpcFactoryMock = createMock(BigQueryRpcFactory.class);
 bigqueryRpcMock = createMock(BigQueryRpc.class);
 bigqueryFactoryMock = createMock(BigQueryFactory.class);
 bigqueryMock = createMock(BigQuery.class);
 expect(bigqueryMock.getOptions()).andReturn(options).anyTimes();
 replay(bigqueryMock);
 job = new Job(bigqueryMock, new JobInfo.BuilderImpl(JOB_INFO));
 expect(rpcFactoryMock.create(anyObject(BigQueryOptions.class))).andReturn(bigqueryRpcMock);
 expect(bigqueryFactoryMock.create(anyObject(BigQueryOptions.class)))
   .andReturn(bigqueryMock)
   .anyTimes();
 replay(rpcFactoryMock, bigqueryFactoryMock);
 options =
   BigQueryOptions.newBuilder()
     .setProjectId("projectid")
     .setServiceRpcFactory(rpcFactoryMock)
     .setServiceFactory(bigqueryFactoryMock)
     .build();
}
origin: googleapis/google-cloud-java

     .setRetrySettings(retrySettings())
     .setTransportOptions(transportOptions)
     .build();
 return new RemoteBigQueryHelper(bigqueryOptions);
} catch (IOException ex) {
origin: com.google.cloud/gcloud-java-bigquery

/**
 * Creates a {@code RemoteBigQueryHelper} object using default project id and authentication
 * credentials.
 */
public static RemoteBigQueryHelper create() {
 BigQueryOptions bigqueryOptions = BigQueryOptions.builder()
   .retryParams(retryParams())
   .connectTimeout(60000)
   .readTimeout(60000)
   .build();
 return new RemoteBigQueryHelper(bigqueryOptions);
}
origin: io.konig/konig-gcp-common

public BigQuery bigQuery() {
  if (bigQuery == null) {
    bigQuery = BigQueryOptions.newBuilder().setCredentials(credentials).setProjectId(projectId).build().getService();
  }
  return bigQuery;
}
origin: gojek/feast

 @Bean
 public BigQueryDatasetCreator getBigQueryTrainingDatasetCreator(
   BigQueryDatasetTemplater templater,
   @Value("${feast.core.projectId}") String projectId,
   @Value("${feast.core.datasetPrefix}") String datasetPrefix) {
  BigQuery bigquery = BigQueryOptions.newBuilder().setProjectId(projectId).build().getService();
  Clock clock = Clock.systemUTC();
  return new BigQueryDatasetCreator(templater, bigquery, clock, projectId, datasetPrefix);
 }
}
origin: GoogleCloudPlatform/java-docs-samples

public static void explicit() throws IOException {
 // Load credentials from JSON key file. If you can't set the GOOGLE_APPLICATION_CREDENTIALS
 // environment variable, you can explicitly load the credentials file to construct the
 // credentials.
 GoogleCredentials credentials;
 File credentialsPath = new File("service_account.json");  // TODO: update to your key path.
 try (FileInputStream serviceAccountStream = new FileInputStream(credentialsPath)) {
  credentials = ServiceAccountCredentials.fromStream(serviceAccountStream);
 }
 // Instantiate a client.
 BigQuery bigquery =
   BigQueryOptions.newBuilder().setCredentials(credentials).build().getService();
 // Use the client.
 System.out.println("Datasets:");
 for (Dataset dataset : bigquery.listDatasets().iterateAll()) {
  System.out.printf("%s%n", dataset.getDatasetId().getDataset());
 }
}
// [END bigquery_client_json_credentials]
origin: googleapis/google-cloud-java

    .setProjectId("p1")
    .setCredentials(NoCredentials.getInstance())
    .build();
BigQueryOptions otherOptions = options.toBuilder().setProjectId("p2").build();
return new Serializable[] {
 DOMAIN_ACCESS,
origin: googleapis/google-cloud-java

    .toBuilder()
    .setRetrySettings(ServiceOptions.getDefaultRetrySettings())
    .build()
    .getService();
InsertAllResponse response = bigquery.insertAll(request);
origin: googleapis/google-cloud-java

    .toBuilder()
    .setRetrySettings(ServiceOptions.getDefaultRetrySettings())
    .build()
    .getService();
thrown.expect(BigQueryException.class);
origin: googleapis/google-cloud-java

/**
 * Creates a {@code RemoteBigQueryHelper} object using default project id and authentication
 * credentials.
 */
public static RemoteBigQueryHelper create() {
 HttpTransportOptions transportOptions = BigQueryOptions.getDefaultHttpTransportOptions();
 transportOptions =
   transportOptions
     .toBuilder()
     .setConnectTimeout(connectTimeout)
     .setReadTimeout(connectTimeout)
     .build();
 BigQueryOptions bigqueryOptions =
   BigQueryOptions.newBuilder()
     .setRetrySettings(retrySettings())
     .setTransportOptions(transportOptions)
     .build();
 return new RemoteBigQueryHelper(bigqueryOptions);
}
origin: googleapis/google-cloud-java

@Test
public void testRuntimeException() {
 String exceptionMessage = "Artificial runtime exception";
 EasyMock.expect(bigqueryRpcMock.getDataset(PROJECT, DATASET, EMPTY_RPC_OPTIONS))
   .andThrow(new RuntimeException(exceptionMessage));
 EasyMock.replay(bigqueryRpcMock);
 bigquery =
   options
     .toBuilder()
     .setRetrySettings(ServiceOptions.getDefaultRetrySettings())
     .build()
     .getService();
 thrown.expect(BigQueryException.class);
 thrown.expectMessage(exceptionMessage);
 bigquery.getDataset(DATASET);
}
origin: googleapis/google-cloud-java

@Test
public void testNonRetryableException() {
 String exceptionMessage = "Not Implemented";
 EasyMock.expect(bigqueryRpcMock.getDataset(PROJECT, DATASET, EMPTY_RPC_OPTIONS))
   .andThrow(new BigQueryException(501, exceptionMessage));
 EasyMock.replay(bigqueryRpcMock);
 bigquery =
   options
     .toBuilder()
     .setRetrySettings(ServiceOptions.getDefaultRetrySettings())
     .build()
     .getService();
 thrown.expect(BigQueryException.class);
 thrown.expectMessage(exceptionMessage);
 bigquery.getDataset(DatasetId.of(DATASET));
}
origin: googleapis/google-cloud-java

@Test
public void testRetryableException() {
 EasyMock.expect(bigqueryRpcMock.getDataset(PROJECT, DATASET, EMPTY_RPC_OPTIONS))
   .andThrow(new BigQueryException(500, "InternalError"))
   .andReturn(DATASET_INFO_WITH_PROJECT.toPb());
 EasyMock.replay(bigqueryRpcMock);
 bigquery =
   options
     .toBuilder()
     .setRetrySettings(ServiceOptions.getDefaultRetrySettings())
     .build()
     .getService();
 Dataset dataset = bigquery.getDataset(DATASET);
 assertEquals(
   new Dataset(bigquery, new DatasetInfo.BuilderImpl(DATASET_INFO_WITH_PROJECT)), dataset);
}
origin: googleapis/google-cloud-java

public static BigQueryOptions getDefaultInstance() {
 return newBuilder().build();
}
origin: googleapis/google-cloud-java

 @Test
 public void testQueryDryRun() throws Exception {
  // https://github.com/googleapis/google-cloud-java/issues/2479
  EasyMock.replay(bigqueryRpcMock);
  thrown.expect(UnsupportedOperationException.class);
  options
    .toBuilder()
    .setRetrySettings(ServiceOptions.getDefaultRetrySettings())
    .build()
    .getService()
    .query(QueryJobConfiguration.newBuilder("foo").setDryRun(true).build());
 }
}
origin: googleapis/google-cloud-java

private BigQueryOptions createBigQueryOptionsForProject(
  String project, BigQueryRpcFactory rpcFactory) {
 return BigQueryOptions.newBuilder()
   .setProjectId(project)
   .setServiceRpcFactory(rpcFactory)
   .setRetrySettings(ServiceOptions.getNoRetrySettings())
   .build();
}
origin: googleapis/google-cloud-java

 @Override
 protected Restorable<?>[] restorableObjects() {
  BigQueryOptions options = BigQueryOptions.newBuilder().setProjectId("p2").build();
  // avoid closing when you don't want partial writes upon failure
  @SuppressWarnings("resource")
  TableDataWriteChannel writer =
    new TableDataWriteChannel(options, LOAD_CONFIGURATION, "upload-id");
  return new Restorable<?>[] {writer};
 }
}
origin: apache/nifi

@Override
protected BigQueryOptions getServiceOptions(ProcessContext context, GoogleCredentials credentials) {
  final String projectId = context.getProperty(PROJECT_ID).evaluateAttributeExpressions().getValue();
  final Integer retryCount = Integer.valueOf(context.getProperty(RETRY_COUNT).getValue());
  final BigQueryOptions.Builder builder = BigQueryOptions.newBuilder();
  if (!StringUtils.isBlank(projectId)) {
    builder.setProjectId(projectId);
  }
  return builder.setCredentials(credentials)
      .setRetrySettings(RetrySettings.newBuilder().setMaxAttempts(retryCount).build())
      .setTransportOptions(getTransportOptions(context))
      .build();
}
origin: googleapis/google-cloud-java

private BigQueryOptions createBigQueryOptionsForProjectWithLocation(
  String project, BigQueryRpcFactory rpcFactory) {
 return BigQueryOptions.newBuilder()
   .setProjectId(project)
   .setLocation(LOCATION)
   .setServiceRpcFactory(rpcFactory)
   .setRetrySettings(ServiceOptions.getNoRetrySettings())
   .build();
}
com.google.cloud.bigqueryBigQueryOptions$Builderbuild

Popular methods of BigQueryOptions$Builder

  • setProjectId
  • setCredentials
  • setRetrySettings
  • setTransportOptions
  • <init>
  • authCredentials
  • connectTimeout
  • projectId
  • readTimeout
  • retryParams
  • setLocation
  • setServiceFactory
  • setLocation,
  • setServiceFactory,
  • setServiceRpcFactory

Popular in Java

  • Running tasks concurrently on multiple threads
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JCheckBox (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now