Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigTable: single-row transactions are unsupported #10018

Closed
mackenziestarr opened this issue Dec 26, 2019 · 1 comment · Fixed by #10021
Closed

BigTable: single-row transactions are unsupported #10018

mackenziestarr opened this issue Dec 26, 2019 · 1 comment · Fixed by #10021
Assignees
Labels
api: bigtable Issues related to the Bigtable API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@mackenziestarr
Copy link
Contributor

mackenziestarr commented Dec 26, 2019

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: [email protected]
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
mackenziestarr added a commit to mackenziestarr/google-cloud-python that referenced this issue Dec 26, 2019
mackenziestarr added a commit to mackenziestarr/google-cloud-python that referenced this issue Dec 26, 2019
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 27, 2019
@IlyaFaer IlyaFaer added api: bigtable Issues related to the Bigtable API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Dec 27, 2019
@IlyaFaer IlyaFaer changed the title Single-row transactions are unsupported BigTable: single-row transactions are unsupported Dec 27, 2019
crwilcox pushed a commit that referenced this issue Jan 3, 2020
* fix: add ability to use single-row transactions

fixes #10018

* fix: add unit tests for supporting single-row transactions
@crwilcox
Copy link
Contributor

crwilcox commented Jan 3, 2020

FYI: This is published as https://pypi.org/project/google-cloud-bigtable/1.2.1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants