|
27 | 27 | from google.cloud.bigquery.dataset import Dataset
|
28 | 28 | from google.cloud.bigquery.dataset import DatasetListItem
|
29 | 29 | from google.cloud.bigquery.dataset import DatasetReference
|
| 30 | +from google.cloud.bigquery.encryption_configuration import EncryptionConfiguration |
30 | 31 | from google.cloud.bigquery.external_config import ExternalConfig
|
| 32 | +from google.cloud.bigquery import _helpers |
31 | 33 | from google.cloud.bigquery.query import _query_param_from_api_repr
|
32 | 34 | from google.cloud.bigquery.query import ArrayQueryParameter
|
33 | 35 | from google.cloud.bigquery.query import ScalarQueryParameter
|
|
37 | 39 | from google.cloud.bigquery.routine import RoutineReference
|
38 | 40 | from google.cloud.bigquery.schema import SchemaField
|
39 | 41 | from google.cloud.bigquery.table import _EmptyRowIterator
|
| 42 | +from google.cloud.bigquery.table import RangePartitioning |
40 | 43 | from google.cloud.bigquery.table import _table_arg_to_table_ref
|
41 | 44 | from google.cloud.bigquery.table import TableReference
|
42 | 45 | from google.cloud.bigquery.table import Table
|
43 | 46 | from google.cloud.bigquery.table import TimePartitioning
|
44 |
| -from google.cloud.bigquery import _helpers |
45 |
| -from google.cloud.bigquery.encryption_configuration import EncryptionConfiguration |
46 | 47 |
|
47 | 48 | _DONE_STATE = "DONE"
|
48 | 49 | _STOPPED_REASON = "stopped"
|
@@ -1180,6 +1181,40 @@ def quote_character(self):
|
1180 | 1181 | def quote_character(self, value):
|
1181 | 1182 | self._set_sub_prop("quote", value)
|
1182 | 1183 |
|
| 1184 | + @property |
| 1185 | + def range_partitioning(self): |
| 1186 | + """Optional[google.cloud.bigquery.table.RangePartitioning]: |
| 1187 | + Configures range-based partitioning for destination table. |
| 1188 | +
|
| 1189 | + .. note:: |
| 1190 | + **Beta**. The integer range partitioning feature is in a |
| 1191 | + pre-release state and might change or have limited support. |
| 1192 | +
|
| 1193 | + Only specify at most one of |
| 1194 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.time_partitioning` or |
| 1195 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.range_partitioning`. |
| 1196 | +
|
| 1197 | + Raises: |
| 1198 | + ValueError: |
| 1199 | + If the value is not |
| 1200 | + :class:`~google.cloud.bigquery.table.RangePartitioning` or |
| 1201 | + :data:`None`. |
| 1202 | + """ |
| 1203 | + resource = self._get_sub_prop("rangePartitioning") |
| 1204 | + if resource is not None: |
| 1205 | + return RangePartitioning(_properties=resource) |
| 1206 | + |
| 1207 | + @range_partitioning.setter |
| 1208 | + def range_partitioning(self, value): |
| 1209 | + resource = value |
| 1210 | + if isinstance(value, RangePartitioning): |
| 1211 | + resource = value._properties |
| 1212 | + elif value is not None: |
| 1213 | + raise ValueError( |
| 1214 | + "Expected value to be RangePartitioning or None, got {}.".format(value) |
| 1215 | + ) |
| 1216 | + self._set_sub_prop("rangePartitioning", resource) |
| 1217 | + |
1183 | 1218 | @property
|
1184 | 1219 | def schema(self):
|
1185 | 1220 | """List[google.cloud.bigquery.schema.SchemaField]: Schema of the
|
@@ -1249,6 +1284,10 @@ def source_format(self, value):
|
1249 | 1284 | def time_partitioning(self):
|
1250 | 1285 | """google.cloud.bigquery.table.TimePartitioning: Specifies time-based
|
1251 | 1286 | partitioning for the destination table.
|
| 1287 | +
|
| 1288 | + Only specify at most one of |
| 1289 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.time_partitioning` or |
| 1290 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.range_partitioning`. |
1252 | 1291 | """
|
1253 | 1292 | prop = self._get_sub_prop("timePartitioning")
|
1254 | 1293 | if prop is not None:
|
@@ -1463,6 +1502,13 @@ def destination_table_friendly_name(self):
|
1463 | 1502 | """
|
1464 | 1503 | return self._configuration.destination_table_friendly_name
|
1465 | 1504 |
|
| 1505 | + @property |
| 1506 | + def range_partitioning(self): |
| 1507 | + """See |
| 1508 | + :attr:`google.cloud.bigquery.job.LoadJobConfig.range_partitioning`. |
| 1509 | + """ |
| 1510 | + return self._configuration.range_partitioning |
| 1511 | + |
1466 | 1512 | @property
|
1467 | 1513 | def time_partitioning(self):
|
1468 | 1514 | """See
|
@@ -2242,6 +2288,40 @@ def query_parameters(self):
|
2242 | 2288 | def query_parameters(self, values):
|
2243 | 2289 | self._set_sub_prop("queryParameters", _to_api_repr_query_parameters(values))
|
2244 | 2290 |
|
| 2291 | + @property |
| 2292 | + def range_partitioning(self): |
| 2293 | + """Optional[google.cloud.bigquery.table.RangePartitioning]: |
| 2294 | + Configures range-based partitioning for destination table. |
| 2295 | +
|
| 2296 | + .. note:: |
| 2297 | + **Beta**. The integer range partitioning feature is in a |
| 2298 | + pre-release state and might change or have limited support. |
| 2299 | +
|
| 2300 | + Only specify at most one of |
| 2301 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.time_partitioning` or |
| 2302 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.range_partitioning`. |
| 2303 | +
|
| 2304 | + Raises: |
| 2305 | + ValueError: |
| 2306 | + If the value is not |
| 2307 | + :class:`~google.cloud.bigquery.table.RangePartitioning` or |
| 2308 | + :data:`None`. |
| 2309 | + """ |
| 2310 | + resource = self._get_sub_prop("rangePartitioning") |
| 2311 | + if resource is not None: |
| 2312 | + return RangePartitioning(_properties=resource) |
| 2313 | + |
| 2314 | + @range_partitioning.setter |
| 2315 | + def range_partitioning(self, value): |
| 2316 | + resource = value |
| 2317 | + if isinstance(value, RangePartitioning): |
| 2318 | + resource = value._properties |
| 2319 | + elif value is not None: |
| 2320 | + raise ValueError( |
| 2321 | + "Expected value to be RangePartitioning or None, got {}.".format(value) |
| 2322 | + ) |
| 2323 | + self._set_sub_prop("rangePartitioning", resource) |
| 2324 | + |
2245 | 2325 | @property
|
2246 | 2326 | def udf_resources(self):
|
2247 | 2327 | """List[google.cloud.bigquery.query.UDFResource]: user
|
@@ -2318,8 +2398,18 @@ def table_definitions(self, values):
|
2318 | 2398 |
|
2319 | 2399 | @property
|
2320 | 2400 | def time_partitioning(self):
|
2321 |
| - """google.cloud.bigquery.table.TimePartitioning: Specifies time-based |
2322 |
| - partitioning for the destination table. |
| 2401 | + """Optional[google.cloud.bigquery.table.TimePartitioning]: Specifies |
| 2402 | + time-based partitioning for the destination table. |
| 2403 | +
|
| 2404 | + Only specify at most one of |
| 2405 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.time_partitioning` or |
| 2406 | + :attr:`~google.cloud.bigquery.job.LoadJobConfig.range_partitioning`. |
| 2407 | +
|
| 2408 | + Raises: |
| 2409 | + ValueError: |
| 2410 | + If the value is not |
| 2411 | + :class:`~google.cloud.bigquery.table.TimePartitioning` or |
| 2412 | + :data:`None`. |
2323 | 2413 | """
|
2324 | 2414 | prop = self._get_sub_prop("timePartitioning")
|
2325 | 2415 | if prop is not None:
|
@@ -2552,6 +2642,13 @@ def maximum_bytes_billed(self):
|
2552 | 2642 | """
|
2553 | 2643 | return self._configuration.maximum_bytes_billed
|
2554 | 2644 |
|
| 2645 | + @property |
| 2646 | + def range_partitioning(self): |
| 2647 | + """See |
| 2648 | + :attr:`google.cloud.bigquery.job.QueryJobConfig.range_partitioning`. |
| 2649 | + """ |
| 2650 | + return self._configuration.range_partitioning |
| 2651 | + |
2555 | 2652 | @property
|
2556 | 2653 | def table_definitions(self):
|
2557 | 2654 | """See
|
|
0 commit comments