🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

feat: add created/started/ended properties to RowIterator. - #2260

Merged
tswast merged 11 commits into
googleapis:mainfrom
Genesis929:bq_exe_time_row_it
Aug 14, 2025
Merged

tswast merged 11 commits into
googleapis:mainfrom
Genesis929:bq_exe_time_row_it

Conversation

@Genesis929

@Genesis929 Genesis929 commented Aug 12, 2025 •

Copy link
Copy Markdown
Contributor

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2261🦕

@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Aug 12, 2025
@Genesis929 Genesis929 changed the title feat: add created/started/ended attribute to RowIterator. feat: add created/started/ended properties to RowIterator. Aug 12, 2025
Comment thread google/cloud/bigquery/query.py Outdated
"""Datetime at which the job was created.

See:
https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#JobStatistics.FIELDS.creation_time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is available on the Query response object, is it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Genesis929 Genesis929 Aug 12, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Didn't notice the difference. Updated.

@Genesis929
Genesis929 marked this pull request as ready for review August 12, 2025 21:02
@Genesis929
Genesis929 requested review from a team and Neenu1995 August 12, 2025 21:02
@Genesis929
Genesis929 requested a review from tswast August 12, 2025 21:02
Comment thread google/cloud/bigquery/job/query.py Outdated
Comment thread google/cloud/bigquery/query.py Outdated
Comment thread google/cloud/bigquery/query.py Outdated
Comment thread google/cloud/bigquery/query.py Outdated
Comment thread google/cloud/bigquery/table.py Outdated
Comment thread google/cloud/bigquery/table.py Outdated
@Genesis929 Genesis929 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 13, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 13, 2025
@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 13, 2025
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 13, 2025
Genesis929 and others added 6 commits August 13, 2025 13:48
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>
Comment thread tests/unit/job/test_query.py Outdated
Comment on lines +892 to +894
job_resource_done["statistics"]["query"]["creationTime"] = str(1437767599006)
job_resource_done["statistics"]["query"]["startTime"] = str(1437767600007)
job_resource_done["statistics"]["query"]["endTime"] = str(1437767601008)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
        )
    )

Comment thread tests/unit/job/test_query.py Outdated
Comment on lines +977 to +979
self.assertEqual(result.created.timestamp() * 1000, 1437767599006)
self.assertEqual(result.started.timestamp() * 1000, 1437767600007)
self.assertEqual(result.ended.timestamp() * 1000, 1437767601008)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend avoiding the cast to float of using timestamp(), this can introduce rounding errors.

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose Job Lifecycle Timestamps (created, started, ended) on RowIterator

5 participants