Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/hello/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from main import main

PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_INSTANCE = os.environ['BIGTABLE_INSTANCE']
TABLE_NAME_FORMAT = 'hello-world-test-{}'
TABLE_NAME_RANGE = 10000
Expand Down
3 changes: 1 addition & 2 deletions samples/hello/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
2 changes: 1 addition & 1 deletion samples/hello_happybase/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from main import main

PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_INSTANCE = os.environ['BIGTABLE_INSTANCE']
TABLE_NAME_FORMAT = 'hello-world-hb-test-{}'
TABLE_NAME_RANGE = 10000
Expand Down
3 changes: 1 addition & 2 deletions samples/hello_happybase/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
3 changes: 1 addition & 2 deletions samples/instanceadmin/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
2 changes: 1 addition & 1 deletion samples/metricscaler/metricscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from google.cloud.bigtable import enums
from google.cloud.monitoring_v3 import query

PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']


def get_cpu_load():
Expand Down
4 changes: 3 additions & 1 deletion samples/metricscaler/metricscaler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
from google.cloud import bigtable
from google.cloud.bigtable import enums
from mock import patch

import pytest

from metricscaler import get_cpu_load
from metricscaler import get_storage_utilization
from metricscaler import main
from metricscaler import scale_bigtable

PROJECT = os.environ['GCLOUD_PROJECT']

PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_ZONE = os.environ['BIGTABLE_ZONE']
SIZE_CHANGE_STEP = 3
INSTANCE_ID_FORMAT = 'metric-scale-test-{}'
Expand Down
3 changes: 1 addition & 2 deletions samples/metricscaler/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
2 changes: 1 addition & 1 deletion samples/quickstart/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from main import main


PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_INSTANCE = os.environ['BIGTABLE_INSTANCE']
TABLE_ID_FORMAT = 'quickstart-test-{}'
TABLE_ID_RANGE = 10000
Expand Down
3 changes: 1 addition & 2 deletions samples/quickstart/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
2 changes: 1 addition & 1 deletion samples/quickstart_happybase/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from main import main


PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_INSTANCE = os.environ['BIGTABLE_INSTANCE']
TABLE_ID_FORMAT = 'quickstart-hb-test-{}'
TABLE_ID_RANGE = 10000
Expand Down
3 changes: 1 addition & 2 deletions samples/quickstart_happybase/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
80 changes: 5 additions & 75 deletions samples/snippets/filters/filter_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START bigtable_filters_limit_timestamp_range]
# [START bigtable_filters_print]
import datetime

# [END bigtable_filters_limit_timestamp_range]

# [START bigtable_filters_limit_row_sample]
# [START bigtable_filters_limit_row_regex]
# [START bigtable_filters_limit_cells_per_col]
# [START bigtable_filters_limit_cells_per_row]
# [START bigtable_filters_limit_cells_per_row_offset]
# [START bigtable_filters_limit_col_family_regex]
# [START bigtable_filters_limit_col_qualifier_regex]
# [START bigtable_filters_limit_col_range]
# [START bigtable_filters_limit_value_range]
# [START bigtable_filters_limit_value_regex]
# [START bigtable_filters_limit_timestamp_range]
# [START bigtable_filters_limit_block_all]
# [START bigtable_filters_limit_pass_all]
# [START bigtable_filters_modify_strip_value]
# [START bigtable_filters_modify_apply_label]
# [START bigtable_filters_composing_chain]
# [START bigtable_filters_composing_interleave]
# [START bigtable_filters_composing_condition]
from google.cloud import bigtable
import google.cloud.bigtable.row_filters as row_filters

# [END bigtable_filters_limit_row_sample]
# [END bigtable_filters_limit_row_regex]
# [END bigtable_filters_limit_cells_per_col]
# [END bigtable_filters_limit_cells_per_row]
# [END bigtable_filters_limit_cells_per_row_offset]
# [END bigtable_filters_limit_col_family_regex]
# [END bigtable_filters_limit_col_qualifier_regex]
# [END bigtable_filters_limit_col_range]
# [END bigtable_filters_limit_value_range]
# [END bigtable_filters_limit_value_regex]
# [END bigtable_filters_limit_timestamp_range]
# [END bigtable_filters_limit_block_all]
# [END bigtable_filters_limit_pass_all]
# [END bigtable_filters_modify_strip_value]
# [END bigtable_filters_modify_apply_label]
# [END bigtable_filters_composing_chain]
# [END bigtable_filters_composing_interleave]
# [END bigtable_filters_composing_condition]
# Write your code here.
# [START_EXCLUDE]


# [START bigtable_filters_limit_row_sample]
Expand Down Expand Up @@ -307,26 +271,9 @@ def filter_composing_condition(project_id, instance_id, table_id):


# [END bigtable_filters_composing_condition]
# [END_EXCLUDE]


# [START bigtable_filters_limit_row_sample]
# [START bigtable_filters_limit_row_regex]
# [START bigtable_filters_limit_cells_per_col]
# [START bigtable_filters_limit_cells_per_row]
# [START bigtable_filters_limit_cells_per_row_offset]
# [START bigtable_filters_limit_col_family_regex]
# [START bigtable_filters_limit_col_qualifier_regex]
# [START bigtable_filters_limit_col_range]
# [START bigtable_filters_limit_value_range]
# [START bigtable_filters_limit_value_regex]
# [START bigtable_filters_limit_timestamp_range]
# [START bigtable_filters_limit_block_all]
# [START bigtable_filters_limit_pass_all]
# [START bigtable_filters_modify_strip_value]
# [START bigtable_filters_modify_apply_label]
# [START bigtable_filters_composing_chain]
# [START bigtable_filters_composing_interleave]
# [START bigtable_filters_composing_condition]
def print_row(row):
print("Reading data for {}:".format(row.row_key.decode('utf-8')))
for cf, cols in sorted(row.cells.items()):
Expand All @@ -340,21 +287,4 @@ def print_row(row):
cell.value.decode('utf-8'),
cell.timestamp, labels))
print("")
# [END bigtable_filters_limit_row_sample]
# [END bigtable_filters_limit_row_regex]
# [END bigtable_filters_limit_cells_per_col]
# [END bigtable_filters_limit_cells_per_row]
# [END bigtable_filters_limit_cells_per_row_offset]
# [END bigtable_filters_limit_col_family_regex]
# [END bigtable_filters_limit_col_qualifier_regex]
# [END bigtable_filters_limit_col_range]
# [END bigtable_filters_limit_value_range]
# [END bigtable_filters_limit_value_regex]
# [END bigtable_filters_limit_timestamp_range]
# [END bigtable_filters_limit_block_all]
# [END bigtable_filters_limit_pass_all]
# [END bigtable_filters_modify_strip_value]
# [END bigtable_filters_modify_apply_label]
# [END bigtable_filters_composing_chain]
# [END bigtable_filters_composing_interleave]
# [END bigtable_filters_composing_condition]
# [END bigtable_filters_print]
2 changes: 1 addition & 1 deletion samples/snippets/filters/filters_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import filter_snippets


PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_INSTANCE = os.environ['BIGTABLE_INSTANCE']
TABLE_ID_PREFIX = 'mobile-time-series-{}'

Expand Down
3 changes: 1 addition & 2 deletions samples/snippets/filters/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
3 changes: 1 addition & 2 deletions samples/snippets/reads/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
'gcloud_project_env': 'GCLOUD_PROJECT',
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
Expand Down Expand Up @@ -72,7 +72,6 @@ def get_pytest_env_vars():
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
ret['GCLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG['envs'])
Expand Down
50 changes: 5 additions & 45 deletions samples/snippets/reads/read_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START bigtable_reads_row]
# [START bigtable_reads_row_partial]
# [START bigtable_reads_rows]
# [START bigtable_reads_row_range]
# [START bigtable_reads_row_ranges]
# [START bigtable_reads_prefix]
# [START bigtable_reads_filter]
# [START bigtable_reads_print]
from google.cloud import bigtable

# [END bigtable_reads_row]
# [END bigtable_reads_row_partial]
# [END bigtable_reads_rows]
# [END bigtable_reads_row_range]
# [END bigtable_reads_row_ranges]
# [END bigtable_reads_prefix]
# [END bigtable_reads_filter]

# [START bigtable_reads_row_partial]
# [START bigtable_reads_filter]
import google.cloud.bigtable.row_filters as row_filters
# [END bigtable_reads_row_partial]
# [END bigtable_reads_filter]


# [START bigtable_reads_rows]
# [START bigtable_reads_row_range]
# [START bigtable_reads_row_ranges]
# [START bigtable_reads_prefix]
from google.cloud.bigtable.row_set import RowSet


# [END bigtable_reads_rows]
# [END bigtable_reads_row_range]
# [END bigtable_reads_row_ranges]
# [END bigtable_reads_prefix]
# Write your code here.
# [START_EXCLUDE]


# [START bigtable_reads_row]
Expand Down Expand Up @@ -161,15 +133,9 @@ def read_filter(project_id, instance_id, table_id):


# [END bigtable_reads_filter]
# [END_EXCLUDE]


# [START bigtable_reads_row]
# [START bigtable_reads_row_partial]
# [START bigtable_reads_rows]
# [START bigtable_reads_row_range]
# [START bigtable_reads_row_ranges]
# [START bigtable_reads_prefix]
# [START bigtable_reads_filter]
def print_row(row):
print("Reading data for {}:".format(row.row_key.decode('utf-8')))
for cf, cols in sorted(row.cells.items()):
Expand All @@ -183,10 +149,4 @@ def print_row(row):
cell.value.decode('utf-8'),
cell.timestamp, labels))
print("")
# [END bigtable_reads_row]
# [END bigtable_reads_row_partial]
# [END bigtable_reads_rows]
# [END bigtable_reads_row_range]
# [END bigtable_reads_row_ranges]
# [END bigtable_reads_prefix]
# [END bigtable_reads_filter]
# [END bigtable_reads_print]
2 changes: 1 addition & 1 deletion samples/snippets/reads/reads_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import read_snippets


PROJECT = os.environ['GCLOUD_PROJECT']
PROJECT = os.environ['GOOGLE_CLOUD_PROJECT']
BIGTABLE_INSTANCE = os.environ['BIGTABLE_INSTANCE']
TABLE_ID_PREFIX = 'mobile-time-series-{}'

Expand Down
Loading