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

Conversation

@waltaskew
Copy link
Contributor

@waltaskew waltaskew commented Jul 18, 2025

  • Enable the use_insertmanyvalues flag on the dialect to support SQLAlchemy 2.0's insertmany feature, which allows multiple ORM objects to be inserted together in bulk, even if the table has server-side generated values which must be included in a THEN RETURN clause
  • Provide an example for using the feature with client-side supplied UUIDs and insert_sentinel columns.
  • Ensure that the feature is not enabled for bit-reversed primary keys. In other dialects, an incrementing primary key can be used rather than a sentinel column. In Spanner, the bit-reversed integers do not meet the ordering requirement to be used as implicit sentinels

https://docs.sqlalchemy.org/en/20/core/internals.html#sqlalchemy.engine.default.DefaultDialect.use_insertmanyvalues

https://docs.sqlalchemy.org/en/20/core/connections.html#insert-many-values-behavior-for-insert-statements

https://docs.sqlalchemy.org/en/20/core/connections.html#configuring-sentinel-columns

Fixes: #720

- Enable the use_insertmanyvalues flag on the dialect to support
  SQLAlchemy 2.0's insertmany feature, which allows multiple ORM
  objects to be inserted together in bulk, even if the table has
  server-side generated values which must be included in a THEN RETURN
  clause
- Provide an example for using the feature with client-side supplied
  UUIDs and insert_sentinel columns.
- Ensure that the feature is not enables for bit-reversed primary
  keys. In other dialects, an incrementing primary key can be used
  rather than a sentinel column. In Spanner, the bit-reversed integers
  do not meet the ordering requirement to be used as implicit
  sentinels

https://docs.sqlalchemy.org/en/20/core/internals.html#sqlalchemy.engine.default.DefaultDialect.use_insertmanyvalues

https://docs.sqlalchemy.org/en/20/core/connections.html#insert-many-values-behavior-for-insert-statements

https://docs.sqlalchemy.org/en/20/core/connections.html#configuring-sentinel-columns

Fixes: googleapis#720
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API. label Jul 18, 2025
@olavloite olavloite requested a review from bhatt4982 August 18, 2025 10:57
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2025
@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2025
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 18, 2025
Copy link
Contributor

@bhatt4982 bhatt4982 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM...

@bhatt4982 bhatt4982 merged commit 1fe9f4b into googleapis:main Aug 18, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add insertmany Support

4 participants

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