Skip to content

Commit bd7ce78

Browse files
committed
Remove duplicate methods 'patch_table', 'update_table'
1 parent 12156ca commit bd7ce78

File tree

1 file changed

+0
-84
lines changed

1 file changed

+0
-84
lines changed

bigquery/client.py

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -541,90 +541,6 @@ def create_table(self, dataset, table, schema, expiration_time=None):
541541
else:
542542
return {}
543543

544-
def update_table(self, dataset, table, schema):
545-
"""Update an existing table in the dataset.
546-
547-
Args:
548-
dataset: the dataset to update the table in.
549-
table: the name of table to update.
550-
schema: table schema dict.
551-
552-
Returns:
553-
bool indicating if the table was successfully updated or not,
554-
or response from BigQuery if swallow_results is set for False.
555-
"""
556-
557-
body = {
558-
'schema': {'fields': schema},
559-
'tableReference': {
560-
'tableId': table,
561-
'projectId': self.project_id,
562-
'datasetId': dataset
563-
}
564-
}
565-
566-
try:
567-
result = self.bigquery.tables().update(
568-
projectId=self.project_id,
569-
datasetId=dataset,
570-
body=body
571-
).execute()
572-
if self.swallow_results:
573-
return True
574-
else:
575-
return result
576-
577-
except HttpError as e:
578-
logging.error(('Cannot update table {0}.{1}\n'
579-
'Http Error: {2}').format(dataset, table,
580-
e.content))
581-
if self.swallow_results:
582-
return False
583-
else:
584-
return {}
585-
586-
def patch_table(self, dataset, table, schema):
587-
"""Patch an existing table in the dataset.
588-
589-
Args:
590-
dataset: the dataset to patch the table in.
591-
table: the name of table to patch.
592-
schema: table schema dict.
593-
594-
Returns:
595-
bool indicating if the table was successfully patched or not,
596-
or response from BigQuery if swallow_results is set for False.
597-
"""
598-
599-
body = {
600-
'schema': {'fields': schema},
601-
'tableReference': {
602-
'tableId': table,
603-
'projectId': self.project_id,
604-
'datasetId': dataset
605-
}
606-
}
607-
608-
try:
609-
result = self.bigquery.tables().patch(
610-
projectId=self.project_id,
611-
datasetId=dataset,
612-
body=body
613-
).execute()
614-
if self.swallow_results:
615-
return True
616-
else:
617-
return result
618-
619-
except HttpError as e:
620-
logging.error(('Cannot patch table {0}.{1}\n'
621-
'Http Error: {2}').format(dataset, table,
622-
e.content))
623-
if self.swallow_results:
624-
return False
625-
else:
626-
return {}
627-
628544
def create_view(self, dataset, view, query):
629545
"""Create a new view in the dataset.
630546

0 commit comments

Comments
 (0)