31
31
# [START bigtable_async_hw_imports]
32
32
from google .cloud import bigtable
33
33
from google .cloud .bigtable .data import row_filters
34
- from google .cloud .bigtable .data import RowMutationEntry
35
- from google .cloud .bigtable .data import SetCell
36
- from google .cloud .bigtable .data import ReadRowsQuery
37
34
# [END bigtable_async_hw_imports]
38
35
36
+ # use to ignore warnings
37
+ row_filters
38
+
39
39
40
40
async def main (project_id , instance_id , table_id ):
41
41
# [START bigtable_async_hw_connect]
@@ -85,8 +85,8 @@ async def main(project_id, instance_id, table_id):
85
85
#
86
86
# https://cloud.google.com/bigtable/docs/schema-design
87
87
row_key = "greeting{}" .format (i ).encode ()
88
- row_mutation = RowMutationEntry (
89
- row_key , SetCell (column_family_id , column , value )
88
+ row_mutation = bigtable . data . RowMutationEntry (
89
+ row_key , bigtable . data . SetCell (column_family_id , column , value )
90
90
)
91
91
mutations .append (row_mutation )
92
92
await table .bulk_mutate_rows (mutations )
@@ -95,7 +95,7 @@ async def main(project_id, instance_id, table_id):
95
95
# [START bigtable_async_hw_create_filter]
96
96
# Create a filter to only retrieve the most recent version of the cell
97
97
# for each column across entire row.
98
- row_filter = row_filters .CellsColumnLimitFilter (1 )
98
+ row_filter = bigtable . data . row_filters .CellsColumnLimitFilter (1 )
99
99
# [END bigtable_async_hw_create_filter]
100
100
101
101
# [START bigtable_async_hw_get_with_filter]
@@ -112,7 +112,7 @@ async def main(project_id, instance_id, table_id):
112
112
# [START bigtable_async_hw_scan_with_filter]
113
113
# [START bigtable_async_hw_scan_all]
114
114
print ("Scanning for all greetings:" )
115
- query = ReadRowsQuery (row_filter = row_filter )
115
+ query = bigtable . data . ReadRowsQuery (row_filter = row_filter )
116
116
async for row in await table .read_rows_stream (query ):
117
117
cell = row .cells [0 ]
118
118
print (cell .value .decode ("utf-8" ))
0 commit comments