Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Transaction aborted while reading table #301

Copy link
Copy link
Open
@Joselguti

Description

@Joselguti
Issue body actions

Hello,

I am trying to read data from a spanner table that currently has 134.964 rows and 288 columns.

I have been using the example posted in the Github under "Read" and modying the query to read less rows between each cycle.

The first issue is that it takes a good couple minutes (Probably 3+ to execute said transactions) and the second is that they keep failing.

Here is the error:

Traceback (most recent call last):
  File "D:\bupryhr_dev\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 72, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "D:\bupryhr_dev\venv\lib\site-packages\grpc\_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "D:\bupryhr_dev\venv\lib\site-packages\grpc\_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.ABORTED
	details = "Transaction was aborted."
	debug_error_string = "{"created":"@1673589122.237000000","description":"Error received from peer ipv4:142.250.219.234:443","file":"src/core/lib/surface/call.cc","file_line":904,"grpc_message":"Transaction was aborted.","grpc_status":10}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 391, in commit
    self._transaction.commit()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_v1\transaction.py", line 199, in commit
    response = api.commit(
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_v1\services\spanner\client.py", line 1789, in commit
    response = rpc(
  File "D:\bupryhr_dev\venv\lib\site-packages\google\api_core\gapic_v1\method.py", line 113, in __call__
    return wrapped_func(*args, **kwargs)
  File "D:\bupryhr_dev\venv\lib\site-packages\google\api_core\retry.py", line 349, in retry_wrapped_func
    return retry_target(
  File "D:\bupryhr_dev\venv\lib\site-packages\google\api_core\retry.py", line 191, in retry_target
    return target()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 74, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.Aborted: 409 Transaction was aborted. [retry_delay {
  nanos: 10853187
}
]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1089, in _commit_impl
    self.engine.dialect.do_commit(self.connection)
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\sqlalchemy_spanner\sqlalchemy_spanner.py", line 990, in do_commit
    dbapi_connection.commit()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 396, in commit
    self.retry_transaction()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 277, in retry_transaction
    self._rerun_previous_statements()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 324, in _rerun_previous_statements
    _compare_checksums(statement.checksum, retried_checksum)
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\checksum.py", line 78, in _compare_checksums
    raise RetryAborted(
google.cloud.spanner_dbapi.exceptions.RetryAborted: The transaction was aborted and could not be retried due to a concurrent modification.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "D:\bupryhr_dev\venv\lib\site-packages\IPython\core\interactiveshell.py", line 3251, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-220-dacab1707a8a>", line 3, in <module>
    loaded_data = connection2.execute(table.select().limit(100000).offset(data_offset)).fetchall()
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 3100, in __exit__
    self.transaction.__exit__(type_, value, traceback)
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\util.py", line 237, in __exit__
    self.rollback()
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\util\compat.py", line 211, in raise_
    raise exception
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\util.py", line 233, in __exit__
    self.commit()
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2459, in commit
    self._do_commit()
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2649, in _do_commit
    self._connection_commit_impl()
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2620, in _connection_commit_impl
    self.connection._commit_impl()
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1091, in _commit_impl
    self._handle_dbapi_exception(e, None, None, None, None)
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2124, in _handle_dbapi_exception
    util.raise_(
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\util\compat.py", line 211, in raise_
    raise exception
  File "D:\bupryhr_dev\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1089, in _commit_impl
    self.engine.dialect.do_commit(self.connection)
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\sqlalchemy_spanner\sqlalchemy_spanner.py", line 990, in do_commit
    dbapi_connection.commit()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 396, in commit
    self.retry_transaction()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 277, in retry_transaction
    self._rerun_previous_statements()
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\connection.py", line 324, in _rerun_previous_statements
    _compare_checksums(statement.checksum, retried_checksum)
  File "D:\bupryhr_dev\venv\lib\site-packages\google\cloud\spanner_dbapi\checksum.py", line 78, in _compare_checksums
    raise RetryAborted(
sqlalchemy.exc.OperationalError: (google.cloud.spanner_dbapi.exceptions.RetryAborted) The transaction was aborted and could not be retried due to a concurrent modification.
(Background on this error at: https://sqlalche.me/e/14/e3q8)

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.Issues related to the googleapis/python-spanner-sqlalchemy API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.