@@ -296,7 +296,7 @@ def cells(self, row, column, versions=None, timestamp=None,
296296 curr_cells , include_timestamp = include_timestamp )
297297
298298 def scan (self , row_start = None , row_stop = None , row_prefix = None ,
299- columns = None , filter = None , timestamp = None ,
299+ columns = None , timestamp = None ,
300300 include_timestamp = False , limit = None , ** kwargs ):
301301 """Create a scanner for data in this table.
302302
@@ -314,6 +314,15 @@ def scan(self, row_start=None, row_stop=None, row_prefix=None,
314314 omitted, a full table scan is done. Note that this usually results
315315 in severe performance problems.
316316
317+ The keyword argument ``filter`` is also supported (beyond column and
318+ row range filters supported here). HappyBase / HBase users will have
319+ used this as an HBase filter string. (See the `Thrift docs`_ for more
320+ details on those filters.) However, Google Cloud Bigtable doesn't
321+ support those filter strings so a
322+ :class:`~gcloud.bigtable.row.RowFilter` should be used instead.
323+
324+ .. _Thrift docs: http://hbase.apache.org/0.94/book/thrift.html
325+
317326 The arguments ``batch_size``, ``scan_batching`` and ``sorted_columns``
318327 are allowed (as keyword arguments) for compatibility with
319328 HappyBase. However, they will not be used in any way, and will cause a
@@ -348,13 +357,6 @@ def scan(self, row_start=None, row_stop=None, row_prefix=None,
348357 * an entire column family: ``fam`` or ``fam:``
349358 * a single column: ``fam:col``
350359
351- :type filter: :class:`RowFilter <gcloud.bigtable.row.RowFilter>`
352- :param filter: (Optional) An additional filter (beyond column and
353- row range filters supported here). HappyBase / HBase
354- users will have used this as an HBase filter string. See
355- http://hbase.apache.org/0.94/book/thrift.html
356- for more details on those filters.
357-
358360 :type timestamp: int
359361 :param timestamp: (Optional) Timestamp (in milliseconds since the
360362 epoch). If specified, only cells returned before (or
@@ -376,6 +378,7 @@ def scan(self, row_start=None, row_stop=None, row_prefix=None,
376378 :class:`TypeError <exceptions.TypeError>` if a string
377379 ``filter`` is used.
378380 """
381+ filter_ = kwargs .pop ('filter' , None )
379382 legacy_args = []
380383 for kw_name in ('batch_size' , 'scan_batching' , 'sorted_columns' ):
381384 if kw_name in kwargs :
@@ -399,22 +402,22 @@ def scan(self, row_start=None, row_stop=None, row_prefix=None,
399402 row_stop = _string_successor (row_prefix )
400403
401404 filters = []
402- if isinstance (filter , six .string_types ):
405+ if isinstance (filter_ , six .string_types ):
403406 raise TypeError ('Specifying filters as a string is not supported '
404407 'by Cloud Bigtable. Use a '
405408 'gcloud.bigtable.row.RowFilter instead.' )
406- elif filter is not None :
407- filters .append (filter )
409+ elif filter_ is not None :
410+ filters .append (filter_ )
408411
409412 if columns is not None :
410413 filters .append (_columns_filter_helper (columns ))
411414 # versions == 1 since we only want the latest.
412- filter_ = _filter_chain_helper (versions = 1 , timestamp = timestamp ,
413- filters = filters )
415+ filter_chain = _filter_chain_helper (versions = 1 , timestamp = timestamp ,
416+ filters = filters )
414417
415418 partial_rows_data = self ._low_level_table .read_rows (
416419 start_key = row_start , end_key = row_stop ,
417- limit = limit , filter_ = filter_ )
420+ limit = limit , filter_ = filter_chain )
418421
419422 # Mutable copy of data.
420423 rows_dict = partial_rows_data .rows
0 commit comments