Skip to content

[2.0] Fixes 37646: Quote literal SQL Server schema names - #37789

Merged
stout-yeoman merged 1 commit into
2.0from
codex/37646-schema-quoting-2.0
Nov 13, 2026
Merged

stout-yeoman merged 1 commit into
2.0from
codex/37646-schema-quoting-2.0

Conversation

@stout-yeoman

@stout-yeoman stout-yeoman commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #37646

The source issue was closed when #37692 merged into main; this PR delivers the same fix to 2.0.

Backport #37692 to 2.0. Preserve literal MSSQL/AzureSQL schema names such as sales.archive during sample/profiler query construction: SQLAlchemy emits [sales.archive] as one identifier and handles bracket escaping. Raw catalog values remain unchanged.

Type of change:

  • Bug fix

High-level design:

Retain the original converter-registry policy: common default None, MSSQL/AzureSQL opt in to True, shared ORM builder consumes the flag and preserves Snowflake behavior. Resolve common.py using the release branch's existing typing imports/type maps, and append only the intended schema tests to its existing converter suite. Preserve release-specific sampler behavior. No unrelated main type/XML/array refactors, dependencies, generated schemas or pipeline-status changes. A comparison with main and 2.1 found no missing prerequisite for this policy; existing 2.0 type and sampling limitations remain unchanged.

Tests:

Use cases covered

  • MSSQL and AzureSQL; ordinary, dotted, multiple-dot and bracket-bearing schemas; tables/views.
  • Real ORM/sampler SQL compilation and raw schema preservation in QueryRunner.
  • Snowflake/PostgreSQL/Trino controls and existing MSSQL/AzureSQL sampling/runner cases.

Release base: c2fb84d8706a2a33c3c2573c39725b394d66ecd4. Candidate: d98e56f886fd3892dc228752e26a435f6c21d3e3. Separate target-generated Python 3.11.14 environment, SQLAlchemy 2.0.57, pytest 7.0.1; dependency compatibility passed. Test processes used one worker and OMP/BLAS threads=1.

Unit tests

RED: with only the four product-file changes withheld, the new tests produced 24 failures / 4 passing other-dialect controls, including both production sampler paths:

env/bin/python -m pytest ingestion/tests/unit/observability/profiler/test_converter.py -k 'literal_tsql or production_tsql or other_dialect' -n0 -q

GREEN: 64 passed:

env/bin/python -m coverage run --source=metadata.profiler.orm.converter -m pytest  \
  ingestion/tests/unit/observability/profiler/test_converter.py  \
  ingestion/tests/unit/observability/profiler/sqlalchemy/mssql/test_mssql_sampling.py  \
  ingestion/tests/unit/observability/profiler/sqlalchemy/azuresql/test_azuresql_sampling.py  \
  ingestion/tests/unit/observability/profiler/sqlalchemy/test_runner.py  \
  ingestion/tests/unit/sampler/test_sampler_100_pct.py::TestSQASampler100Pct  \
  ingestion/tests/unit/sampler/sqlalchemy/test_trino_sampler_quoting.py  \
  ingestion/tests/unit/observability/profiler/sqlalchemy/snowflake/test_snowflake_sampling.py -n0 -q

Line coverage: MSSQL/AzureSQL converter files 100%, common mapper 94.44%, shared base 90.14%. All executable changed lines covered. Whole converter directory 89%, including unchanged mappers outside this selection.

Initial broader sampling-file selection: 64 passed / 3 Datalake failures because this focused environment omits pandas; no Datalake product change. The final run selects the SQLAlchemy sampling class. Initial pytest-cov import timing understated coverage; starting coverage before pytest produced the reported measurements. Ruff 0.15.12 check/format and normal commit hooks passed; focused basedpyright using native Node returned 0 errors / 0 warnings. Broader suites/full static profile not run.

Backend integration tests

Not applicable: no Java or API changes.

Ingestion integration tests

Retained ingestion/tests/integration/profiler/test_dynamic_sampling_mssql.py, including the eight new MSSQL/AzureSQL × ordinary/dotted schema × table/view cases. 14 tests collected; not executed against a source engine on this release candidate.

env/bin/python -m pytest ingestion/tests/integration/profiler/test_dynamic_sampling_mssql.py --collect-only -n0 -q

Original main head 04692b2b32a1d4164f2df44bcaf95f79c413518c passed 20 live sampler cases, 14 integration cases and four sampling/classification CLI/API table/view cases. Those historical results do not establish execution of this distinct 2.0 candidate. No new source-engine/full-stack run was selected for this target-preserving adaptation; broader/live release validation remains unrun. Azure-hosted authentication remains unverified.

Playwright (UI) tests

Not applicable: no UI changes.

Manual testing performed

No CLI/UI or live source-engine flow ran on this release candidate. Performed target-specific pre-fix/post-fix SQL/ORM regressions, compared release APIs and reviewed every conflict/clean hunk. Raw names and exact qualified SQL are asserted by tests. The original main runtime and data were cleaned by its validation assignment; this backport created no services, ports or test databases.

UI screen recording / screenshots:

Not applicable: Python-only ingestion bug fix.

Checklist:

  • Read repository contribution guidance.
  • Linked issue and original main PR above.
  • Explained non-obvious identifier handling; preserved release architecture and existing tests.
  • Added/retained regressions and recorded actual coverage, executed tests and unrun integration limits.
  • JSON schema/migration and UI recording requirements: not applicable.
  • No new public configuration, dependency or cross-component contract.
  • Self-review completed against the exact release base; no unresolved findings.

@stout-yeoman
stout-yeoman requested a review from a team as a code owner November 13, 2026 15:46
@stout-yeoman stout-yeoman added the 2.0 Needs to ship in a 2.0.x release (manual backport) label Nov 13, 2026
@stout-yeoman
stout-yeoman requested review from ulixius9 and removed request for a team November 13, 2026 15:46
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@stout-yeoman stout-yeoman added the skip-pr-checks Bypass PR metadata validation check label Nov 13, 2026
@gitar-bot

gitar-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Changing MSSQL/AzureSQL schema quoting preserves dotted names as literal identifiers; incorrect qualification could make profiler queries fail or target a different schema.

Backport of the fix that preserves literal MSSQL and AzureSQL schema names such as sales.archive during profiler and sampler SQL construction, so SQLAlchemy emits them as single bracketed identifiers. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@stout-yeoman stout-yeoman removed the skip-pr-checks Bypass PR metadata validation check label Nov 13, 2026
@stout-yeoman stout-yeoman linked an issue Nov 13, 2026 that may be closed by this pull request
@stout-yeoman stout-yeoman added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check labels Nov 13, 2026
@stout-yeoman
stout-yeoman merged commit ab670ac into 2.0 Nov 13, 2026
79 of 82 checks passed
@stout-yeoman
stout-yeoman deleted the codex/37646-schema-quoting-2.0 branch November 13, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.0 Needs to ship in a 2.0.x release (manual backport) safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MSSQL sampling misinterprets schema names containing dots

1 participant