Skip to content

BigTable: single-row transactions are unsupported #10018

@mackenziestarr

Description

@mackenziestarr

Environment details

  1. Specify the API at the beginning of the title (for example, "BigQuery: ...")
    General, Core, and Other are also allowed as types

Bigtable

  1. OS type and version

Linux Red Hat 4.8.5

  1. Python version and virtual environment information: python --version

Python 2.7.5

  1. google-cloud- version: pip show google-<service> or pip freeze
(venv) -bash-4.2$ pip show google google-cloud-bigtable
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Package(s) not found: google
Name: google-cloud-bigtable
Version: 1.2.0
Summary: Google Cloud Bigtable API client library
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /home/mstarr
Requires: google-cloud-core, grpc-google-iam-v1, google-api-core
Required-by:

Steps to reproduce

Customize the code example to execute against a Bigtable instance configured with an application profile that has "Allow single-row transactions" enabled.

Code example

#!/usr/bin/env python

from google.cloud.bigtable.client import Client
from google.cloud.bigtable.row import ConditionalRow
from google.cloud.bigtable.row_filters import PassAllFilter

PROJECT_ID="<PROJECT_ID>"
INSTANCE_ID="<INSTANCE_ID>"
TABLE_ID="<TABLE_ID>"
APP_PROFILE_ID="<APP_PROFILE_ID>"

client = Client(project=PROJECT_ID)
instance = client.instance(instance_id=INSTANCE_ID)
table = instance.table(table_id=TABLE_ID, app_profile_id=APP_PROFILE_ID)

# throws google.api_core.exceptions.FailedPrecondition: 400 Single-row transactions are not allowed by this app profile
row_cond = ConditionalRow(b'test_row', table, PassAllFilter(True))
row_cond.set_cell('test_column_family', 'test_column_qualifier', 'test_cell_value', timestamp=None, state=False)
row_cond.commit()

Stack trace

(venv) -bash-4.2$ python test-app-profile.py
/home/mstarr/google-case-21627768/venv/lib/python2.7/site-packages/google/auth/_default.py:69: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Traceback (most recent call last):
  File "test-app-profile.py", line 19, in <module>
    row_cond.commit()
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/cloud/bigtable/row.py", line 586, in commit
    false_mutations=false_mutations,
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/cloud/bigtable_v2/gapic/bigtable_client.py", line 670, in check_and_mutate_row
    request, retry=retry, timeout=timeout, metadata=metadata
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
    return wrapped_func(*args, **kwargs)
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
    on_error=on_error,
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/api_core/retry.py", line 184, in retry_target
    return target()
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/home/mstarr/venv/lib/python2.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "/home/mstarr/venv/lib/python2.7/site-packages/six.py", line 740, in raise_from
    raise value
google.api_core.exceptions.FailedPrecondition: 400 Single-row transactions are not allowed by this app profile

Notes

Browsing the latest release bigtable-1.2.0, it seems that the issue stems from app_profile_id not being passed through to the gapic client on commit()

  • ConditionalRow doesn't pass app_profile_id on commit() link
  • AppendRow doesn't pass app_profile_id on commit() link

Metadata

Metadata

Assignees

Labels

api: bigtableIssues related to the Bigtable API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions