Skip to content

Fix MODEL_TYPE fragment classification in CreateExternalModelStatement#210

Merged
llali merged 1 commit into
microsoft:mainfrom
ZEUSXXIV:fix-model-type-fragment
Jun 10, 2026
Merged

Fix MODEL_TYPE fragment classification in CreateExternalModelStatement#210
llali merged 1 commit into
microsoft:mainfrom
ZEUSXXIV:fix-model-type-fragment

Conversation

@ZEUSXXIV

@ZEUSXXIV ZEUSXXIV commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #176.

Exposes MODEL_TYPE as a proper subclass of TSqlFragment (ExternalModelTypeOption) in CREATE EXTERNAL MODEL and ALTER EXTERNAL MODEL statements. This enables fragment visitation via TSqlFragmentVisitor, tracks start offset and position metadata, and ensures architectural consistency. Includes regression coverage to verify visitor traversal.

Code Changes

@ZEUSXXIV

ZEUSXXIV commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@llali
llali merged commit 20f9bf1 into microsoft:main Jun 10, 2026
5 checks passed
llali added a commit that referenced this pull request Jul 22, 2026
Commit 20f9bf1 (PR #210, fixing #176) reclassified MODEL_TYPE as a
TSqlFragment but broke the public API: it repurposed the enum
ExternalModelTypeOption into a fragment class and changed the type of
ExternalModelStatement.ModelType from ExternalModelTypeOption? to a
fragment reference.

This change delivers the same fix additively, without breaking the API:

- Keep enum ExternalModelTypeOption { EMBEDDINGS } and the
  ExternalModelStatement.ModelType (ExternalModelTypeOption?) member
  unchanged for backward compatibility.
- Add a visitable fragment ExternalModelTypeSpecification whose
  OptionKind reuses the existing ExternalModelTypeOption enum, plus a
  new ModelTypeSpecification member on ExternalModelStatement.
- The parser populates both representations; the script generator
  prefers the fragment and falls back to the legacy enum.

All 624 unit tests pass on net8.0 and net472.
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.

MODEL_TYPE not classified as TSqlFragment in CreateExternalModelStatement

2 participants