Skip to content

feat: enable per source level flags for sql commenter#3387

Closed
AjmeraParth132 wants to merge 2 commits into
googleapis:mainfrom
AjmeraParth132:feat/sql-commenter-flags
Closed

feat: enable per source level flags for sql commenter#3387
AjmeraParth132 wants to merge 2 commits into
googleapis:mainfrom
AjmeraParth132:feat/sql-commenter-flags

Conversation

@AjmeraParth132

Copy link
Copy Markdown
Contributor

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-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.

Also, as discussed with @anubhav756, we are removing SQLCommenter support in MSSQL and cloud MSSQL, and adding its support to SQLite

PR Checklist

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #3061

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 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.

@anubhav756 anubhav756 force-pushed the feat/sql-commenter-flags branch from 6b5d621 to 26a4826 Compare June 16, 2026 14:03
@anubhav756

Copy link
Copy Markdown
Contributor

/gcbrun

@anubhav756 anubhav756 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: This function actually prepends, so maybe rename?

@anubhav756 anubhav756 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Method name change and test coverage as requested in the comments.

@anubhav756 anubhav756 force-pushed the feat/sql-commenter-flags branch from 26a4826 to 46094a6 Compare June 17, 2026 08:12
@anubhav756

Copy link
Copy Markdown
Contributor

/gcbrun

@anubhav756 anubhav756 assigned anubhav756 and unassigned duwenxin99 Jun 17, 2026
@anubhav756 anubhav756 added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Jun 17, 2026
@anubhav756

Copy link
Copy Markdown
Contributor

Closing this PR in favour of #3465

@anubhav756 anubhav756 closed this Jun 17, 2026
averikitsch pushed a commit that referenced this pull request Jun 17, 2026
## 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]>
anubhav756 added a commit that referenced this pull request Jun 18, 2026
## 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]>
github-actions Bot pushed a commit that referenced this pull request Jun 18, 2026
## 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
github-actions Bot pushed a commit to renovate-bot/googleapis-_-genai-toolbox that referenced this pull request Jun 18, 2026
…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
github-actions Bot pushed a commit to rodineyw/mcp-toolbox that referenced this pull request Jun 18, 2026
…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
github-actions Bot pushed a commit to Jaleel-zhu/genai-toolbox that referenced this pull request Jun 18, 2026
…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
github-actions Bot pushed a commit to pepe57/genai-toolbox that referenced this pull request Jun 18, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SQL Commenter to Extend Telemetry for cloudSQL databases

3 participants