@@ -180,6 +180,12 @@ public Builder setHivePartitioningOptions(HivePartitioningOptions hivePartitioni
180
180
abstract Builder setHivePartitioningOptionsInner (
181
181
HivePartitioningOptions hivePartitioningOptions );
182
182
183
+ public Builder setObjectMetadata (String objectMetadata ) {
184
+ return setObjectMetadataInner (objectMetadata );
185
+ }
186
+
187
+ abstract Builder setObjectMetadataInner (String objectMetadata );
188
+
183
189
/** Creates an {@code ExternalTableDefinition} object. */
184
190
@ Override
185
191
public abstract ExternalTableDefinition build ();
@@ -255,6 +261,21 @@ public String getFileSetSpecType() {
255
261
@ Nullable
256
262
public abstract ImmutableList <String > getSourceUrisImmut ();
257
263
264
+ /**
265
+ * Returns the object metadata.
266
+ *
267
+ * @see <a
268
+ * href="https://cloud.google.com/bigquery/docs/reference/v2/tables#externalDataConfiguration">
269
+ * ObjectMetadata</a>
270
+ */
271
+ @ Nullable
272
+ public String getObjectMetadata () {
273
+ return getObjectMetadataInner ();
274
+ }
275
+
276
+ @ Nullable
277
+ abstract String getObjectMetadataInner ();
278
+
258
279
/**
259
280
* Returns the source format, and possibly some parsing options, of the external data. Supported
260
281
* formats are {@code CSV} and {@code NEWLINE_DELIMITED_JSON}.
@@ -362,6 +383,10 @@ com.google.api.services.bigquery.model.ExternalDataConfiguration toExternalDataC
362
383
externalConfigurationPb .setFileSetSpecType (getFileSetSpecType ());
363
384
}
364
385
386
+ if (getObjectMetadata () != null ) {
387
+ externalConfigurationPb .setObjectMetadata (getObjectMetadata ());
388
+ }
389
+
365
390
return externalConfigurationPb ;
366
391
}
367
392
@@ -426,6 +451,24 @@ public static Builder newBuilder(String sourceUri, FormatOptions format) {
426
451
return newBuilder ().setSourceUris (ImmutableList .of (sourceUri )).setFormatOptions (format );
427
452
}
428
453
454
+ /**
455
+ * Creates a builder for an ExternalTableDefinition object.
456
+ *
457
+ * @param sourceUri the fully-qualified URIs that point to your data in Google Cloud. For Google
458
+ * Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and
459
+ * valid HTTPS URL for a Google Cloud Bigtable table. Size limits related to load jobs apply
460
+ * to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
461
+ * @return a builder for an ExternalTableDefinition object given source URIs and format
462
+ * @see <a href="https://cloud.google.com/bigquery/loading-data-into-bigquery#quota">Quota</a>
463
+ * @see <a
464
+ * href="https://cloud.google.com/bigquery/docs/reference/v2/tables#externalDataConfiguration.sourceFormat">
465
+ * Source Format</a>
466
+ */
467
+ public static Builder newBuilder (String sourceUri ) {
468
+ checkArgument (!isNullOrEmpty (sourceUri ), "Provided sourceUri is null or empty" );
469
+ return newBuilder ().setSourceUris (ImmutableList .of (sourceUri ));
470
+ }
471
+
429
472
/**
430
473
* Creates an ExternalTableDefinition object.
431
474
*
@@ -534,6 +577,9 @@ static ExternalTableDefinition fromPb(Table tablePb) {
534
577
if (externalDataConfiguration .getFileSetSpecType () != null ) {
535
578
builder .setFileSetSpecType (externalDataConfiguration .getFileSetSpecType ());
536
579
}
580
+ if (externalDataConfiguration .getObjectMetadata () != null ) {
581
+ builder .setObjectMetadata (externalDataConfiguration .getObjectMetadata ());
582
+ }
537
583
}
538
584
return builder .build ();
539
585
}
@@ -597,6 +643,10 @@ static ExternalTableDefinition fromExternalDataConfiguration(
597
643
builder .setFileSetSpecType (externalDataConfiguration .getFileSetSpecType ());
598
644
}
599
645
646
+ if (externalDataConfiguration .getObjectMetadata () != null ) {
647
+ builder .setObjectMetadata (externalDataConfiguration .getObjectMetadata ());
648
+ }
649
+
600
650
return builder .build ();
601
651
}
602
652
}
0 commit comments