diff --git a/bigquery/google/cloud/bigquery/job.py b/bigquery/google/cloud/bigquery/job.py index 94a2290cc29e..1aa99e699db3 100644 --- a/bigquery/google/cloud/bigquery/job.py +++ b/bigquery/google/cloud/bigquery/job.py @@ -1257,9 +1257,18 @@ def __init__(self, job_id, source_uris, destination, client, job_config=None): job_config = LoadJobConfig() self.source_uris = source_uris - self.destination = destination + self._destination = destination self._configuration = job_config + @property + def destination(self): + """google.cloud.bigquery.table.TableReference: table where loaded rows are written + + See: + https://g.co/cloud/bigquery/docs/reference/rest/v2/jobs#configuration.load.destinationTable + """ + return self._destination + @property def allow_jagged_rows(self): """See @@ -1371,6 +1380,24 @@ def destination_encryption_configuration(self): """ return self._configuration.destination_encryption_configuration + @property + def destination_table_description(self): + """Union[str, None] name given to destination table. + + See: + https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.destinationTableProperties.description + """ + return self._configuration.destination_table_description + + @property + def destination_table_friendly_name(self): + """Union[str, None] name given to destination table. + + See: + https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.load.destinationTableProperties.friendlyName + """ + return self._configuration.destination_table_friendly_name + @property def time_partitioning(self): """See diff --git a/bigquery/tests/unit/test_job.py b/bigquery/tests/unit/test_job.py index a42d9ffc311c..bbb2c54d852f 100644 --- a/bigquery/tests/unit/test_job.py +++ b/bigquery/tests/unit/test_job.py @@ -1786,6 +1786,8 @@ def test_ctor(self): self.assertIsNone(job.source_format) self.assertIsNone(job.write_disposition) self.assertIsNone(job.destination_encryption_configuration) + self.assertIsNone(job.destination_table_description) + self.assertIsNone(job.destination_table_friendly_name) self.assertIsNone(job.time_partitioning) self.assertIsNone(job.use_avro_logical_types) self.assertIsNone(job.clustering_fields) @@ -1804,6 +1806,16 @@ def test_ctor_w_config(self): self.JOB_ID, [self.SOURCE1], self.TABLE_REF, client, config ) self.assertEqual(job.schema, [full_name, age]) + config.destination_table_description = "Description" + expected = {"description": "Description"} + self.assertEqual( + config._properties["load"]["destinationTableProperties"], expected + ) + friendly_name = "Friendly Name" + config._properties["load"]["destinationTableProperties"] = { + "friendlyName": friendly_name + } + self.assertEqual(config.destination_table_friendly_name, friendly_name) def test_ctor_w_job_reference(self): from google.cloud.bigquery import job