Skip to content

Commit b87d566

Browse files
committed
Returning ints from BigQuery Table.num_rows/num_bytes.
Also fixing Table.expires docstring typo.
1 parent 6a9e9bc commit b87d566

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gcloud/bigquery/table.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ def num_bytes(self):
168168
:rtype: integer, or ``NoneType``
169169
:returns: the byte count (None until set from the server).
170170
"""
171-
return self._properties.get('numBytes')
171+
num_bytes_as_str = self._properties.get('numBytes')
172+
if num_bytes_as_str is not None:
173+
return int(num_bytes_as_str)
172174

173175
@property
174176
def num_rows(self):
@@ -177,7 +179,9 @@ def num_rows(self):
177179
:rtype: integer, or ``NoneType``
178180
:returns: the row count (None until set from the server).
179181
"""
180-
return self._properties.get('numRows')
182+
num_rows_as_str = self._properties.get('numRows')
183+
if num_rows_as_str is not None:
184+
return int(num_rows_as_str)
181185

182186
@property
183187
def self_link(self):
@@ -244,7 +248,7 @@ def expires(self):
244248

245249
@expires.setter
246250
def expires(self, value):
247-
"""Update atetime at which the table will be removed.
251+
"""Update datetime at which the table will be removed.
248252
249253
:type value: ``datetime.datetime``, or ``NoneType``
250254
:param value: the new expiration time, or None

0 commit comments

Comments
 (0)