

def update_table(self, dataset, table, schema):
    'Update an existing table in the dataset.\n\n        Parameters\n        ----------\n        dataset : str\n            The dataset to update the table in\n        table : str\n            The name of the table to update\n        schema : dict\n            Table schema\n\n        Returns\n        -------\n        Union[bool, dict]\n            bool indicating if the table was successfully updated or not,\n            or response from BigQuery if swallow_results is set to False.\n        '
    body = {
        'schema': {
            'fields': schema,
        },
        'tableReference': {
            'tableId': table,
            'projectId': self.project_id,
            'datasetId': dataset,
        },
    }
    try:
        result = self.bigquery.tables().update(projectId=self.project_id, datasetId=dataset, body=body).execute()
        if self.swallow_results:
            return True
        else:
            return result
    except HttpError as e:
        logger.error('Cannot update table {0}.{1}\nHttp Error: {2}'.format(dataset, table, e.content))
        if self.swallow_results:
            return False
        else:
            return {
                
            }

dataset/ETHPy150Open tylertreat/BigQuery-Python/bigquery/client.py BigQueryClient.update_table/original