Skip to content

Commit 790733b

Browse files
committed
Move '_convert_timestamp' helper out to module scope.
Addresses: googleapis/google-cloud-python#2805 (comment)
1 parent bacbf24 commit 790733b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

google/cloud/bigquery/table.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,11 +738,6 @@ def insert_data(self,
738738
rows_info = []
739739
data = {'rows': rows_info}
740740

741-
def _convert_timestamp(value):
742-
if isinstance(value, datetime.datetime):
743-
value = _microseconds_from_datetime(value) * 1e-6
744-
return value
745-
746741
for index, row in enumerate(rows):
747742
row_info = {}
748743

@@ -1134,3 +1129,10 @@ class _UrlBuilder(object):
11341129
def __init__(self):
11351130
self.query_params = {}
11361131
self._relative_path = ''
1132+
1133+
1134+
def _convert_timestamp(value):
1135+
"""Helper for :meth:`Table.insert_data`."""
1136+
if isinstance(value, datetime.datetime):
1137+
value = _microseconds_from_datetime(value) * 1e-6
1138+
return value

0 commit comments

Comments
 (0)