-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: Unhelpful code samples in "Migrating to Python Client Library v0.28+" doc #4929
Comments
@inglesp Is there a specific sample that you believe does too much? |
All of them! (And it's not really that the examples are doing too much, just that the before and after versions are written in totally different ways.) For instance, in the Querying data synchronously section, the before version is:
while the after version is:
The after version defines The before version iterates over the results, printing them one by one; the after version turns the results into a list, asserts the length of the list, and asserts something about the first result. Given the wholesale API changes introduced in 0.28, I would expect much more thought to go into the migration docs, especially as many (most?) of your library's users are paying customers. |
Yeah, you're right that they aren't doing 100% exactly the same thing. Your specific sample to highlight is a good indicator, actually. |
Also, the before version query.rows is a simple Python nested tuple, which is easy to compare and to remove duplicates (by calling Can we 1. update the docs in all places where return type changed? 2. make |
@ye Pull requests welcome. :-) There's definitely precedent for adding methods to the Row class. For example, #4393 makes it so that the Row class acts more like a dictionary. Since I'd expect rows not to be mutable, I think it would make sense for them to be hashable. |
@tswast Seems like this issue has changed from a docs bug to a feature request. Is it still relevant, given that the current release of |
I never updated the migration page samples, but I do think there's probably less demand to do so now. We can close this out. |
The code samples at https://cloud.google.com/bigquery/docs/python-client-migration show similar code before and after the big API changes in 0.28. However, the before and after samples are often very different, making a comparison much harder than it needs to be.
The text was updated successfully, but these errors were encountered: