Skip to content

Commit d404b6d

Browse files
authored
Merge pull request #152 from ybastide/master
Fix client.patch_table
2 parents 88d99de + 5cc95ba commit d404b6d

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ notifications:
1010
email: false
1111
env:
1212
- TOXENV=py27
13-
- TOXENV=py34
13+
- TOXENV=py35
14+
- TOXENV=py36
1415
- TOXENV=nightly
1516
- TOXENV=pypy

bigquery/client.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,17 +735,13 @@ def patch_table(self, dataset, table, schema, project_id=None):
735735

736736
body = {
737737
'schema': {'fields': schema},
738-
'tableReference': {
739-
'tableId': table,
740-
'projectId': project_id,
741-
'datasetId': dataset
742-
}
743738
}
744739

745740
try:
746741
result = self.bigquery.tables().patch(
747742
projectId=project_id,
748743
datasetId=dataset,
744+
tableId=table,
749745
body=body
750746
).execute(num_retries=self.num_retries)
751747
if self.swallow_results:

bigquery/tests/test_client.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,9 +1913,6 @@ def setUp(self):
19131913
self.client = client.BigQueryClient(self.mock_bq_service, self.project)
19141914
self.body = {
19151915
'schema': {'fields': self.schema},
1916-
'tableReference': {
1917-
'tableId': self.table, 'projectId': self.project,
1918-
'datasetId': self.dataset}
19191916
}
19201917
self.expiration_time = 1437513693000
19211918

@@ -1941,7 +1938,8 @@ def test_table_patch_failed(self):
19411938
self.client.swallow_results = True
19421939

19431940
self.mock_tables.patch.assert_called_with(
1944-
projectId=self.project, datasetId=self.dataset, body=self.body)
1941+
projectId=self.project, datasetId=self.dataset,
1942+
tableId=self.table, body=self.body)
19451943

19461944
self.mock_tables.patch.return_value.execute. \
19471945
assert_called_with(num_retries=0)
@@ -1968,7 +1966,8 @@ def test_table_patch_success(self):
19681966
self.client.swallow_results = True
19691967

19701968
self.mock_tables.patch.assert_called_with(
1971-
projectId=self.project, datasetId=self.dataset, body=self.body)
1969+
projectId=self.project, datasetId=self.dataset,
1970+
tableId=self.table, body=self.body)
19721971

19731972
self.mock_tables.patch.return_value.execute. \
19741973
assert_called_with(num_retries=0)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py27, py33, py34, nightly, pypy
7+
envlist = py27, py35, py36, nightly, pypy
88

99
[testenv]
1010
commands = nosetests --logging-level=ERROR -a slow --with-coverage --cover-package=bigquery

0 commit comments

Comments
 (0)