| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 51c1f37 commit 728b07c
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -126,6 +126,20 @@ def operation_type(self, value: Optional[str]): | |||
| 126 | 126 | value = OperationType.OPERATION_TYPE_UNSPECIFIED | |
| 127 | 127 | self._set_sub_prop("operationType", value) | |
| 128 | 128 | ||
| 129 | + @property | ||
| 130 | + def destination_expiration_time(self) -> str: | ||
| 131 | + """google.cloud.bigquery.job.DestinationExpirationTime: The time when the | ||
| 132 | + destination table expires. Expired tables will be deleted and their storage reclaimed. | ||
| 133 | + | ||
| 134 | + See | ||
| 135 | + https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationTableCopy.FIELDS.destination_expiration_time | ||
| 136 | + """ | ||
| 137 | + return self._get_sub_prop("destinationExpirationTime") | ||
| 138 | + | ||
| 139 | + @destination_expiration_time.setter | ||
| 140 | + def destination_expiration_time(self, value: str): | ||
| 141 | + self._set_sub_prop("destinationExpirationTime", value) | ||
| 142 | + | ||
| 129 | 143 | ||
| 130 | 144 | class CopyJob(_AsyncJob): | |
| 131 | 145 | """Asynchronous job: copy data into a table from other tables. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2153,6 +2153,11 @@ def test_table_snapshots(dataset_id): | |||
| 2153 | 2153 | copy_config = CopyJobConfig() | |
| 2154 | 2154 | copy_config.operation_type = OperationType.SNAPSHOT | |
| 2155 | 2155 | ||
| 2156 | + today = datetime.date.today() | ||
| 2157 | + destination_expiration_time = f"{today.year + 1}-01-01T00:00:00Z" | ||
| 2158 | + | ||
| 2159 | + copy_config.destination_expiration_time = destination_expiration_time | ||
| 2160 | + | ||
| 2156 | 2161 | copy_job = client.copy_table( | |
| 2157 | 2162 | sources=source_table_path, | |
| 2158 | 2163 | destination=snapshot_table_path, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,8 @@ | |||
| 19 | 19 | from .helpers import _Base | |
| 20 | 20 | from .helpers import _make_client | |
| 21 | 21 | ||
| 22 | + import datetime | ||
| 23 | + | ||
| 22 | 24 | ||
| 23 | 25 | class TestCopyJobConfig(_Base): | |
| 24 | 26 | JOB_TYPE = "copy" | |
@@ -36,6 +38,7 @@ def test_ctor_defaults(self): | |||
| 36 | 38 | ||
| 37 | 39 | assert config.create_disposition is None | |
| 38 | 40 | assert config.write_disposition is None | |
| 41 | + assert config.destination_expiration_time is None | ||
| 39 | 42 | assert config.destination_encryption_configuration is None | |
| 40 | 43 | assert config.operation_type == OperationType.OPERATION_TYPE_UNSPECIFIED | |
| 41 | 44 | ||
@@ -48,15 +51,22 @@ def test_ctor_w_properties(self): | |||
| 48 | 51 | write_disposition = WriteDisposition.WRITE_TRUNCATE | |
| 49 | 52 | snapshot_operation = OperationType.SNAPSHOT | |
| 50 | 53 | ||
| 54 | + today = datetime.date.today() | ||
| 55 | + destination_expiration_time = f"{today.year + 1}-01-01T00:00:00Z" | ||
| 56 | + | ||
| 51 | 57 | config = self._get_target_class()( | |
| 52 | 58 | create_disposition=create_disposition, | |
| 53 | 59 | write_disposition=write_disposition, | |
| 54 | 60 | operation_type=snapshot_operation, | |
| 61 | + destination_expiration_time=destination_expiration_time, | ||
| 55 | 62 | ) | |
| 56 | 63 | ||
| 57 | 64 | self.assertEqual(config.create_disposition, create_disposition) | |
| 58 | 65 | self.assertEqual(config.write_disposition, write_disposition) | |
| 59 | 66 | self.assertEqual(config.operation_type, snapshot_operation) | |
| 67 | + self.assertEqual( | ||
| 68 | + config.destination_expiration_time, destination_expiration_time | ||
| 69 | + ) | ||
| 60 | 70 | ||
| 61 | 71 | def test_to_api_repr_with_encryption(self): | |
| 62 | 72 | from google.cloud.bigquery.encryption_configuration import ( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments