1111# See the License for the specific language governing permissions and
1212# limitations under the License.
1313
14- import datetime
15- from google .cloud .bigtable .data import Row
1614from google .cloud ._helpers import _datetime_from_microseconds
15+ from google .cloud .bigtable .data import Row
1716
1817
1918# [START bigtable_filters_limit_row_sample_asyncio]
2019async def filter_limit_row_sample (project_id , instance_id , table_id ):
21- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
22- from google .cloud .bigtable .data import row_filters
20+ from google .cloud .bigtable .data import (
21+ BigtableDataClientAsync ,
22+ ReadRowsQuery ,
23+ row_filters ,
24+ )
2325
2426 query = ReadRowsQuery (row_filter = row_filters .RowSampleFilter (0.75 ))
2527
@@ -32,8 +34,11 @@ async def filter_limit_row_sample(project_id, instance_id, table_id):
3234# [END bigtable_filters_limit_row_sample_asyncio]
3335# [START bigtable_filters_limit_row_regex_asyncio]
3436async def filter_limit_row_regex (project_id , instance_id , table_id ):
35- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
36- from google .cloud .bigtable .data import row_filters
37+ from google .cloud .bigtable .data import (
38+ BigtableDataClientAsync ,
39+ ReadRowsQuery ,
40+ row_filters ,
41+ )
3742
3843 query = ReadRowsQuery (
3944 row_filter = row_filters .RowKeyRegexFilter (".*#20190501$" .encode ("utf-8" ))
@@ -48,8 +53,11 @@ async def filter_limit_row_regex(project_id, instance_id, table_id):
4853# [END bigtable_filters_limit_row_regex_asyncio]
4954# [START bigtable_filters_limit_cells_per_col_asyncio]
5055async def filter_limit_cells_per_col (project_id , instance_id , table_id ):
51- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
52- from google .cloud .bigtable .data import row_filters
56+ from google .cloud .bigtable .data import (
57+ BigtableDataClientAsync ,
58+ ReadRowsQuery ,
59+ row_filters ,
60+ )
5361
5462 query = ReadRowsQuery (row_filter = row_filters .CellsColumnLimitFilter (2 ))
5563
@@ -62,8 +70,11 @@ async def filter_limit_cells_per_col(project_id, instance_id, table_id):
6270# [END bigtable_filters_limit_cells_per_col_asyncio]
6371# [START bigtable_filters_limit_cells_per_row_asyncio]
6472async def filter_limit_cells_per_row (project_id , instance_id , table_id ):
65- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
66- from google .cloud .bigtable .data import row_filters
73+ from google .cloud .bigtable .data import (
74+ BigtableDataClientAsync ,
75+ ReadRowsQuery ,
76+ row_filters ,
77+ )
6778
6879 query = ReadRowsQuery (row_filter = row_filters .CellsRowLimitFilter (2 ))
6980
@@ -76,8 +87,11 @@ async def filter_limit_cells_per_row(project_id, instance_id, table_id):
7687# [END bigtable_filters_limit_cells_per_row_asyncio]
7788# [START bigtable_filters_limit_cells_per_row_offset_asyncio]
7889async def filter_limit_cells_per_row_offset (project_id , instance_id , table_id ):
79- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
80- from google .cloud .bigtable .data import row_filters
90+ from google .cloud .bigtable .data import (
91+ BigtableDataClientAsync ,
92+ ReadRowsQuery ,
93+ row_filters ,
94+ )
8195
8296 query = ReadRowsQuery (row_filter = row_filters .CellsRowOffsetFilter (2 ))
8397
@@ -90,8 +104,11 @@ async def filter_limit_cells_per_row_offset(project_id, instance_id, table_id):
90104# [END bigtable_filters_limit_cells_per_row_offset_asyncio]
91105# [START bigtable_filters_limit_col_family_regex_asyncio]
92106async def filter_limit_col_family_regex (project_id , instance_id , table_id ):
93- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
94- from google .cloud .bigtable .data import row_filters
107+ from google .cloud .bigtable .data import (
108+ BigtableDataClientAsync ,
109+ ReadRowsQuery ,
110+ row_filters ,
111+ )
95112
96113 query = ReadRowsQuery (
97114 row_filter = row_filters .FamilyNameRegexFilter ("stats_.*$" .encode ("utf-8" ))
@@ -106,8 +123,11 @@ async def filter_limit_col_family_regex(project_id, instance_id, table_id):
106123# [END bigtable_filters_limit_col_family_regex_asyncio]
107124# [START bigtable_filters_limit_col_qualifier_regex_asyncio]
108125async def filter_limit_col_qualifier_regex (project_id , instance_id , table_id ):
109- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
110- from google .cloud .bigtable .data import row_filters
126+ from google .cloud .bigtable .data import (
127+ BigtableDataClientAsync ,
128+ ReadRowsQuery ,
129+ row_filters ,
130+ )
111131
112132 query = ReadRowsQuery (
113133 row_filter = row_filters .ColumnQualifierRegexFilter (
@@ -124,8 +144,11 @@ async def filter_limit_col_qualifier_regex(project_id, instance_id, table_id):
124144# [END bigtable_filters_limit_col_qualifier_regex_asyncio]
125145# [START bigtable_filters_limit_col_range_asyncio]
126146async def filter_limit_col_range (project_id , instance_id , table_id ):
127- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
128- from google .cloud .bigtable .data import row_filters
147+ from google .cloud .bigtable .data import (
148+ BigtableDataClientAsync ,
149+ ReadRowsQuery ,
150+ row_filters ,
151+ )
129152
130153 query = ReadRowsQuery (
131154 row_filter = row_filters .ColumnRangeFilter (
@@ -142,8 +165,11 @@ async def filter_limit_col_range(project_id, instance_id, table_id):
142165# [END bigtable_filters_limit_col_range_asyncio]
143166# [START bigtable_filters_limit_value_range_asyncio]
144167async def filter_limit_value_range (project_id , instance_id , table_id ):
145- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
146- from google .cloud .bigtable .data import row_filters
168+ from google .cloud .bigtable .data import (
169+ BigtableDataClientAsync ,
170+ ReadRowsQuery ,
171+ row_filters ,
172+ )
147173
148174 query = ReadRowsQuery (
149175 row_filter = row_filters .ValueRangeFilter (b"PQ2A.190405" , b"PQ2A.190406" )
@@ -160,8 +186,11 @@ async def filter_limit_value_range(project_id, instance_id, table_id):
160186
161187
162188async def filter_limit_value_regex (project_id , instance_id , table_id ):
163- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
164- from google .cloud .bigtable .data import row_filters
189+ from google .cloud .bigtable .data import (
190+ BigtableDataClientAsync ,
191+ ReadRowsQuery ,
192+ row_filters ,
193+ )
165194
166195 query = ReadRowsQuery (
167196 row_filter = row_filters .ValueRegexFilter ("PQ2A.*$" .encode ("utf-8" ))
@@ -177,8 +206,12 @@ async def filter_limit_value_regex(project_id, instance_id, table_id):
177206# [START bigtable_filters_limit_timestamp_range_asyncio]
178207async def filter_limit_timestamp_range (project_id , instance_id , table_id ):
179208 import datetime
180- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
181- from google .cloud .bigtable .data import row_filters
209+
210+ from google .cloud .bigtable .data import (
211+ BigtableDataClientAsync ,
212+ ReadRowsQuery ,
213+ row_filters ,
214+ )
182215
183216 end = datetime .datetime (2019 , 5 , 1 )
184217
@@ -193,8 +226,11 @@ async def filter_limit_timestamp_range(project_id, instance_id, table_id):
193226# [END bigtable_filters_limit_timestamp_range_asyncio]
194227# [START bigtable_filters_limit_block_all_asyncio]
195228async def filter_limit_block_all (project_id , instance_id , table_id ):
196- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
197- from google .cloud .bigtable .data import row_filters
229+ from google .cloud .bigtable .data import (
230+ BigtableDataClientAsync ,
231+ ReadRowsQuery ,
232+ row_filters ,
233+ )
198234
199235 query = ReadRowsQuery (row_filter = row_filters .BlockAllFilter (True ))
200236
@@ -207,8 +243,11 @@ async def filter_limit_block_all(project_id, instance_id, table_id):
207243# [END bigtable_filters_limit_block_all_asyncio]
208244# [START bigtable_filters_limit_pass_all_asyncio]
209245async def filter_limit_pass_all (project_id , instance_id , table_id ):
210- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
211- from google .cloud .bigtable .data import row_filters
246+ from google .cloud .bigtable .data import (
247+ BigtableDataClientAsync ,
248+ ReadRowsQuery ,
249+ row_filters ,
250+ )
212251
213252 query = ReadRowsQuery (row_filter = row_filters .PassAllFilter (True ))
214253
@@ -221,8 +260,11 @@ async def filter_limit_pass_all(project_id, instance_id, table_id):
221260# [END bigtable_filters_limit_pass_all_asyncio]
222261# [START bigtable_filters_modify_strip_value_asyncio]
223262async def filter_modify_strip_value (project_id , instance_id , table_id ):
224- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
225- from google .cloud .bigtable .data import row_filters
263+ from google .cloud .bigtable .data import (
264+ BigtableDataClientAsync ,
265+ ReadRowsQuery ,
266+ row_filters ,
267+ )
226268
227269 query = ReadRowsQuery (row_filter = row_filters .StripValueTransformerFilter (True ))
228270
@@ -235,8 +277,11 @@ async def filter_modify_strip_value(project_id, instance_id, table_id):
235277# [END bigtable_filters_modify_strip_value_asyncio]
236278# [START bigtable_filters_modify_apply_label_asyncio]
237279async def filter_modify_apply_label (project_id , instance_id , table_id ):
238- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
239- from google .cloud .bigtable .data import row_filters
280+ from google .cloud .bigtable .data import (
281+ BigtableDataClientAsync ,
282+ ReadRowsQuery ,
283+ row_filters ,
284+ )
240285
241286 query = ReadRowsQuery (row_filter = row_filters .ApplyLabelFilter (label = "labelled" ))
242287
@@ -249,8 +294,11 @@ async def filter_modify_apply_label(project_id, instance_id, table_id):
249294# [END bigtable_filters_modify_apply_label_asyncio]
250295# [START bigtable_filters_composing_chain_asyncio]
251296async def filter_composing_chain (project_id , instance_id , table_id ):
252- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
253- from google .cloud .bigtable .data import row_filters
297+ from google .cloud .bigtable .data import (
298+ BigtableDataClientAsync ,
299+ ReadRowsQuery ,
300+ row_filters ,
301+ )
254302
255303 query = ReadRowsQuery (
256304 row_filter = row_filters .RowFilterChain (
@@ -270,8 +318,11 @@ async def filter_composing_chain(project_id, instance_id, table_id):
270318# [END bigtable_filters_composing_chain_asyncio]
271319# [START bigtable_filters_composing_interleave_asyncio]
272320async def filter_composing_interleave (project_id , instance_id , table_id ):
273- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
274- from google .cloud .bigtable .data import row_filters
321+ from google .cloud .bigtable .data import (
322+ BigtableDataClientAsync ,
323+ ReadRowsQuery ,
324+ row_filters ,
325+ )
275326
276327 query = ReadRowsQuery (
277328 row_filter = row_filters .RowFilterUnion (
@@ -291,8 +342,11 @@ async def filter_composing_interleave(project_id, instance_id, table_id):
291342# [END bigtable_filters_composing_interleave_asyncio]
292343# [START bigtable_filters_composing_condition_asyncio]
293344async def filter_composing_condition (project_id , instance_id , table_id ):
294- from google .cloud .bigtable .data import BigtableDataClientAsync , ReadRowsQuery
295- from google .cloud .bigtable .data import row_filters
345+ from google .cloud .bigtable .data import (
346+ BigtableDataClientAsync ,
347+ ReadRowsQuery ,
348+ row_filters ,
349+ )
296350
297351 query = ReadRowsQuery (
298352 row_filter = row_filters .ConditionalRowFilter (
0 commit comments