Skip to content
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

Error loading full representation from list item #780

Closed
quartzmo opened this issue Jul 18, 2016 · 2 comments
Closed

Error loading full representation from list item #780

quartzmo opened this issue Jul 18, 2016 · 2 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@quartzmo
Copy link
Member

I get this error when calling some methods on Table instances returned by Dataset#tables:

NoMethodError: undefined method `creation_time' for #<Google::Apis::BigqueryV2::TableList::Table:0x007ff49c1f3ce8>
    /Users/quartzmo/code/google/codez/gcloud-ruby/lib/gcloud/bigquery/table.rb:878:in `data_complete?'
    /Users/quartzmo/code/google/codez/gcloud-ruby/lib/gcloud/bigquery/table.rb:868:in `ensure_full_data!'
    /Users/quartzmo/code/google/codez/gcloud-ruby/lib/gcloud/bigquery/table.rb:312:in `location'

The implementation of data_complete? in Dataset, Table, and View should be changed to test the presence of accesors with respond_to?. The current implementation is a remnant from when the gapi object was hash-like. Now the gapi objects for partial representations are actually different types, such as TableList::Table. They lack accessors for the missing data.

@quartzmo quartzmo added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: bigquery Issues related to the BigQuery API. in progress labels Jul 18, 2016
@quartzmo quartzmo self-assigned this Jul 18, 2016
@blowmage
Copy link
Contributor

So there are two different table classes, one with a minimal subset of data, and one with the full data. The object you have there is a Google::Apis::BigqueryV2::TableList::Table, instead of a Google::Apis::BigqueryV2::Table. The way we differentiated between the two before was checking if the creation_time value was there, but with the change to GAPI 0.9 we could check the object's class.

@quartzmo
Copy link
Member Author

Sounds ok to me, I don't mind testing the class instead of relying on a duck-typing approach. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants