Skip to content

Commit 63236ba

Browse files
llalichagamreddysSicongLiu2000shivsoodUrvashi Raj
authored
Sync Repos: Release 170.82.0 (#151)
* Merged PR 1735207: Adding regex functions tests # Pull Request Template for ScriptDom ## Description This PR adds tests for regex intrinsic functions. Functional Spec - https://microsoft.sharepoint.com/:w:/t/Ad-Astra/EZAk15L-vkJHqsaCybly0QIB0eBUdv02BBaHUAl48aY_Pw?e=NPRj0w ## Code Change - [x] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [x] Code changes are accompanied by appropriate unit tests - [ ] Identified and included SMEs needed to review code changes - [x] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [x] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ## Additional Information None Adding regex functions tests Related work items: #4005966 * Merged PR 1718694: [ai_generate_chunks] Add syntax to ScriptDom # Pull Request Template for ScriptDom ## Description # Add syntax and script generation support for AI_GENERATE_CHUNKS table-valued function ## Description This PR introduces parser and script generator support for the new built-in table-valued function (TVF) `AI_GENERATE_CHUNKS`. `AI_GENERATE_CHUNKS` enables chunking of input text based on a specified strategy. It accepts required and optional parameters and supports aliasing for cross apply scenarios. ### Syntax supported ```sql SELECT * FROM AI_GENERATE_CHUNKS ( source = 'some text', chunk_type = fixed, chunk_size = 5, overlap = 2, enable_chunk_set_id = 1 ); ``` ### Parameters | Parameter | Required | Type | Description | |------------------------|----------|-------------------|--------------------------------------------------------------------| | `source` | Yes | `ScalarExpression`| Input text to be chunked | | `chunk_type` | Yes | `Identifier` | Type of chunking strategy. Currently only `fixed` is supported | | `chunk_size` | Yes | `ScalarExpression`| Number of tokens per chunk | | `overlap` | No | `ScalarExpression`| Optional token overlap between adjacent chunks | | `enable_chunk_set_id` | No | `ScalarExpression`| Optional flag. If set, adds a `chunk_set_id` column to the result | ### Summary of Changes - Added support for the `ai_generate_chunks` table-valued function to the SQL parser. - Introduced new AST class `AiGenerateChunksTableReference` with members: - `Source` - `ChunkType` - `ChunkSize` - `Overlap` - `EnableChunkSetId` - Added grammar rule for parsing `ai_generate_chunks`. - Implemented corresponding visitor logic for script generation (`SqlScriptGeneratorVisitor`). - Added unit tests for: - Positive cases covering all combinations of optional parameters. - Negative cases for missing/invalid parameter order, unexpected tokens, or malformed expressions. ### Example Use Cases This function is designed to support downstream AI workflows where long documents need to be split into manageable token chunks for embedding generation or other ML tasks. ## Code Change - [X] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [X] Code changes are accompanied by appropriate unit tests - [X] Identified and included SMEs needed to review code changes - [X] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [X] Follow the [steps](https://msdata.vi... * Update .NET SDK to latest patch version * Merged PR 1724944: [MSJSON] added support for json_objectagg and Returning JSON option for json_object, json_array # Pull Request Template for ScriptDom ## Description adds support to scriptdom for new functions and options in SQLServer. Specifically support for - Json_objectagg with options NULL ON NULL/ABSENT ON NULL and RETURNING JSON. - Support for RETURNING JSON option for json_object, json_array. Added relevant test for all options. ## Code Change - [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [X] Code changes are accompanied by appropriate unit tests - [X] Identified and included SMEs needed to review code changes - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [X] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature Added Test. * Merged PR 1724727: [ai_generate_embeddings] Add syntax to ScriptDom # Pull Request Template for ScriptDom ## Description This PR adds support for the new `AI_GENERATE_EMBEDDINGS` T-SQL built-in function syntax: ```sql AI_GENERATE_EMBEDDINGS('input text' USE MODEL model_name [PARAMETERS (...optional JSON...)]) ``` Input expression: required string or expression representing the text to embed. USE MODEL model_name: required keyword clause specifying the embedding model. PARAMETERS ( ... ): optional block allowing additional JSON parameters to customize embedding behavior. ### Examples ```sql -- Basic usage with required input and model SELECT AI_GENERATE_EMBEDDINGS('Hello world' USE MODEL MyEmbeddingModel); -- Usage with optional PARAMETERS block SELECT AI_GENERATE_EMBEDDINGS('Hello world' USE MODEL MyEmbeddingModel PARAMETERS (TRY_CONVERT(JSON, N'{"param":"value"}'))); ``` ### Features - Adds `AiGenerateEmbeddingsFunctionCall` AST node. - Grammar recognizes required `USE MODEL` clause and optional `PARAMETERS` block. - Script generator visitor outputs syntax matching expected SQL Server formatting, with or without optional PARAMETERS. - Comprehensive unit tests cover: - Missing required keywords or values (e.g., missing USE, missing MODEL). - Misplaced keywords (e.g., PARAMETERS before input). - Invalid syntax like missing parentheses or incomplete expressions. - Extra commas or unknown parameters. - Negative tests aligned with expected SQL46010 and SQL46029 parser errors. - Supports round-tripping: parsed AST can be pretty-printed back to valid SQL matching the original input. ### Compatibility - Valid only in SQL Server with compatibility level 170 or higher. ## Code Change - [X] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [X] Code changes are accompanied by appropriate unit tests - [X] Identified and included SMEs needed to review code changes - [X] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [X] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ---- #### AI description (iteration 1) #### PR Classification New feature implementation to add syntax support for the AI_GENERATE_EMBEDDINGS function in ScriptDom. #### PR Summary This PR introduces a new SQL function, AI_GENERATE_EMBEDDINGS, which allows users to send input text to external AI models and retrieve an em... * Merged PR 1752033: [modle_management]ScriptDom changes for external model support # Pull Request Template for ScriptDom ## Description Introduces syntax support for Create, Alter and Drop operation for External Model DDL CREATE CREATE EXTERNAL MODEL <model_name> AUTHORIZATION owner WITH ( LOCATION = 'URL or FILE PATH', API_FORMAT = ‘OpenAI, Azure OpenAI, etc’, MODEL_TYPE = <EMBEDDINGS,CHAT, etc>, MODEL = ‘text-embedding-ada-002,etc’, CREDENTIAL = <credential_name>, PARAMETERS = ‘{ “valid”:”JSON”}’ } | **Column Name** | **Data Type** | **Notes** | |-----------------------|---------------------|-----------| | `model_name` | `SYSNAME` | Name of the external model object | | `owner_name` | `SYSNAME` | Database principal that owns the external model object. Defaults to connected user if not specified. | | `location` | `NVARCHAR(4000)` | Location of the endpoint. Can be a URL (`https://...`) or file path (`mountpoint:\\...`). | | `api_format` | `NVARCHAR(100)` | Format of the API the endpoint accepts/produces. P0: Azure OpenAI, OpenAI, Ollama; P1: Local, Nvidia Triton, Databricks; P2: TBD | | `model_type` | `SYSNAME` | Model type for the data plane. P0: EMBEDDINGS; Post GA: CHAT, MODERATE, TRANSLATE, SPEECH. Only supported types are accepted. | | `model` | `NVARCHAR(100)` | Name of the embedding model used by the endpoint. | | `local_runtime_path` | `NVARCHAR(4000)` | Path to local model runtime (e.g., ONNX runtime). Required for local models. | | `credential` | `SYSNAME` | Name of the database scoped credential. Not used for ONNX Runtime. | | `parameters` | `JSON` | Default JSON parameters to be appended to the embeddings payload. | ## Code Change - [X] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [X] Code changes are accompanied by appropriate unit tests - [X] Identified and included SMEs needed to review code changes - [X] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [X] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [X] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ## Additional Information Please provide any additional information that might be helpful for the reviewers ScriptDom channges ---- #### AI description (iteration 1) #### PR Classific... * Merged PR 1758352: Add ScriptDom support for VECTOR_SEARCH function # Pull Request Template for ScriptDom ## Description Added parser and script generator support for VECTOR_SEARCH Before submitting your pull request, please ensure you have completed the following: ## Code Change - [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [ ] Code changes are accompanied by appropriate unit tests - [ ] Identified and included SMEs needed to review code changes - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ## Additional Information Please provide any additional information that might be helpful for the reviewers Add ScriptDom support for VECTOR_SEARCH function ---- #### AI description (iteration 1) #### PR Classification This pull request introduces a new feature by adding native ScriptDom support for the VECTOR_SEARCH function. #### PR Summary The changes implement parsing, AST definition, and script generation for VECTOR_SEARCH, along with a comprehensive suite of tests to validate error handling and syntax compliance. - **`SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.VectorSearchTableReference.cs`**: New file added to generate script output for the VECTOR_SEARCH function. - **`SqlScriptDom/Parser/TSql/TSql170.g` & `SqlDom/Parser/TSql/Ast.xml`**: Extended grammar rules and AST definitions to support VECTOR_SEARCH. - **`SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs`**: Added new constants (e.g., COSINE, DOT, EUCLIDEAN, METRIC, TOP_N, VECTOR_SEARCH) required for vector search processing. - **`Test/SqlDom/ParserErrorsTests.cs` and related vector test scripts**: Introduced extensive tests covering syntax errors and parameter validations for VECTOR_SEARCH. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4440435 * Merged PR 1757817: Added EM Permission support ## Code Change - [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [ ] Code changes are accompanied by appropriate unit tests - [ ] Identified and included SMEs needed to review code changes - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ## Additional Information Please provide any additional information that might be helpful for the reviewers Added EM Permission support ---- #### AI description (iteration 1) #### PR Classification This PR implements a new feature by adding support for External Model permissions in ScriptDOM, enabling the parsing and generation of new permission-related T-SQL statements. #### PR Summary The pull request enhances ScriptDOM to correctly handle External Model permissions—covering GRANT, DENY, REVOKE, and ALTER AUTHORIZATION operations—and integrates comprehensive tests and token generation support to improve IntelliSense and syntax-highlighting as outlined in the linked work items. - **`Test/SqlDom/ExternalModelPermissionUnitTests.cs`**: Adds unit tests for External Model permission statements, including backward compatibility checks. - **`Test/SqlDom/Baselines170/SecurityStatementExternalModelTests170.sql` & `Test/SqlDom/TestScripts/SecurityStatementExternalModelTests170.sql`**: Introduce baseline and test scripts with various External Model permission scenarios. - **`SqlScriptDom/Parser/TSql/TSql170ParserBaseInternal.cs` & `SqlScriptDom/Parser/TSql/SecurityObjectKind.cs`**: Update parsing logic and the security object enumeration to recognize and handle External Model keywords. - **`SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.SecurityTargetObject.cs`**: Enhances token generation to support the External Model permission syntax. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot --> Related work items: #4088625, #4088633 * Update .NET SDK to latest patch version (8.0.413) * Merged PR 1764425: Adding release notes for 170.82.0 # Pull Request Template for ScriptDom ## Description Please provide a detailed description, include the link to the design specification or SQL feature document for the new TSQL syntaxes. Make sure to add links to the Github or DevDiv issue Before submitting your pull request, please ensure you have completed the following: ## Code Change - [ ] The [Common checklist](https://msdata.visualstudio.com/SQLToolsAndLibraries/_git/Common?path=/Templates/PR%20Checklist%20for%20SQLToolsAndLibraries.md&version=GBmain&_a=preview) has been reviewed and followed - [ ] Code changes are accompanied by appropriate unit tests - [ ] Identified and included SMEs needed to review code changes - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=make-the-changes-in) here to make changes in the code ## Testing - [ ] Follow the [steps](https://msdata.visualstudio.com/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki/33838/Adding-or-Extending-TSql-support-in-Sql-Dom?anchor=to-extend-the-tests-do-the-following%3A) here to add new tests for your feature ## Documentation - [ ] Update relevant documentation in the [wiki](https://dev.azure.com/msdata/SQLToolsAndLibraries/_wiki/wikis/SQLToolsAndLibraries.wiki) and the README.md file ## Additional Information Please provide any additional information that might be helpful for the reviewers Adding release notes for 170.82.0 * remove extras * fixing the build --------- Co-authored-by: C Shanmukha Reddy <[email protected]> Co-authored-by: Sicong Liu <[email protected]> Co-authored-by: MerlinBot <MerlinBot> Co-authored-by: Shiv Prashant Sood <[email protected]> Co-authored-by: Urvashi Raj <[email protected]> Co-authored-by: Zi Chen <[email protected]>
1 parent 4476447 commit 63236ba

37 files changed

+2652
-203
lines changed

SqlScriptDom/Parser/TSql/Ast.xml

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@
403403
Summary="Actual JSON for clause options. First one is always present (JSON mode)."/>
404404
</Class>
405405
<Class Name="JsonKeyValue" Base="ScalarExpression" Summary ="Represent a key value Pair">
406-
<Member Name="JsonKeyName" Type="ScalarExpression" Summary="Key name" />
407-
<Member Name="JsonValue" Type="ScalarExpression" Summary="scalar expression" />
406+
<Member Name="JsonKeyName" Type="ScalarExpression" Summary="Key name" />
407+
<Member Name="JsonValue" Type="ScalarExpression" Summary="scalar expression" />
408408
</Class>
409409
<Class Name="JsonForClauseOption" Base="ForClause" Summary="Represents FOR JSON (options) case">
410410
<Member Name="OptionKind" Type="JsonForClauseOptions" GenerateUpdatePositionInfoCall="false" Summary="Option kind"/>
@@ -642,6 +642,7 @@
642642
<Member Name="TrimOptions" Type="Identifier" Summary="TRIM intrinsic can take optional arguments like 'Leading', 'Trailing' or 'Both'."/>
643643
<Member Name="JsonParameters" Type="JsonKeyValue" Collection="true" Summary="The Json parameters to the function."/>
644644
<Member Name="AbsentOrNullOnNull" Type="Identifier" Collection="true" Summary="The Absent or Null on Null will convert or remove sql null to json null"/>
645+
<Member Name="ReturnType" Type="Identifier" Collection="true" Summary="Return type of function. Used by json_arrayagg, json_objectagg, json_array, json_object and json_value"/>
645646
</Class>
646647
<Class Name="CallTarget" Abstract="true" Summary="Represents a target of a function call.">
647648
</Class>
@@ -1346,6 +1347,27 @@
13461347
<InheritedClass Name="DropUnownedObjectStatement"/>
13471348
</Class>
13481349

1350+
<Class Name="ExternalModelStatement" Abstract="true" Base="TSqlStatement" Summary="Base class for all external model statement objects.">
1351+
<Member Name="Name" Type="Identifier" Summary="The external model name."/>
1352+
<Member Name="Location" Type="Literal" Summary="The external model location name."/>
1353+
<Member Name="ApiFormat" Type="Literal" Summary="The external model api format name."/>
1354+
<Member Name="ModelType" Type="ExternalModelTypeOption?" GenerateUpdatePositionInfoCall="false" Summary="The external model type name."/>
1355+
<Member Name="ModelName" Type="Literal" Summary="The external model name to be used to generate embeddings."/>
1356+
<Member Name="Credential" Type="Identifier" Summary="The external model credentials name."/>
1357+
<Member Name="Parameters" Type="Literal" Summary="The external model parameters as key-value pairs."/>
1358+
<Member Name="LocalRuntimePath" Type="Literal" Summary="The local runtime path for the model."/>
1359+
</Class>
1360+
<Class Name="CreateExternalModelStatement" Base="ExternalModelStatement" Summary="Represents a CREATE EXTERNAL MODEL statement.">
1361+
<InheritedClass Name="ExternalModelStatement"/>
1362+
<Implements Interface="IAuthorization"/>
1363+
</Class>
1364+
<Class Name="DropExternalModelStatement" Base="DropUnownedObjectStatement" Summary="Represents a DROP EXTERNAL MODEL statement.">
1365+
<InheritedClass Name="DropUnownedObjectStatement"/>
1366+
</Class>
1367+
<Class Name="AlterExternalModelStatement" Base="ExternalModelStatement" Summary="Represents a ALTER EXTERNAL MODEL statement.">
1368+
<InheritedClass Name="ExternalModelStatement"/>
1369+
</Class>
1370+
13491371
<Class Name="ExternalFileFormatStatement" Abstract="true" Base="TSqlStatement" Summary="Base class for all external file format statement objects.">
13501372
<Member Name="Name" Type="Identifier" Summary="The external file format name."/>
13511373
<Member Name="FormatType" Type="ExternalFileFormatType" GenerateUpdatePositionInfoCall="false" Summary="The external file format type name."/>
@@ -3558,7 +3580,7 @@
35583580
</Class>
35593581
<Class Name="TableReferenceWithAlias" Abstract="true" Base="TableReference" Summary="This represents a table reference that can have an alias.">
35603582
<Member Name="Alias" Type="Identifier" Summary="Optional table alias. May be null."/>
3561-
<Member Name="ForPath" Type="bool" Summary="Whether this table reference is marked as graph FOR PATH."/>
3583+
<Member Name="ForPath" Type="bool" Summary="Whether this table reference is marked as graph FOR PATH."/>
35623584
</Class>
35633585
<Class Name="TableReferenceWithAliasAndColumns" Abstract="true" Base="TableReferenceWithAlias" Summary="Represents a table reference that can specify column aliases.">
35643586
<InheritedClass Name="TableReferenceWithAlias" />
@@ -4713,4 +4735,29 @@
47134735
<InheritedClass Name="DatabaseOption" />
47144736
<Member Name="ElasticPoolName" Type="Identifier" Summary="The name of the elastic pool."/>
47154737
</Class>
4738+
<Class Name="AIGenerateChunksTableReference" Base="TableReferenceWithAlias" Summary="Represents the AI_GENERATE_CHUNKS table-valued function call.">
4739+
<InheritedClass Name="TableReferenceWithAlias" />
4740+
<Member Name="Source" Type="ScalarExpression" Summary="The expression representing the input text or column to chunk." />
4741+
<Member Name="ChunkType" Type="Identifier" Summary="The chunking strategy, such as FIXED." />
4742+
</Class>
4743+
<Class Name="AIGenerateFixedChunksTableReference" Base="AIGenerateChunksTableReference" Summary="Represents a fixed-chunk configuration of AI_GENERATE_CHUNKS.">
4744+
<InheritedClass Name="AIGenerateChunksTableReference" />
4745+
<Member Name="ChunkSize" Type="ScalarExpression" Summary="The size of each generated chunk." />
4746+
<Member Name="Overlap" Type="ScalarExpression" Summary="Optional percentage of overlap between chunks." />
4747+
<Member Name="EnableChunkSetId" Type="ScalarExpression" Summary="Optional flag to include a chunk_set_id column in the result." />
4748+
</Class>
4749+
<Class Name="AIGenerateEmbeddingsFunctionCall" Base="PrimaryExpression" Summary="Represents the ai_generate_embeddings built-in.">
4750+
<InheritedClass Name="PrimaryExpression" />
4751+
<Member Name="Input" Type="ScalarExpression" Summary="Input text to generate embeddings for." />
4752+
<Member Name="ModelName" Type="SchemaObjectName" Summary="Model name used in USE MODEL clause." />
4753+
<Member Name="OptionalParameters" Type="ScalarExpression" Summary="Optional PARAMETERS clause, must evaluate to JSON." />
4754+
</Class>
4755+
<Class Name="VectorSearchTableReference" Base="TableReferenceWithAlias" Summary="Represents the VECTOR_SEARCH table-valued function call.">
4756+
<InheritedClass Name="TableReferenceWithAlias" />
4757+
<Member Name="Table" Type="TableReferenceWithAlias" Summary="Table on which perform the search." />
4758+
<Member Name="Column" Type="ColumnReferenceExpression" Summary="The vector column in which search is performed." />
4759+
<Member Name="SimilarTo" Type="ScalarExpression" Summary="The vector used for search." />
4760+
<Member Name="Metric" Type="StringLiteral" Summary="The distance metric to use for the search." />
4761+
<Member Name="TopN" Type="IntegerLiteral" Summary="The maximum number of similar vectors that must be returned." />
4762+
</Class>
47164763
</Types>

SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ internal static class CodeGenerationSupporter
9999
internal const string Affinity = "AFFINITY";
100100
internal const string After = "AFTER";
101101
internal const string Aggregate = "AGGREGATE";
102+
internal const string AiGenerateChunks = "AI_GENERATE_CHUNKS";
103+
internal const string AIGenerateEmbeddings = "AI_GENERATE_EMBEDDINGS";
102104
internal const string Algorithm = "ALGORITHM";
103105
internal const string AlterColumn = "ALTERCOLUMN";
104106
internal const string All = "ALL";
@@ -118,6 +120,7 @@ internal static class CodeGenerationSupporter
118120
internal const string Always = "ALWAYS";
119121
internal const string Anonymous = "ANONYMOUS";
120122
internal const string AnsiNullDefault = "ANSI_NULL_DEFAULT";
123+
internal const string ApiFormat = "API_FORMAT";
121124
internal const string Application = "APPLICATION";
122125
internal const string ApplicationLog = "APPLICATION_LOG";
123126
internal const string Apply = "APPLY";
@@ -198,6 +201,8 @@ internal static class CodeGenerationSupporter
198201
internal const string CheckPolicy = "CHECK_POLICY";
199202
internal const string Checksum = "CHECKSUM";
200203
internal const string ChecksumAgg = "CHECKSUM_AGG";
204+
internal const string ChunkSize = "CHUNK_SIZE";
205+
internal const string ChunkType = "CHUNK_TYPE";
201206
internal const string ModularSum = "MODULAR_SUM";
202207
internal const string Classifier = "CLASSIFIER";
203208
internal const string Classification = "CLASSIFICATION";
@@ -225,7 +230,6 @@ internal static class CodeGenerationSupporter
225230
internal const string CompressionDelay = "COMPRESSION_DELAY";
226231
internal const string CompressAllRowGroups = "COMPRESS_ALL_ROW_GROUPS";
227232
internal const string Concat = "CONCAT";
228-
internal const string Cosine = "COSINE";
229233
internal const string Configuration = "CONFIGURATION";
230234
internal const string ConnectionOptions = "CONNECTION_OPTIONS";
231235
internal const string Contained = "CONTAINED";
@@ -244,6 +248,7 @@ internal static class CodeGenerationSupporter
244248
internal const string CopyCommand = "COPY";
245249
internal const string CopyOnly = "COPY_ONLY";
246250
internal const string Correlated = "CORRELATED";
251+
internal const string Cosine = "COSINE";
247252
internal const string Count = "COUNT";
248253
internal const string CountBig = "COUNT_BIG";
249254
internal const string Counter = "COUNTER";
@@ -301,7 +306,6 @@ internal static class CodeGenerationSupporter
301306
internal const string Description = "DESCRIPTION";
302307
internal const string DesiredState = "DESIRED_STATE";
303308
internal const string DiskANN = "DISKANN";
304-
internal const string Dot = "DOT";
305309
internal const string Delay = "DELAY";
306310
internal const string DelayedDurability = "DELAYED_DURABILITY";
307311
internal const string DelimitedText = "DELIMITEDTEXT";
@@ -320,6 +324,7 @@ internal static class CodeGenerationSupporter
320324
internal const string Document = "DOCUMENT";
321325
internal const string DollarSign = "$";
322326
internal const string DollarPartition = "$PARTITION";
327+
internal const string Dot = "DOT";
323328
internal const string Drop = "DROP";
324329
internal const string DropExisting = "DROP_EXISTING";
325330
internal const string DTSBuffers = "DTS_BUFFERS";
@@ -329,11 +334,13 @@ internal static class CodeGenerationSupporter
329334
internal const string Edition = "EDITION";
330335
internal const string ElasticPool = "ELASTIC_POOL";
331336
internal const string Elements = "ELEMENTS";
337+
internal const string Embeddings = "EMBEDDINGS";
332338
internal const string Emergency = "EMERGENCY";
333339
internal const string Empty = "EMPTY";
334340
internal const string Enable = "ENABLE";
335341
internal const string Enabled = "ENABLED";
336342
internal const string EnableBroker = "ENABLE_BROKER";
343+
internal const string EnableChunkSetId = "ENABLE_CHUNK_SET_ID";
337344
internal const string EnclaveComputations = "ENCLAVE_COMPUTATIONS";
338345
internal const string Encoding = "ENCODING";
339346
internal const string Encrypted = "ENCRYPTED";
@@ -350,13 +357,13 @@ internal static class CodeGenerationSupporter
350357
internal const string EnvironmentVariables = "ENVIRONMENT_VARIABLES";
351358
internal const string Equal = "=";
352359
internal const string Error = "ERROR";
353-
internal const string Euclidean = "EUCLIDEAN";
354360
internal const string ErrorBrokerConversations = "ERROR_BROKER_CONVERSATIONS";
355361
internal const string ErrorDataSource = "ERRORFILE_DATA_SOURCE";
356362
internal const string ErrorFile = "ERRORFILE";
357363
internal const string ErrorFileCredential = "ERRORFILE_CREDENTIAL";
358364
internal const string EscapeChar = "ESCAPECHAR";
359365
internal const string EstimateOnly = "ESTIMATEONLY";
366+
internal const string Euclidean = "EUCLIDEAN";
360367
internal const string Event = "EVENT";
361368
internal const string EventRetentionMode = "EVENT_RETENTION_MODE";
362369
internal const string Exclamation = "!";
@@ -415,6 +422,7 @@ internal static class CodeGenerationSupporter
415422
internal const string FieldQuote = "FIELDQUOTE";
416423
internal const string FipsFlagger = "FIPS_FLAGGER";
417424
internal const string First = "FIRST";
425+
internal const string Fixed = "FIXED";
418426
internal const string FlushIntervalSeconds = "FLUSH_INTERVAL_SECONDS";
419427
internal const string FlushIntervalSecondsAlt = "DATA_FLUSH_INTERVAL_SECONDS";
420428
internal const string Fn = "FN";
@@ -514,6 +522,7 @@ internal static class CodeGenerationSupporter
514522
internal const string Json = "JSON";
515523
internal const string JsonArray = "JSON_ARRAY";
516524
internal const string JsonObject = "JSON_OBJECT";
525+
internal const string JsonObjectAgg = "JSON_OBJECTAGG";
517526
internal const string Keep = "KEEP";
518527
internal const string KeepDefaults = "KEEPDEFAULTS";
519528
internal const string KeepFixed = "KEEPFIXED";
@@ -555,6 +564,7 @@ internal static class CodeGenerationSupporter
555564
internal const string LoadHistory = "LOADHISTORY";
556565
internal const string LobCompaction = "LOB_COMPACTION";
557566
internal const string Local = "LOCAL";
567+
internal const string LocalRuntimePath = "LOCAL_RUNTIME_PATH";
558568
internal const string Location = "LOCATION";
559569
internal const string LocationUserDB = "USER_DB";
560570
internal const string LocalServiceName = "LOCAL_SERVICE_NAME";
@@ -615,8 +625,8 @@ internal static class CodeGenerationSupporter
615625
internal const string Message = "MESSAGE";
616626
internal const string MessageForwarding = "MESSAGE_FORWARDING";
617627
internal const string MessageForwardSize = "MESSAGE_FORWARD_SIZE";
618-
internal const string MigrationState = "MIGRATION_STATE";
619628
internal const string Metric = "METRIC";
629+
internal const string MigrationState = "MIGRATION_STATE";
620630
internal const string Min = "MIN";
621631
internal const string MinGrantPercent = "MIN_GRANT_PERCENT";
622632
internal const string MinCpuPercent = "MIN_CPU_PERCENT";
@@ -628,6 +638,8 @@ internal static class CodeGenerationSupporter
628638
internal const string Mirror = "MIRROR";
629639
internal const string Mixed = "MIXED";
630640
internal const string MixedPageAllocation = "MIXED_PAGE_ALLOCATION";
641+
internal const string ModelType = "MODEL_TYPE";
642+
internal const string ModelName = "MODEL";
631643
internal const string Modify = "MODIFY";
632644
internal const string Money = "MONEY";
633645
internal const string Move = "MOVE";
@@ -761,6 +773,7 @@ internal static class CodeGenerationSupporter
761773
internal const string Model = "MODEL";
762774
internal const string RunTime = "RUNTIME";
763775
internal const string Onnx = "ONNX";
776+
internal const string Overlap = "OVERLAP";
764777

765778
internal const string Process = "PROCESS";
766779
internal const string PropertySetGuid = "PROPERTY_SET_GUID";
@@ -842,6 +855,7 @@ internal static class CodeGenerationSupporter
842855
internal const string RetentionDays = "RETENTION_DAYS";
843856
internal const string RetentionPeriod = "RETENTION_PERIOD";
844857
internal const string Returns = "RETURNS";
858+
internal const string Returning = "RETURNING";
845859
internal const string RequestMaxCpuTimeSec = "REQUEST_MAX_CPU_TIME_SEC";
846860
internal const string RequestMaxMemoryGrantPercent = "REQUEST_MAX_MEMORY_GRANT_PERCENT";
847861
internal const string RequestMemoryGrantTimeoutSec = "REQUEST_MEMORY_GRANT_TIMEOUT_SEC";
@@ -916,6 +930,7 @@ internal static class CodeGenerationSupporter
916930
internal const string ShrinkDb = "SHRINKDB";
917931
internal const string Sid = "SID";
918932
internal const string Signature = "SIGNATURE";
933+
internal const string SimilarTo = "SIMILAR_TO";
919934
internal const string Simple = "SIMPLE";
920935
internal const string SingleBlob = "SINGLE_BLOB";
921936
internal const string SingleClob = "SINGLE_CLOB";
@@ -1025,6 +1040,7 @@ internal static class CodeGenerationSupporter
10251040
internal const string Timer = "TIMER";
10261041
internal const string TimeStamp = "TIMESTAMP";
10271042
internal const string TinyInt = "TINYINT";
1043+
internal const string TopN = "TOP_N";
10281044
internal const string TornPageDetection = "TORN_PAGE_DETECTION";
10291045
internal const string TrackCausality = "TRACK_CAUSALITY";
10301046
internal const string TrackColumnsUpdated = "TRACK_COLUMNS_UPDATED";
@@ -1059,6 +1075,7 @@ internal static class CodeGenerationSupporter
10591075
internal const string Unpivot = "UNPIVOT";
10601076
internal const string UpdLock = "UPDLOCK";
10611077
internal const string Url = "URL";
1078+
internal const string Use = "USE";
10621079
internal const string Used = "USED";
10631080
internal const string UseIdentity = "USE_IDENTITY";
10641081
internal const string UseTypeDefault = "USE_TYPE_DEFAULT";
@@ -1076,6 +1093,7 @@ internal static class CodeGenerationSupporter
10761093
internal const string Varp = "VARP";
10771094
internal const string VDevNo = "VDEVNO";
10781095
internal const string Vector = "Vector";
1096+
internal const string VectorSearch = "VECTOR_SEARCH";
10791097
internal const string Verbose = "VERBOSE";
10801098
internal const string VerboseLogging = "VerboseLogging";
10811099
internal const string VerifyOnly = "VERIFYONLY";
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//------------------------------------------------------------------------------
2+
// <copyright file="ExternalModelTypeOption.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// </copyright>
5+
//------------------------------------------------------------------------------
6+
using System;
7+
8+
namespace Microsoft.SqlServer.TransactSql.ScriptDom
9+
{
10+
#pragma warning disable 1591
11+
12+
/// <summary>
13+
/// The enumeration specifies the external model type
14+
/// Currently, we support EMBEDDINGS only.
15+
/// </summary>
16+
public enum ExternalModelTypeOption
17+
{
18+
/// <summary>
19+
/// MODEL_TYPE = EMBEDDINGS
20+
/// </summary>
21+
EMBEDDINGS = 0,
22+
23+
}
24+
25+
#pragma warning restore 1591
26+
}

SqlScriptDom/Parser/TSql/SecurityObjectKind.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public enum SecurityObjectKind
4242
SearchPropertyList = 23,
4343
ServerRole = 24,
4444
AvailabilityGroup = 25,
45+
ExternalModel = 26,
4546
}
4647

4748
#pragma warning restore 1591

0 commit comments

Comments
 (0)