def destination(self): """google.cloud.bigquery.table.TableReference: Table into which data is to be loaded. """ return TableReference.from_api_repr( _helpers._get_sub_prop( self._properties, ["configuration", "copy", "destinationTable"]))
def destination(self): """google.cloud.bigquery.table.TableReference: table where loaded rows are written See: https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobConfigurationLoad.FIELDS.destination_table """ dest_config = _helpers._get_sub_prop( self._properties, ["configuration", "load", "destinationTable"]) return TableReference.from_api_repr(dest_config)
def test_from_api_repr(self): from google.cloud.bigquery.dataset import DatasetReference from google.cloud.bigquery.table import TableReference dataset_ref = DatasetReference('project_1', 'dataset_1') expected = self._make_one(dataset_ref, 'table_1') got = TableReference.from_api_repr({ 'projectId': 'project_1', 'datasetId': 'dataset_1', 'tableId': 'table_1', }) self.assertEqual(expected, got)
def source(self): """Union[ \ google.cloud.bigquery.table.TableReference, \ google.cloud.bigquery.model.ModelReference \ ]: Table or Model from which data is to be loaded or extracted. """ source_config = _helpers._get_sub_prop( self._properties, ["configuration", "extract", "sourceTable"]) if source_config: return TableReference.from_api_repr(source_config) else: source_config = _helpers._get_sub_prop( self._properties, ["configuration", "extract", "sourceModel"]) return ModelReference.from_api_repr(source_config)
def sources(self): """List[google.cloud.bigquery.table.TableReference]): Table(s) from which data is to be loaded. """ source_configs = _helpers._get_sub_prop( self._properties, ["configuration", "copy", "sourceTables"]) if source_configs is None: single = _helpers._get_sub_prop( self._properties, ["configuration", "copy", "sourceTable"]) if single is None: raise KeyError( "Resource missing 'sourceTables' / 'sourceTable'") source_configs = [single] sources = [] for source_config in source_configs: table_ref = TableReference.from_api_repr(source_config) sources.append(table_ref) return sources