@@ -58,6 +58,10 @@ type DatasetMetadata struct {
58
58
// More information: https://cloud.google.com/bigquery/docs/reference/standard-sql/collation-concepts
59
59
DefaultCollation string
60
60
61
+ // MaxTimeTravelHours represents the number of hours for the max time travel for all tables
62
+ // in the dataset. Durations are rounded towards zero for the nearest hourly value.
63
+ MaxTimeTravelHours time.Duration
64
+
61
65
// Storage billing model to be used for all tables in the dataset.
62
66
// Can be set to PHYSICAL. Default is LOGICAL.
63
67
// Once you create a dataset with storage billing model set to physical bytes, you can't change it back to using logical bytes again.
@@ -131,6 +135,10 @@ type DatasetMetadataToUpdate struct {
131
135
// created in the dataset.
132
136
DefaultCollation optional.String
133
137
138
+ // MaxTimeTravelHours represents the number of hours for the max time travel for all tables
139
+ // in the dataset. Durations are rounded towards zero for the nearest hourly value.
140
+ MaxTimeTravelHours optional.Duration
141
+
134
142
// Storage billing model to be used for all tables in the dataset.
135
143
// Can be set to PHYSICAL. Default is LOGICAL.
136
144
// Once you change a dataset's storage billing model to use physical bytes, you can't change it back to using logical bytes again.
@@ -208,6 +216,7 @@ func (dm *DatasetMetadata) toBQ() (*bq.Dataset, error) {
208
216
ds .DefaultTableExpirationMs = int64 (dm .DefaultTableExpiration / time .Millisecond )
209
217
ds .DefaultPartitionExpirationMs = int64 (dm .DefaultPartitionExpiration / time .Millisecond )
210
218
ds .DefaultCollation = dm .DefaultCollation
219
+ ds .MaxTimeTravelHours = int64 (dm .MaxTimeTravelHours / time .Hour )
211
220
ds .StorageBillingModel = string (dm .StorageBillingModel )
212
221
ds .Labels = dm .Labels
213
222
var err error
@@ -295,6 +304,7 @@ func bqToDatasetMetadata(d *bq.Dataset, c *Client) (*DatasetMetadata, error) {
295
304
DefaultTableExpiration : time .Duration (d .DefaultTableExpirationMs ) * time .Millisecond ,
296
305
DefaultPartitionExpiration : time .Duration (d .DefaultPartitionExpirationMs ) * time .Millisecond ,
297
306
DefaultCollation : d .DefaultCollation ,
307
+ MaxTimeTravelHours : time .Duration (d .MaxTimeTravelHours ) * time .Hour ,
298
308
StorageBillingModel : d .StorageBillingModel ,
299
309
DefaultEncryptionConfig : bqToEncryptionConfig (d .DefaultEncryptionConfiguration ),
300
310
Description : d .Description ,
@@ -385,6 +395,15 @@ func (dm *DatasetMetadataToUpdate) toBQ() (*bq.Dataset, error) {
385
395
ds .DefaultCollation = optional .ToString (dm .DefaultCollation )
386
396
forceSend ("DefaultCollation" )
387
397
}
398
+ if dm .MaxTimeTravelHours != nil {
399
+ dur := optional .ToDuration (dm .MaxTimeTravelHours )
400
+ if dur == 0 {
401
+ // Send a null to delete the field.
402
+ ds .NullFields = append (ds .NullFields , "MaxTimeTravelHours" )
403
+ } else {
404
+ ds .MaxTimeTravelHours = int64 (dur / time .Hour )
405
+ }
406
+ }
388
407
if dm .StorageBillingModel != nil {
389
408
ds .StorageBillingModel = optional .ToString (dm .StorageBillingModel )
390
409
forceSend ("StorageBillingModel" )
0 commit comments