Skip to content

Commit 1193530

Browse files
chore: use more verbose paths in hello snippets (#1045)
1 parent 7ea3c23 commit 1193530

File tree

17 files changed

+42
-22
lines changed

17 files changed

+42
-22
lines changed

samples/beam/requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest==8.3.2
1+
pytest

samples/hello/async_main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131
# [START bigtable_async_hw_imports]
3232
from google.cloud import bigtable
3333
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
3734
# [END bigtable_async_hw_imports]
3835

36+
# use to ignore warnings
37+
row_filters
38+
3939

4040
async def main(project_id, instance_id, table_id):
4141
# [START bigtable_async_hw_connect]
@@ -85,8 +85,8 @@ async def main(project_id, instance_id, table_id):
8585
#
8686
# https://cloud.google.com/bigtable/docs/schema-design
8787
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)
9090
)
9191
mutations.append(row_mutation)
9292
await table.bulk_mutate_rows(mutations)
@@ -95,7 +95,7 @@ async def main(project_id, instance_id, table_id):
9595
# [START bigtable_async_hw_create_filter]
9696
# Create a filter to only retrieve the most recent version of the cell
9797
# for each column across entire row.
98-
row_filter = row_filters.CellsColumnLimitFilter(1)
98+
row_filter = bigtable.data.row_filters.CellsColumnLimitFilter(1)
9999
# [END bigtable_async_hw_create_filter]
100100

101101
# [START bigtable_async_hw_get_with_filter]
@@ -112,7 +112,7 @@ async def main(project_id, instance_id, table_id):
112112
# [START bigtable_async_hw_scan_with_filter]
113113
# [START bigtable_async_hw_scan_all]
114114
print("Scanning for all greetings:")
115-
query = ReadRowsQuery(row_filter=row_filter)
115+
query = bigtable.data.ReadRowsQuery(row_filter=row_filter)
116116
async for row in await table.read_rows_stream(query):
117117
cell = row.cells[0]
118118
print(cell.value.decode("utf-8"))

samples/hello/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636

3737
# [END bigtable_hw_imports]
3838

39+
# use to avoid warnings
40+
row_filters
41+
column_family
42+
3943

4044
def main(project_id, instance_id, table_id):
4145
# [START bigtable_hw_connect]
@@ -52,7 +56,7 @@ def main(project_id, instance_id, table_id):
5256
print("Creating column family cf1 with Max Version GC rule...")
5357
# Create a column family with GC policy : most recent N versions
5458
# Define the GC policy to retain only the most recent 2 versions
55-
max_versions_rule = column_family.MaxVersionsGCRule(2)
59+
max_versions_rule = bigtable.column_family.MaxVersionsGCRule(2)
5660
column_family_id = "cf1"
5761
column_families = {column_family_id: max_versions_rule}
5862
if not table.exists():
@@ -93,7 +97,7 @@ def main(project_id, instance_id, table_id):
9397
# [START bigtable_hw_create_filter]
9498
# Create a filter to only retrieve the most recent version of the cell
9599
# for each column across entire row.
96-
row_filter = row_filters.CellsColumnLimitFilter(1)
100+
row_filter = bigtable.row_filters.CellsColumnLimitFilter(1)
97101
# [END bigtable_hw_create_filter]
98102

99103
# [START bigtable_hw_get_with_filter]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest==8.3.2
1+
pytest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest==8.3.2
1+
pytest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest==8.3.2
1+
pytest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pytest==8.3.2
1+
pytest
22
mock==5.1.0
33
google-cloud-testutils
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pytest==8.3.2
1+
pytest
22
pytest-asyncio
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest==8.3.2
1+
pytest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pytest==8.3.2
1+
pytest
22
pytest-asyncio

0 commit comments

Comments
 (0)