This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pandas==2.2.3 | |
# SQLAlchemy==2.0.40 | |
# pyodbc==5.2.0 | |
import pandas as pd | |
from sqlalchemy import create_engine | |
from sqlalchemy.engine import URL | |
connection_string = ( | |
r"DRIVER={ODBC Driver 18 for SQL Server};" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"actions": { | |
"Chunk_text": { | |
"type": "ChunkText", | |
"inputs": { | |
"chunkingStrategy": "TokenSize", | |
"text": "@body('Parse_a_document')?['text']", | |
"EncodingModel": "cl100k_base", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"actions": { | |
"Azure_OpenAI_-_Get_an_embedding": { | |
"type": "ServiceProvider", | |
"inputs": { | |
"parameters": { | |
"deploymentId": "@parameters('OpenAI_TextEmbedding_Deployment_Identifier_ingesttosql')", | |
"input": "@triggerBody()?['question']" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void LoadFiles(string test) | |
{ | |
LoadFile(LoadFVECS, $"c:\\Temp\\vector\\{test}\\{test}_base.fvecs", $"{test}_base", num:1000000, dim:128); | |
LoadFile(LoadFVECS, $"c:\\Temp\\vector\\{test}\\{test}_query.fvecs", $"{test}_query", num:10000, dim:128); | |
LoadFile(LoadIVECS, $"c:\\Temp\\vector\\{test}\\{test}_groundtruth.ivecs", $"{test}_groundtruth", num:10000, dim:100); | |
} | |
private static void LoadFile(Func<BinaryReader, int, string> FileLoader, string file, string tablename, int num, int dim) | |
{ | |
Console.WriteLine($"Reading file {file}..."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or alter function dbo.CalculateSum(@a as int, @b as int) | |
returns int | |
with schemabinding | |
as | |
begin | |
return @a + @b | |
end | |
go | |
create table dbo.WithPersistedUDF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export curVer=`printf "%03d%03d%03d" $(az --version | grep 'eventgrid' | awk '{gsub(/[()]/, "", $2); print $2}' | tail -1 | tr '.' ' ')` | |
export reqVer=`printf "%03d%03d%03d" $(echo '0.5.0' | tr '.' ' ')` | |
if [[ curVer -lt reqVer ]] ; then | |
echo "error" >&2 | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "file", | |
"connection": "wasbs://CONTAINER@ACCOUNT_NAME.blob.core.windows.net", | |
"config": null, | |
"workspaces": { | |
"root": { | |
"location": "/", | |
"writable": false, | |
"defaultInputFormat": null, | |
"allowAccessOutsideWorkspace": false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Create the Database Master Key, if needed | |
*/ | |
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'My-L0ng&Str0ng_P4ss0wrd!'; | |
GO | |
/* | |
Create database scoped credentials to store the Shared Access Signature (SAS) | |
needed to access the Azure Blob Container. More info on Azure Blob SAS here: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Login-AzureRmAccount | |
Select-AzureRmSubscription -Subscription <your-subscription-id> | |
$servers = Get-AzureRmSqlServer | |
foreach($s in $servers) { | |
$databases = Get-AzureRmSqlDatabase -ServerName $s.ServerName -ResourceGroupName $s.ResourceGroupName | |
foreach ($d in $databases) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use tempdb | |
go | |
drop table if exists dbo.City; | |
drop table if exists dbo.Country; | |
drop table if exists dbo.Continent; | |
create table dbo.Continent | |
( | |
continent_id int not null primary key, |
NewerOlder