Skip to content

Commit 8257ace

Browse files
author
Davide Mauri
committed
updated to work well with SQL Server 2025 too
1 parent 899f8d8 commit 8257ace

9 files changed

Lines changed: 27 additions & 14 deletions

DiskANN/Wikipedia/001-setup-objects.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-- Uncomment if using SQL Server 2025
2-
-- use WikipediaTest
2+
--use WikipediaTest
3+
--go
34

45
/*
56
Cleanup if needed

DiskANN/Wikipedia/002a-import-data-local-file.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-- Uncomment if using SQL Server 2025
2-
-- use WikipediaTest
2+
--use WikipediaTest
3+
--go
34

45
/*
56
Import data reading it from a local file. Usable only with SQL Server 2025

DiskANN/Wikipedia/002b-import-data-azure-storage.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
-- Uncomment if using SQL Server 2025
2-
-- use WikipediaTest
2+
--use WikipediaTest
3+
--go
4+
35

46
/*
57
Create database scoped credential and external data source.

DiskANN/Wikipedia/003-update-table.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
-- Uncomment if using SQL Server 2025
2-
-- use WikipediaTest
2+
--use WikipediaTest
3+
--go
4+
35

46
/*
57
Add primary key

DiskANN/Wikipedia/004c-generate-search-vector-openai.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
embeddings for the requested text. Make sure to have an OpenAI "ada2-text-embedding"
66
model deployed in OpenAI o Azure OpenAI.
77
*/
8+
-- Uncomment if using SQL Server 2025
9+
--use WikipediaTest
10+
--go
811

912
-- Create database credentials to store OpenAI credentials
1013
-- It is recommended to use Managed Identity, as explained here:

DiskANN/Wikipedia/005-diskann-test.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-- Uncomment if using SQL Server 2025
2-
-- use WikipediaTest
2+
--use WikipediaTest
3+
--go
34

45
set statistics time off
56
go

DiskANN/Wikipedia/006-fulltext-setup.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-- Uncomment if using SQL Server 2025
2-
-- use WikipediaTest
2+
--use WikipediaTest
3+
--go
34

45
if not exists(select * from sys.fulltext_catalogs where [name] = 'FullTextCatalog')
56
begin

DiskANN/Wikipedia/007-hybrid-search.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
in the next script
77
*/
88
-- Uncomment if using SQL Server 2025
9-
-- use WikipediaTest
9+
--use WikipediaTest
10+
--go
1011

1112
set statistics time on
1213
set statistics io on

DiskANN/Wikipedia/008-semantic-reranking.sql

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
in the next script
77
*/
88
-- Uncomment if using SQL Server 2025
9-
-- use WikipediaTest
9+
--use WikipediaTest
10+
--go
1011

11-
if not exists(select * from sys.database_scoped_credentials where [name] = 'https://dm-open-ai-3.services.ai.azure.com/providers/cohere/v2/rerank')
12+
if not exists(select * from sys.database_scoped_credentials where [name] = 'https://<endpoint>.services.ai.azure.com/providers/cohere/v2/rerank')
1213
begin
13-
create database scoped credential [https://dm-open-ai-3.services.ai.azure.com/providers/cohere/v2/rerank]
14-
with identity = 'Managed Identity', secret = '{"resourceid":"https://cognitiveservices.azure.com"}';
14+
create database scoped credential [https://<endpoint>.services.ai.azure.com/providers/cohere/v2/rerank]
15+
--with identity = 'Managed Identity', secret = '{"resourceid":"https://cognitiveservices.azure.com"}';
1516
--or
16-
--with identity = 'HTTPEndpointHEader', secret = '{"api-key":"<api-key>"}';
17+
with identity = 'HTTPEndpointHeaders', secret = '{"api-key":"<api-key>"}';
1718
end
1819
go
1920

@@ -34,8 +35,8 @@ DECLARE @payload JSON = JSON_OBJECT(
3435
DECLARE @response NVARCHAR(MAX);
3536
DECLARE @dummy NVARCHAR(MAX) = CAST(@payload AS NVARCHAR(MAX))
3637
EXEC sp_invoke_external_rest_endpoint
37-
@url = 'https://dm-open-ai-3.services.ai.azure.com/providers/cohere/v2/rerank',
38-
@credential = [https://dm-open-ai-3.services.ai.azure.com/providers/cohere/v2/rerank],
38+
@url = 'https://<endpoint>.services.ai.azure.com/providers/cohere/v2/rerank',
39+
@credential = [https://<endpoint>.services.ai.azure.com/providers/cohere/v2/rerank],
3940
@payload = @dummy ,
4041
@response = @response OUTPUT
4142
;

0 commit comments

Comments
 (0)