Skip to content

Bigtable: TimestampRangeFilter rejects time.  #4932

@taish

Description

@taish

Bigtable supports millisecond granularity but using microsecond granularity in TimestampRange

https://googlecloudplatform.github.io/google-cloud-python/latest/_modules/google/cloud/bigtable/row_filters.html#TimestampRange

Therefore, it was the result in the following error:

Timestamp granularity mismatch. Expected a multiple of 1000 (millisecond granularity), but got 1519628106494933.

Code

end = datetime.datetime.now()
start = end - datetime.timedelta(minutes = 60)
timefilter = TimestampRangeFilter(TimestampRange(start=start, end=end))
row_data = table.read_rows(filter_=timefilter)
row_data.consume_all()

Stacktrace

_RendezvousTraceback (most recent call last)
<ipython-input-69-b9d4b2239efa> in <module>()
      4 timefilter = TimestampRangeFilter(TimestampRange(start=start, end=end))
      5 row_data = table.read_rows(filter_=timefilter)
----> 6 row_data.consume_all()

/usr/local/envs/py2env/lib/python2.7/site-packages/google/cloud/bigtable/row_data.pyc in consume_all(self, max_loops)
    325             curr_loop += 1
    326             try:
--> 327                 self.consume_next()
    328             except StopIteration:
    329                 break

/usr/local/envs/py2env/lib/python2.7/site-packages/google/cloud/bigtable/row_data.pyc in consume_next(self)
    259         :attr:`_rows`. Rows are returned in order by row key.
    260         """
--> 261         response = six.next(self._response_iterator)
    262         self._counter += 1
    263 

/usr/local/envs/py2env/lib/python2.7/site-packages/grpc/_channel.pyc in next(self)
    348 
    349     def next(self):
--> 350         return self._next()
    351 
    352     def is_active(self):

/usr/local/envs/py2env/lib/python2.7/site-packages/grpc/_channel.pyc in _next(self)
    339                         raise StopIteration()
    340                     elif self._state.code is not None:
--> 341                         raise self
    342 
    343     def __iter__(self):

_Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, Error in field 'timestamp_range_filter' : Timestamp granularity mismatch. Expected a multiple of 1000 (millisecond granularity), but got 1519628106494933.)>```

Metadata

Metadata

Labels

api: bigtableIssues related to the Bigtable API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions