Repository navigation
feat: add created/started/ended properties to RowIterator. - #2260
Conversation
| """Datetime at which the job was created. | ||
|
|
||
| See: | ||
| https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics.FIELDS.creation_time |
There was a problem hiding this comment.
I don't think this is available on the Query response object, is it?
There was a problem hiding this comment.
Please update the link to the correct object: http://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#body.QueryResponse.FIELDS.creation_time
There was a problem hiding this comment.
Thanks! Didn't notice the difference. Updated.
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
Co-authored-by: Tim Sweña (Swast) <tswast@gmail.com>
| job_resource_done["statistics"]["query"]["creationTime"] = str(1437767599006) | ||
| job_resource_done["statistics"]["query"]["startTime"] = str(1437767600007) | ||
| job_resource_done["statistics"]["query"]["endTime"] = str(1437767601008) |
There was a problem hiding this comment.
To make the assertions easier, use datetime objects and a helper function like I added in #2250
def _to_millis(dt: datetime.datetime) -> str:
return str(
int(
(dt - datetime.datetime(1970, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc))
/ datetime.timedelta(milliseconds=1)
)
)| self.assertEqual(result.created.timestamp() * 1000, 1437767599006) | ||
| self.assertEqual(result.started.timestamp() * 1000, 1437767600007) | ||
| self.assertEqual(result.ended.timestamp() * 1000, 1437767601008) |
There was a problem hiding this comment.
I would recommend avoiding the cast to float of using timestamp(), this can introduce rounding errors.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #2261🦕