Skip to content
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

handle case insensitive db name in schema collection #19384

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

lu-zhengda
Copy link
Contributor

@lu-zhengda lu-zhengda commented Jan 13, 2025

What does this PR do?

This PR fixes a KeyError bug in the SQL Server schema collection process. The issue occurred when the database name in sys.databases was uppercase in a case-insensitive collation, such as SQL_Latin1_General_CP1_CI_AS.

Motivation

https://datadoghq.atlassian.net/browse/DBMON-4901

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.91%. Comparing base (c32b251) to head (5e8c863).
Report is 7 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
presto ?
solr ?
sqlserver 91.63% <100.00%> (+9.99%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@lu-zhengda lu-zhengda marked this pull request as ready for review January 13, 2025 18:59
@lu-zhengda lu-zhengda requested review from a team as code owners January 13, 2025 18:59
db_name = db_name_lower
else:
self._log.debug(
"Skipping db {} as it is not in the databases list {} and collation is case sensitive".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit:
should be "Skipping db {} as it is not in the databases list {} OR collation is case sensitive"

azhou-datadog
azhou-datadog previously approved these changes Jan 13, 2025
Copy link
Contributor

@azhou-datadog azhou-datadog left a comment

Choose a reason for hiding this comment

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

LGTM

@lu-zhengda lu-zhengda added this pull request to the merge queue Jan 13, 2025
Merged via the queue into master with commit 8af850d Jan 13, 2025
36 checks passed
@lu-zhengda lu-zhengda deleted the zhengda.lu/collation branch January 13, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants