New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bigquery: No way to get job statistics from Query #4745
Comments
What stats are you interested in? A specific subset, or all? |
Ideally as many as possible but for now just I realize the response from the queries API only exposes certain fields. |
Would it be sufficient to expose the RowIterator source I wonder? With the job reference you could then get the job metadata at your leisure. |
In the case of the slow path the source would be a |
Yeah, both paths retain a reference to the job identifier/reference. However, a RowIterator can be instantiated from a table directly, or by a query. So we either have a job reference or a table reference. |
Take a look at #4748 and see if that would address your needs. |
Yep! That should work perfectly. Thanks for such a quick turnaround! I wasn't originally aware that the |
RowIterator can currently come from calling Read() on a Table, Read() on a Job, and Read() directly from a Query. The third invocation is used for fast path queries and doesn't return a query identifier suitable for gathering statistics. This PR exposes a SourceJob() method on RowIterator to address this issue. Users still get the benefits of optimized query execution, but can get the reference to a Job for looking up additional statistics should they need it. Fixes: #4745
@shollyman thank you so much for the quick resolution! 🙏 |
@shollyman what's the process for getting this into a release? I saw that v0.95.0 was created for the repo but it seems like the bigquery package is on v1.22.0 and a different version structure/scheme? |
Working on that this week actually. bigquery is its own submodule and released independently. Keep an eye on #4738 for updates. |
Is your feature request related to a problem? Please describe.
I'd like to use
Query.Read
to query and read the rows which can use the fast path queries API however the returned iterator does not give me any statistics on the query.Describe the solution you'd like
Can the job's Statistics be put on the iterator so we could get them for metrics/billing purposes without having to resort to using the jobs.insert API?
Describe alternatives you've considered
Alternatively a new method could be added to only do the fast path and return an error if its not supported but this seems more complicated than just adding another field/method onto the iterator.
The text was updated successfully, but these errors were encountered: