@@ -781,6 +781,27 @@ def _set_sub_prop(self, key, value):
781781 """
782782 _helpers ._set_sub_prop (self ._properties , [self ._job_type , key ], value )
783783
784+ def _del_sub_prop (self , key ):
785+ """Reove ``key`` from the ``self._properties[self._job_type]`` dict.
786+
787+ Most job properties are inside the dictionary related to the job type
788+ (e.g. 'copy', 'extract', 'load', 'query'). Use this method to clear
789+ those properties::
790+
791+ self._del_sub_prop('useLegacySql')
792+
793+ This is equivalent to using the ``_helper._del_sub_prop`` function::
794+
795+ _helper._del_sub_prop(
796+ self._properties, ['query', 'useLegacySql'])
797+
798+ Arguments:
799+ key (str):
800+ Key to remove in the ``self._properties[self._job_type]``
801+ dictionary.
802+ """
803+ _helpers ._del_sub_prop (self ._properties , [self ._job_type , key ])
804+
784805 def to_api_repr (self ):
785806 """Build an API representation of the job config.
786807
@@ -1051,6 +1072,34 @@ def time_partitioning(self, value):
10511072 api_repr = value .to_api_repr ()
10521073 self ._set_sub_prop ('timePartitioning' , api_repr )
10531074
1075+ @property
1076+ def clustering_fields (self ):
1077+ """Union[List[str], None]: Fields defining clustering for the table
1078+
1079+ (Defaults to :data:`None`).
1080+
1081+ Clustering fields are immutable after table creation.
1082+
1083+ .. note::
1084+
1085+ As of 2018-06-29, clustering fields cannot be set on a table
1086+ which does not also have time partioning defined.
1087+ """
1088+ prop = self ._get_sub_prop ('clustering' )
1089+ if prop is not None :
1090+ return list (prop .get ('fields' , ()))
1091+
1092+ @clustering_fields .setter
1093+ def clustering_fields (self , value ):
1094+ """Union[List[str], None]: Fields defining clustering for the table
1095+
1096+ (Defaults to :data:`None`).
1097+ """
1098+ if value is not None :
1099+ self ._set_sub_prop ('clustering' , {'fields' : value })
1100+ else :
1101+ self ._del_sub_prop ('clustering' )
1102+
10541103 @property
10551104 def schema_update_options (self ):
10561105 """List[google.cloud.bigquery.job.SchemaUpdateOption]: Specifies
@@ -1217,6 +1266,13 @@ def time_partitioning(self):
12171266 """
12181267 return self ._configuration .time_partitioning
12191268
1269+ @property
1270+ def clustering_fields (self ):
1271+ """See
1272+ :attr:`google.cloud.bigquery.job.LoadJobConfig.clustering_fields`.
1273+ """
1274+ return self ._configuration .clustering_fields
1275+
12201276 @property
12211277 def schema_update_options (self ):
12221278 """See
@@ -2037,6 +2093,34 @@ def time_partitioning(self, value):
20372093 api_repr = value .to_api_repr ()
20382094 self ._set_sub_prop ('timePartitioning' , api_repr )
20392095
2096+ @property
2097+ def clustering_fields (self ):
2098+ """Union[List[str], None]: Fields defining clustering for the table
2099+
2100+ (Defaults to :data:`None`).
2101+
2102+ Clustering fields are immutable after table creation.
2103+
2104+ .. note::
2105+
2106+ As of 2018-06-29, clustering fields cannot be set on a table
2107+ which does not also have time partioning defined.
2108+ """
2109+ prop = self ._get_sub_prop ('clustering' )
2110+ if prop is not None :
2111+ return list (prop .get ('fields' , ()))
2112+
2113+ @clustering_fields .setter
2114+ def clustering_fields (self , value ):
2115+ """Union[List[str], None]: Fields defining clustering for the table
2116+
2117+ (Defaults to :data:`None`).
2118+ """
2119+ if value is not None :
2120+ self ._set_sub_prop ('clustering' , {'fields' : value })
2121+ else :
2122+ self ._del_sub_prop ('clustering' )
2123+
20402124 @property
20412125 def schema_update_options (self ):
20422126 """List[google.cloud.bigquery.job.SchemaUpdateOption]: Specifies
@@ -2227,6 +2311,13 @@ def time_partitioning(self):
22272311 """
22282312 return self ._configuration .time_partitioning
22292313
2314+ @property
2315+ def clustering_fields (self ):
2316+ """See
2317+ :attr:`google.cloud.bigquery.job.QueryJobConfig.clustering_fields`.
2318+ """
2319+ return self ._configuration .clustering_fields
2320+
22302321 @property
22312322 def schema_update_options (self ):
22322323 """See
0 commit comments