If you try to commit an UPDATE (and DELETE) clause for an existing row, you will get an error.
This issue(#121) may be relevant.
A minimal example is shown below.
/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py:1237: UserWarning: The `rowcount` property is non-operational. Request resulting rows are streamed by the `fetch*()` methods and can't be counted before they are all streamed.
return self.cursor.rowcount
Traceback (most recent call last):
File "/[current_dir]/./run.py", line 55, in <module>
session.commit()
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1046, in commit
self.transaction.commit()
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 504, in commit
self._prepare_impl()
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 483, in _prepare_impl
self.session.flush()
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2540, in flush
self._flush(objects)
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2682, in _flush
transaction.rollback(_capture_exception=True)
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2642, in _flush
flush_context.execute()
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
rec.execute(self)
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute
persistence.save_obj(
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 230, in save_obj
_emit_update_statements(
File "/[current_dir]/.venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 998, in _emit_update_statements
rows += c.rowcount
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'
If you try to commit an UPDATE (and DELETE) clause for an existing row, you will get an error.
This issue(#121) may be relevant.
A minimal example is shown below.
Environment details
Steps to reproduce
init.sh, create virtualenv using pipenv.$ pipenv shellto enter virtualenv.$ cp .env.example .envand$ vi .envto add environment variables such as project ID, spanner instance ID, database ID, and credential json file path.You need to create a Spanner instance beforehand and then create a database using Google standard SQL.
$ ./run.py.The first time you run it, it will only perform INSERT, so no error will occur.
$ ./run.pyagain.An error occurs in session.commit to existing row (because rowcount is not implemented).
cf. Error log when running run.py for the second time in my environment