@@ -527,13 +527,46 @@ class Dataset(object):
527
527
"friendly_name" : "friendlyName" ,
528
528
"default_encryption_configuration" : "defaultEncryptionConfiguration" ,
529
529
"storage_billing_model" : "storageBillingModel" ,
530
+ "default_rounding_mode" : "defaultRoundingMode" ,
530
531
}
531
532
532
533
def __init__ (self , dataset_ref ) -> None :
533
534
if isinstance (dataset_ref , str ):
534
535
dataset_ref = DatasetReference .from_string (dataset_ref )
535
536
self ._properties = {"datasetReference" : dataset_ref .to_api_repr (), "labels" : {}}
536
537
538
+ @property
539
+ def default_rounding_mode (self ):
540
+ """
541
+ optional[str]: it could have one of the following possible value.
542
+ ROUNDING_MODE_UNSPECIFIED: Unspecified will default to using ROUND_HALF_AWAY_FROM_ZERO.
543
+ ROUND_HALF_AWAY_FROM_ZERO: ROUND_HALF_AWAY_FROM_ZERO rounds half values away from zero when applying precision
544
+ and scale upon writing of NUMERIC and BIGNUMERIC values.
545
+ For Scale: 0 1.1, 1.2, 1.3, 1.4 => 1 1.5, 1.6, 1.7, 1.8, 1.9 => 2
546
+ ROUND_HALF_EVEN: ROUND_HALF_EVEN rounds half values to the nearest even value when applying precision and scale
547
+ upon writing of NUMERIC and BIGNUMERIC values.
548
+ For Scale: 0 1.1, 1.2, 1.3, 1.4 => 1 1.5 => 2 1.6, 1.7, 1.8, 1.9 => 2 2.5 => 2
549
+ """
550
+ return self ._properties .get ("defaultRoundingMode" )
551
+
552
+ @default_rounding_mode .setter
553
+ def default_rounding_mode (self , value ):
554
+ possible_values = [
555
+ "ROUNDING_MODE_UNSPECIFIED" ,
556
+ "ROUND_HALF_AWAY_FROM_ZERO" ,
557
+ "ROUND_HALF_EVEN" ,
558
+ ]
559
+ if not isinstance (value , str ) and value is not None :
560
+ raise ValueError ("Pass a string, or None" )
561
+ if value not in possible_values :
562
+ raise ValueError (
563
+ f'rounding mode needs to be one of { "," .join (possible_values )} '
564
+ )
565
+ if value :
566
+ self ._properties ["defaultRoundingMode" ] = value
567
+ else :
568
+ self ._properties ["defaultRoundingMode" ] = "ROUNDING_MODE_UNSPECIFIED"
569
+
537
570
@property
538
571
def project (self ):
539
572
"""str: Project ID of the project bound to the dataset."""
0 commit comments