Skip to content

chore(migration): Migrate code from googleapis/python-spanner into packages/google-cloud-spanner#16142

Draft
chalmerlowe wants to merge 1070 commits intomainfrom
migration.python-spanner.migration.2026-03-23_14-19-20.migrate
Draft

chore(migration): Migrate code from googleapis/python-spanner into packages/google-cloud-spanner#16142
chalmerlowe wants to merge 1070 commits intomainfrom
migration.python-spanner.migration.2026-03-23_14-19-20.migrate

Conversation

@chalmerlowe
Copy link
Contributor

See #10952.

This PR should be merged with a merge-commit, not a squash-commit, in order to preserve the git history.

renovate-bot and others added 30 commits December 2, 2023 14:48
Co-authored-by: Astha Mohta <35952883+asthamohta@users.noreply.github.com>
* feat: Batch Write API implementation and samples

* Update sample

* review comments

* return public class for mutation groups

* Update google/cloud/spanner_v1/batch.py

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>

* Update google/cloud/spanner_v1/batch.py

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>

* review comments

* remove doc

* feat(spanner): nit sample data refactoring

* review comments

* fix test

---------

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <sriharshach@google.com>
)

* fix: Refactoring tests to use fixtures properly

* Not using autouse fixtures for few tests where not needed

* feat: Implementation for Begin and Rollback clientside statements

* Incorporating comments

* Formatting

* Comments incorporated

* Fixing tests

* Small fix

* Test fix as emulator was going OOM
…lates/python_library/.kokoro (#1043)

Source-Link: googleapis/synthtool@9367caa
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2f155882785883336b4468d5218db737bb1d10c9cea7cb62219ad16fe248c03c

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* Implementation of client side statements that return

* Small fix

* Incorporated comments

* Added tests for exception in commit and rollback

* Fix in tests

* Skipping few tests from running in emulator

* Few fixes

* Refactoring

* Incorporated comments

* Incorporating comments
* feat: Implementation for batch dml in dbapi

* Few changes

* Incorporated comments
…hecks (#1062)

* chore: dummy commit

* chore: edit yaml

* chore: revert lint

* chore: remove python versions

* chore: reduce emulator version to 1.5.12

* chore: revert to latest
* test: unit test case fix

* feat(spanner): lint

---------

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <sriharshach@google.com>
* changes

* changes

* docs

* docs

* linting

* feat(spanner): remove client side validations for directed read options

* feat(spanner): update the auto_failover_disabled field

* feat(spanner): update unit tests

* feat(spanner): update test

* feat(spanner): update documentation

* feat(spanner): add system test to validate exception in case of RW transaction

* feat(spanner): update unit test

* feat(spanner): add dro for batchsnapshot and update system tests

* feat(spanner): fix unit tests for batchsnapshot

* feat(spanner): add unit tests for partition read and query

* feat(spanner): lint fixes

* feat(spanner): code refactor remove TransactionType

* feat(spanner): comment refactor

* feat(spanner): remove comments

---------

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <sriharshach@google.com>
* feat: Implementation for partitioned query in dbapi

* Comments incorporated and added more tests

* Small fix

* Test fix

* Removing ClientSideStatementParamKey enum

* Comments incorporated
…1071)

* fix: Fix for flaky test_read_timestamp_client_side_autocommit test

* Adding a row between 2 transactions so that read timestamp are different for the 2 transactions

---------

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@fac8444
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5ea6d0ab82c956b50962f91d94e206d3921537ae5fe1549ec5326381d8905cfa

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…dding interceptors support for testing (#1056)

* feat: Fixing and refactoring transaction retry logic in dbapi. Also adding interceptors support for testing

* Comments incorporated and changes for also storing Cursor object with the statements details added for retry

* Some refactoring of transaction_helper.py and maintaining state of rows update count for batch dml in cursor

* Small fix

* Maintaining a map from cursor to last statement added in transaction_helper.py

* Rolling back the transaction when Aborted exception is thrown from interceptor

* Small change

* Disabling a test for emulator run

* Reformatting
* feat(spanner): add proto and enum types

PiperOrigin-RevId: 599046867

Source-Link: googleapis/googleapis@64a5bfe

Source-Link: googleapis/googleapis-gen@6e96ab8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmU5NmFiOGJiMWVjNDUzNmM1YTBjNGQwOTVmNTNjZTA1NzhjYjhhNCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add max_commit_delay API

PiperOrigin-RevId: 599315735

Source-Link: googleapis/googleapis@465a103

Source-Link: googleapis/googleapis-gen@930e231
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwZTIzMThhY2JkMTBmYjU0ZDg2NjhkMmYyY2YxOWZlNDEzZDVhOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
* feat: Implementation of run partition query

* Comments incorporated

* Comments incorporated

* Comments incorporated
* feat(spanner): add proto descriptors for proto and enum types in create/update/get database ddl requests

PiperOrigin-RevId: 601013501

Source-Link: googleapis/googleapis@81b24a5

Source-Link: googleapis/googleapis-gen@46f0446
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZmMDQ0NjAzNzkwNmYwZDkwNTM2NTgzNWYwMmE2NTIyNDFmM2RlMyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add FLOAT32 enum to TypeCode

PiperOrigin-RevId: 601176446

Source-Link: googleapis/googleapis@584ecd4

Source-Link: googleapis/googleapis-gen@0bdb815
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGJkYjgxNTc3OWQwZmQ3ODI0YmFmZmYwYzkxMDQ2YTdkY2E1Y2Q1ZiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* fix: Few fixes in DBAPI 

* Small fix

* Test fix
…nstance APIs. (#1065)

* docs: samples and tests for auto-generated createDatabase and createInstance APIs.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix lint

* incorporate suggestions

* rename tests

* fix lint

* fix failures

* chore(spanner): fix formatting

* incorporate suggesitons

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <sriharshach@google.com>
Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
)

* feat(spanner): add SpannerAsyncClient import to spanner_v1 package

* feat(spanner): move to seperate line

* feat(spanner): fix lint
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
* proto generation

* max commit delay

* Fix some errors

* Unit tests

* regenerate proto changes

* Fix unit tests

* Finish test_transaction.py

* Finish test_batch.py

* Formatting

* Cleanup

* Fix merge conflict

* Add optional=True

* Remove optional=True, try calling HasField.

* Update HasField to be called on the protobuf.

* Update to timedelta.duration instead of an int.

* Cleanup

* Changes from Sri to pipe value to top-level funcitons and to add integration tests. Thanks Sri

* Run nox -s blacken

* feat(spanner): remove unused imports and add line

* feat(spanner): add empty line in python docs

* Update comment with valid values.

* Update comment with valid values.

* feat(spanner): fix lint

* feat(spanner): rever nox file changes

---------

Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <sriharshach@google.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request completes a significant migration of the Google Cloud Spanner Python client library, moving all existing components into a new, consolidated package structure. This foundational change streamlines development, enhances maintainability, and introduces advanced tooling for asynchronous/synchronous code compatibility and comprehensive testing. The update also brings improved documentation and new examples for observability features like OpenTelemetry tracing.

Highlights

  • Codebase Migration: The entire google-cloud-spanner client library has been migrated into the packages/google-cloud-spanner directory, establishing a new package structure.
  • CrossSync Tool Introduction: A new CrossSync tool has been introduced to facilitate sharing logic between asynchronous and synchronous Python code, including decorators for AST transformations and wrappers for common async/sync objects.
  • Development Environment Setup: New DevContainer configurations (Dockerfile, devcontainer.json, postCreate.sh, requirements.in/txt) have been added to standardize the development environment.
  • CI/CD and Testing Enhancements: Updated GitHub Actions workflows and Kokoro configurations have been added for comprehensive integration, mock server, and presubmit tests across various Python versions, along with specific configurations for samples and prerelease dependencies.
  • Documentation and Metadata Updates: New and updated documentation files, including CONTRIBUTING, README, SECURITY, UPGRADING guides, and detailed API usage for client, database, instance, table, batch, snapshot, and transaction operations, have been added. Repository metadata and pre-commit hooks are also included.
  • OpenTelemetry Tracing Examples: New example files demonstrate how to implement OpenTelemetry tracing with Cloud Trace and OTLP exporters, including gRPC instrumentation.
  • Benchmark Tools: New benchmark tools, including a gRPC Benchwrapper and a YCSB-like client, have been added for performance testing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.