feat: enable per source level flags for sql commenter#3387
feat: enable per source level flags for sql commenter#3387AjmeraParth132 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a per-source sqlCommenter configuration option across multiple database sources (AlloyDB, Cloud SQL MySQL, Cloud SQL Postgres, MySQL, Postgres, and SQLite), allowing users to override the global --sql-commenter flag. The sqlcommenter.AppendComment function was updated to accept this override, and corresponding unit tests were added to verify the priority of the per-source setting over the global flag. Additionally, SQL commenter support was removed from MSSQL sources, and documentation was updated to reflect the new configuration option. No review comments were provided, so there is no feedback to address.
6b5d621 to
26a4826
Compare
|
/gcbrun |
anubhav756
left a comment
There was a problem hiding this comment.
Also, it would be great to have integration tests for SQLite.
|
|
||
| func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (any, error) { | ||
| statement = sqlcommenter.AppendComment(ctx, statement, SourceType) | ||
| statement = sqlcommenter.AppendComment(ctx, statement, SourceType, s.SQLCommenter) |
There was a problem hiding this comment.
nit: This function actually prepends, so maybe rename?
anubhav756
left a comment
There was a problem hiding this comment.
Method name change and test coverage as requested in the comments.
26a4826 to
46094a6
Compare
|
/gcbrun |
|
Closing this PR in favour of #3465 |
## Description Documentation update for added SQLCommenter support, and `telemetry_attributes` exposure for client SDKs > [!NOTE] > This PR supercedes the previous PR #3281 to update that with the latest changes from #3387. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #3061 --------- Co-authored-by: Parth Ajmera <[email protected]>
## Description > [!NOTE] > This PR builds upon #3387 by patching a function name [issue](#3387 (comment)). A separate, follow-up PR will be created to add unit and integration tests for SQLCommenter. As an extension to SQLCommenter functionality, we are introducing a new configuration flag, `sqlCommenter`, that can be specified per source in tools.yaml to enable SQL commenting at the source level. This source-specific flag takes precedence over the global `--sql-commenter` flag when configured. If `sqlCommenter` is not explicitly set for a source, the global `--sql-commenter` flag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users. > [!IMPORTANT] > We are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #3061 --------- Co-authored-by: Parth Ajmera <[email protected]>
## Description > [!NOTE] > This PR builds upon #3387 by patching a function name [issue](#3387 (comment)). A separate, follow-up PR will be created to add unit and integration tests for SQLCommenter. As an extension to SQLCommenter functionality, we are introducing a new configuration flag, `sqlCommenter`, that can be specified per source in tools.yaml to enable SQL commenting at the source level. This source-specific flag takes precedence over the global `--sql-commenter` flag when configured. If `sqlCommenter` is not explicitly set for a source, the global `--sql-commenter` flag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users. > [!IMPORTANT] > We are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #3061 --------- Co-authored-by: Parth Ajmera <[email protected]> ecce6b7
…apis#3465) ## Description > [!NOTE] > This PR builds upon googleapis#3387 by patching a function name [issue](googleapis#3387 (comment)). A separate, follow-up PR will be created to add unit and integration tests for SQLCommenter. As an extension to SQLCommenter functionality, we are introducing a new configuration flag, `sqlCommenter`, that can be specified per source in tools.yaml to enable SQL commenting at the source level. This source-specific flag takes precedence over the global `--sql-commenter` flag when configured. If `sqlCommenter` is not explicitly set for a source, the global `--sql-commenter` flag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users. > [!IMPORTANT] > We are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes googleapis#3061 --------- Co-authored-by: Parth Ajmera <[email protected]> ecce6b7
…apis#3465) ## Description > [!NOTE] > This PR builds upon googleapis#3387 by patching a function name [issue](googleapis#3387 (comment)). A separate, follow-up PR will be created to add unit and integration tests for SQLCommenter. As an extension to SQLCommenter functionality, we are introducing a new configuration flag, `sqlCommenter`, that can be specified per source in tools.yaml to enable SQL commenting at the source level. This source-specific flag takes precedence over the global `--sql-commenter` flag when configured. If `sqlCommenter` is not explicitly set for a source, the global `--sql-commenter` flag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users. > [!IMPORTANT] > We are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes googleapis#3061 --------- Co-authored-by: Parth Ajmera <[email protected]> ecce6b7
…apis#3465) ## Description > [!NOTE] > This PR builds upon googleapis#3387 by patching a function name [issue](googleapis#3387 (comment)). A separate, follow-up PR will be created to add unit and integration tests for SQLCommenter. As an extension to SQLCommenter functionality, we are introducing a new configuration flag, `sqlCommenter`, that can be specified per source in tools.yaml to enable SQL commenting at the source level. This source-specific flag takes precedence over the global `--sql-commenter` flag when configured. If `sqlCommenter` is not explicitly set for a source, the global `--sql-commenter` flag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users. > [!IMPORTANT] > We are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes googleapis#3061 --------- Co-authored-by: Parth Ajmera <[email protected]> ecce6b7
…apis#3465) ## Description > [!NOTE] > This PR builds upon googleapis#3387 by patching a function name [issue](googleapis#3387 (comment)). A separate, follow-up PR will be created to add unit and integration tests for SQLCommenter. As an extension to SQLCommenter functionality, we are introducing a new configuration flag, `sqlCommenter`, that can be specified per source in tools.yaml to enable SQL commenting at the source level. This source-specific flag takes precedence over the global `--sql-commenter` flag when configured. If `sqlCommenter` is not explicitly set for a source, the global `--sql-commenter` flag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users. > [!IMPORTANT] > We are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes googleapis#3061 --------- Co-authored-by: Parth Ajmera <[email protected]> ecce6b7
Description
As an extension to SQLCommenter functionality, we are introducing a new configuration flag,
sqlCommenter, that can be specified per source in tools.yaml to enable SQL commenting at the source level.This source-specific flag takes precedence over the global
--sql-commenterflag when configured. IfsqlCommenteris not explicitly set for a source, the global--sql-commenterflag will continue to determine the behavior. This ensures backward compatibility and avoids any breaking changes for existing users.Also, as discussed with @anubhav756, we are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite
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 #3061