-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(cockroachdb): add CockroachDB integration with cockroach-go #2006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(cockroachdb): add CockroachDB integration with cockroach-go #2006
Conversation
Summary of ChangesHello @viragtripathi, 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 significantly expands the toolbox's capabilities by introducing a robust integration with CockroachDB. It provides a reliable mechanism for interacting with CockroachDB instances, including automatic transaction retries for enhanced fault tolerance. Developers can now leverage a set of specialized tools to execute SQL, query schema and table metadata, streamlining database operations within the ecosystem. The changes also ensure that the new integration adheres to CockroachDB best practices and is thoroughly tested through both unit and integration tests, with updated CI to reflect these additions. Highlights
Using Gemini Code AssistThe 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
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 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces CockroachDB integration, including a new source and four tools. The implementation correctly uses the cockroach-go/v2 library for its core retry logic in the source. However, a critical oversight is that none of the new tools actually use this retry mechanism, instead interacting with the connection pool directly. This undermines a key benefit of the integration. Additionally, there's a bug in how connection string query parameters are constructed, which could fail with special characters. I've also noted some inconsistencies in result formatting and error handling compared to existing tools. The integration and unit tests are a good start but could be expanded to cover these tools more directly.
internal/tools/cockroachdb/cockroachdbexecutesql/cockroachdbexecutesql.go
Outdated
Show resolved
Hide resolved
internal/tools/cockroachdb/cockroachdblistschemas/cockroachdblistschemas.go
Outdated
Show resolved
Hide resolved
internal/tools/cockroachdb/cockroachdblisttables/cockroachdblisttables.go
Outdated
Show resolved
Hide resolved
internal/tools/cockroachdb/cockroachdbexecutesql/cockroachdbexecutesql.go
Outdated
Show resolved
Hide resolved
Add complete CockroachDB v25.4.0+ integration using official cockroach-go/v2 library for automatic transaction retry. - Add source with Query() for read operations - Implement 4 tools: execute-sql, sql, list-tables, list-schemas - Use UUID primary keys (CockroachDB best practice) - Add comprehensive unit and integration tests (18 tests) - Add complete documentation for source and all tools - Update Cloud Build configuration for CI Tested on CockroachDB v25.4.0 multi-region cluster. Fixes googleapis#2005
c90de3d to
ea146d7
Compare
Add support for CockroachDB v25.4.0+ using the official cockroach-go/v2 library for automatic transaction retry.
Fixes #2005
Description
PR Checklist
CONTRIBUTING.md
bug/issue
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
!if this involve a breaking change🛠️ Fixes #<issue_number_goes_here>