Skip to content

ResultProxy.rowcount returns -1 regardless of modified rows #121

Closed
@aderk

Description

https://docs.sqlalchemy.org/en/13/core/connections.html#sqlalchemy.engine.ResultProxy.rowcount

Environment details

  • Programming language: Python 3.9
  • OS: Debian
  • Language runtime version:
  • Package version:

Steps to reproduce

from sqlalchemy import Column, MetaData, Table, Text, create_engine

project_id = 'foo'
instance_id = 'bar'
database = 'baz'

spanner_uri = f'spanner:///projects/{project_id}/instances/{instance_id}/databases/{database}'

# Create a table with one `Text`-type column
engine = create_engine(spanner_uri)
metadata = MetaData(bind=engine)
t = Table("TestTable", metadata, Column("test_column", Text, nullable=False))
metadata.create_all(engine)

test_value = 'foo1'

with engine.begin() as conn:
    #conn.execute(t.insert(None).values(test_column=test_value))
    res = conn.execute(t.update(None).where(t.c.test_column == test_value).values(test_column='bar2'))

assert res.rowcount == 1, f"Incorrect rowcount. want 1, got {res.rowcount}"

Actual vs Expected Behavior

res.rowcount returns -1, but should return 1.

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/python-spanner-sqlalchemy API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions