Skip to content

[PECO-AI] PECOBLR-1968: Add warnings in logs if someone uses a connection param that is not defined in python sql connector#743

Open
deeksha-db wants to merge 1 commit intomainfrom
peco-ai-PECOBLR-1968-1
Open

[PECO-AI] PECOBLR-1968: Add warnings in logs if someone uses a connection param that is not defined in python sql connector#743
deeksha-db wants to merge 1 commit intomainfrom
peco-ai-PECOBLR-1968-1

Conversation

@deeksha-db
Copy link

PECO Agent Workflow (Partner Ecosystem)

Jira Ticket: https://databricks.atlassian.net/browse/PECOBLR-1968

Changes

Added a KNOWN_KWARGS frozenset constant to client.py listing all supported **kwargs for Connection.__init__. In the constructor, right after the debug log, the code computes set(kwargs.keys()) - KNOWN_KWARGS and emits a logger.warning naming any unrecognized parameter(s). This is a purely additive, backward-compatible change — unknown kwargs continue to be passed through; they just now generate a visible warning.

Test Cases Written

  • test_unknown_connection_param_issues_warning — unknown kwarg triggers logger.warning
  • test_unknown_connection_param_warning_names_the_param — warning message includes the param name
  • `test_known_connection_pa...

Summary: Added a KNOWN_KWARGS frozenset constant to client.py listing all supported **kwargs for Connection.__init__. In the constructor, right after the debug log, the code computes set(kwargs.keys()) - KNOWN_KWARGS and emits a logger.warning naming any unrecognized parameter(s). This is a purely additive, backward-compatible change — unknown kwargs continue to be passed through; they just now generate a visible warning.

@github-actions
Copy link

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

TRANSACTION_ISOLATION_LEVEL_REPEATABLE_READ = "REPEATABLE_READ"

# All supported **kwargs for Connection.__init__. Used to warn on unknown params.
KNOWN_KWARGS = frozenset(
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add a test test_known_kwargs_is_complete

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.

3 participants