@@ -164,6 +164,9 @@ type TableMetadata struct {
164
164
// where 12345 is parent id. The value is the friendly short name of the
165
165
// tag value, e.g. "production".
166
166
ResourceTags map [string ]string
167
+
168
+ // Specifies the configuration of a BigQuery table for Apache Iceberg (formerly BigLake Managed Table).
169
+ BigLakeConfiguration * BigLakeConfiguration
167
170
}
168
171
169
172
// TableConstraints defines the primary key and foreign key of a table.
@@ -380,6 +383,71 @@ func bqToMaterializedViewDefinition(q *bq.MaterializedViewDefinition) *Materiali
380
383
}
381
384
}
382
385
386
+ // BigLakeFileFormat represents the file format for Managed Tables for Apache Iceberg.
387
+ type BigLakeFileFormat string
388
+
389
+ var (
390
+ // UnspecifiedBigLakeFileFormat represents the default value.
391
+ UnspecifiedBigLakeFileFormat BigLakeFileFormat = "FILE_FORMAT_UNSPECIFIED"
392
+ // ParquetBigLakeFileFormat represents Apache Parquet Format.
393
+ ParquetBigLakeFileFormat BigLakeFileFormat = "PARQUET"
394
+ )
395
+
396
+ // BigLakeTableFormat represents the table metadata format for Managed Tables for Apache Iceberg.
397
+ type BigLakeTableFormat string
398
+
399
+ var (
400
+ // UnspecifiedBigLakeTableFormat represents the default value.
401
+ UnspecifiedBigLakeTableFormat BigLakeTableFormat = "TABLE_FORMAT_UNSPECIFIED"
402
+ // IcebergBigLakeTableFormat represent Apache Iceberg Format.
403
+ IcebergBigLakeTableFormat BigLakeTableFormat = "ICEBERG"
404
+ )
405
+
406
+ // BigLakeConfiguration is used to configure aspects of BigQuery tables for
407
+ // Apache Iceberg (previously known as BigLake managed tables).
408
+ type BigLakeConfiguration struct {
409
+ // Optional. The connection specifying the credentials to be used to read and
410
+ // write to external storage, such as Cloud Storage. The connection_id can
411
+ // have the form `{project}.{location}.{connection_id}` or
412
+ // `projects/{project}/locations/{location}/connections/{connection_id}".
413
+ ConnectionID string
414
+
415
+ // Optional. The fully qualified location prefix of the external folder where
416
+ // table data is stored. The '*' wildcard character is not allowed. The URI
417
+ // should be in the format `gs://bucket/path_to_table/`
418
+ StorageURI string
419
+
420
+ // Optional. The file format the table data is stored in.
421
+ FileFormat BigLakeFileFormat
422
+
423
+ // Optional. The table format the metadata only snapshots are stored in.
424
+ TableFormat BigLakeTableFormat
425
+ }
426
+
427
+ func (blc * BigLakeConfiguration ) toBQ () * bq.BigLakeConfiguration {
428
+ if blc == nil {
429
+ return nil
430
+ }
431
+ return & bq.BigLakeConfiguration {
432
+ ConnectionId : blc .ConnectionID ,
433
+ StorageUri : blc .StorageURI ,
434
+ FileFormat : string (blc .FileFormat ),
435
+ TableFormat : string (blc .TableFormat ),
436
+ }
437
+ }
438
+
439
+ func bqToBigLakeConfiguration (in * bq.BigLakeConfiguration ) * BigLakeConfiguration {
440
+ if in == nil {
441
+ return nil
442
+ }
443
+ return & BigLakeConfiguration {
444
+ ConnectionID : in .ConnectionId ,
445
+ StorageURI : in .StorageUri ,
446
+ FileFormat : BigLakeFileFormat (in .FileFormat ),
447
+ TableFormat : BigLakeTableFormat (in .TableFormat ),
448
+ }
449
+ }
450
+
383
451
// SnapshotDefinition provides metadata related to the origin of a snapshot.
384
452
type SnapshotDefinition struct {
385
453
@@ -769,6 +837,7 @@ func (tm *TableMetadata) toBQ() (*bq.Table, error) {
769
837
t .RequirePartitionFilter = tm .RequirePartitionFilter
770
838
t .SnapshotDefinition = tm .SnapshotDefinition .toBQ ()
771
839
t .CloneDefinition = tm .CloneDefinition .toBQ ()
840
+ t .BiglakeConfiguration = tm .BigLakeConfiguration .toBQ ()
772
841
773
842
if ! validExpiration (tm .ExpirationTime ) {
774
843
return nil , fmt .Errorf ("invalid expiration time: %v.\n " +
@@ -917,6 +986,7 @@ func bqToTableMetadata(t *bq.Table, c *Client) (*TableMetadata, error) {
917
986
RequirePartitionFilter : t .RequirePartitionFilter ,
918
987
SnapshotDefinition : bqToSnapshotDefinition (t .SnapshotDefinition , c ),
919
988
CloneDefinition : bqToCloneDefinition (t .CloneDefinition , c ),
989
+ BigLakeConfiguration : bqToBigLakeConfiguration (t .BiglakeConfiguration ),
920
990
}
921
991
if t .MaterializedView != nil {
922
992
md .MaterializedView = bqToMaterializedViewDefinition (t .MaterializedView )
@@ -1145,6 +1215,10 @@ func (tm *TableMetadataToUpdate) toBQ() (*bq.Table, error) {
1145
1215
}
1146
1216
forceSend ("ResourceTags" )
1147
1217
}
1218
+ if tm .BigLakeConfiguration != nil {
1219
+ t .BiglakeConfiguration = tm .BigLakeConfiguration .toBQ ()
1220
+ forceSend ("BigLakeConfiguration" )
1221
+ }
1148
1222
labels , forces , nulls := tm .update ()
1149
1223
t .Labels = labels
1150
1224
t .ForceSendFields = append (t .ForceSendFields , forces ... )
@@ -1239,6 +1313,9 @@ type TableMetadataToUpdate struct {
1239
1313
// tag value, e.g. "production".
1240
1314
ResourceTags map [string ]string
1241
1315
1316
+ // Update the configuration of a BigQuery table for Apache Iceberg (formerly BigLake Managed Table).
1317
+ BigLakeConfiguration * BigLakeConfiguration
1318
+
1242
1319
labelUpdater
1243
1320
}
1244
1321
0 commit comments