Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
This repository was archived by the owner on May 14, 2026. It is now read-only.

Returning data from modified rows #332

Description

@caiopizzol

Environment details

  • Programming language: python
  • OS: 13.4 (22F66)
  • Language runtime version: 3.11
  • Package version:
    sqlalchemy-spanner==1.6.1
    SQLAlchemy==2.0.15

Steps to reproduce

  1. Create an update/insert statement
update_stmt= (
update(DBModel)
.values(
**db_record.dict(exclude_none=True)
)
.where(
DBModel.number==db_record.number
)
.returning(DBModel.unique_id)
)
  1. Generated SQL statement
UPDATE
db_table
SETdb_col.value= :db_schema_col_value
WHEREdb_table.number= :db_schema_col_number
RETURNING
db_table.unique_id
  1. Expected GoogleSQL statement
    ref: https://cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax#insert-and-then-return
UPDATE
db_table
SETdb_col.value= :db_schema_col_value
WHEREdb_table.number= :db_schema_col_number
THEN RETURN
db_table.unique_id

Metadata

Metadata

Assignees

No one assigned

    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