{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/1812","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/1812/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/1812/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/1812/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/issues/1812","id":156069441,"number":1812,"title":"Bigtable `PartialRowsData` is not an iterable.","user":{"login":"tswast","id":247555,"avatar_url":"https://avatars.githubusercontent.com/u/247555?v=3","gravatar_id":"","url":"https://api.github.com/users/tswast","html_url":"https://github.com/tswast","followers_url":"https://api.github.com/users/tswast/followers","following_url":"https://api.github.com/users/tswast/following{/other_user}","gists_url":"https://api.github.com/users/tswast/gists{/gist_id}","starred_url":"https://api.github.com/users/tswast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tswast/subscriptions","organizations_url":"https://api.github.com/users/tswast/orgs","repos_url":"https://api.github.com/users/tswast/repos","events_url":"https://api.github.com/users/tswast/events{/privacy}","received_events_url":"https://api.github.com/users/tswast/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/labels/bigtable","name":"bigtable","color":"0052cc"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-05-20T23:36:12Z","updated_at":"2016-06-23T23:59:07Z","closed_at":"2016-06-23T23:59:07Z","body":"It appears to me that if I want to scan through all rows of a Bigtable, [`Table.read_rows()`](https://googlecloudplatform.github.io/gcloud-python/stable/bigtable-table.html#gcloud.bigtable.table.Table.read_rows) is the function to use. This returns a [PartialRowsData](https://googlecloudplatform.github.io/gcloud-python/stable/bigtable-row-data.html#gcloud.bigtable.row_data.PartialRowsData).\r\n\r\nWhy is `PartialRowsData` not an iterable? I'd like to consume all the rows for a \"hello bigtable\" sample by iterating through them. Something like\r\n\r\n```\r\nprint('Scan for all greetings:')\r\nfor row in table.read_rows():\r\n    print(row.cells[COLUMN_FAMILY_NAME][COLUMN_NAME.encode('UTF-8')][0].decode('UTF-8'))\r\n```\r\n\r\nInstead, it appears that I need to use a while loop and watch a dictionary that gets populated. I think this means that even if I don't need to store all the rows in memory at once, they still do. That's both inefficient and not following Python idioms (of generators / iterables)."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/comments/228220458","html_url":"https://github.com/GoogleCloudPlatform/gcloud-python/issues/1812#issuecomment-228220458","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-python/issues/1812","id":228220458,"user":{"login":"tswast","id":247555,"avatar_url":"https://avatars.githubusercontent.com/u/247555?v=3","gravatar_id":"","url":"https://api.github.com/users/tswast","html_url":"https://github.com/tswast","followers_url":"https://api.github.com/users/tswast/followers","following_url":"https://api.github.com/users/tswast/following{/other_user}","gists_url":"https://api.github.com/users/tswast/gists{/gist_id}","starred_url":"https://api.github.com/users/tswast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tswast/subscriptions","organizations_url":"https://api.github.com/users/tswast/orgs","repos_url":"https://api.github.com/users/tswast/repos","events_url":"https://api.github.com/users/tswast/events{/privacy}","received_events_url":"https://api.github.com/users/tswast/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T23:59:07Z","updated_at":"2016-06-23T23:59:07Z","body":"I've thought about this some more (and read the source code). I'm starting to think the current implementation is the only way it can work, at least if we want to provide full rows in the client.\r\n\r\nMaybe we could return a partial row and then later another partial row with the same key? I'm wondering if that behavior would be more intuitive than filling the client's memory. Probably not, actually."}}
{"actor":{"display_login":"tswast"}}