This file contains 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
.set-or-replace OccupancyDetection <| cluster('help').database('Samples').OccupancyDetection | |
.drop table ML_Models ifexists ; | |
.set ML_Models <| datatable(name:string, timestamp:datetime, model:string) [ | |
'Occupancy', datetime(now), '800363736b6c6561726e2e6c696e6561725f6d6f64656c2e6c6f6769737469630a4c6f67697374696352656772657373696f6e0a7100298171017d710228580700000070656e616c7479710358020000006c32710458040000006475616c7105895803000000746f6c7106473f1a36e2eb1c432d5801000000437107473ff0000000000000580d0000006669745f696e746572636570747108885811000000696e746572636570745f7363616c696e6771094b01580c000000636c6173735f776569676874710a4e580c00000072616e646f6d5f7374617465710b4e5806000000736f6c766572710c58090000006c69626c696e656172710d58080000006d61785f69746572710e4b64580b0000006d756c74695f636c617373710f58030000006f767271105807000000766572626f736571114b00580a0000007761726d5f737461727471128958060000006e5f6a6f627371134b015808000000636c61737365735f7114636e756d70792e636f72652e6d756c746961727261790a5f7265636f6e7374727563740a71 |
This file contains 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
//has_any | |
#connect @help/Samples | |
// let _state=StormEvents | distinct (State); | |
let _state=""; | |
StormEvents | |
| where State has_any (_state) | |
| count |
This file contains 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
#connect cluster('trd-rjwm9jc98jph5mdjqy.z6.kusto.data.microsoft.com').database('RTAFlightStreamer') | |
// https://www.youtube.com/watch?v=ABJ1gjXAK54 | |
// https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/geospatial-grid-systems | |
#connect @help/Samples | |
StormEvents | |
| take 100 | |
| project BeginLon, BeginLat |
This file contains 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
// Ingest from Query | |
//cross cluster query-ingest | |
.set-or-replace dxpooltable1 <| cluster('help').database('Samples').demo_make_series1 |
This file contains 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
#connect cluster("demo12.westus").database("CDN") | |
//Sample records | |
cdn_logs | |
| sample 10 | |
//simple aggregation by various dimenssions | |
cdn_logs | |
| summarize count() by ClientCountryCode//, ChannelId, EdgeServerDatacenter | |
| top 5 by count_ |
This file contains 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
#connect cluster('demo12.westus.kusto.windows.net').database('sqlbi') | |
.show tables details | |
| where TableName startswith "BIAzure" | |
| summarize sum(TotalOriginalSize), sum(TotalExtentSize) by TableName | |
| extend CompressionRatio = sum_TotalOriginalSize/sum_TotalExtentSize | |
// ~30TB of data in 3 different tables (traces and perormance counters) | |
// Data is compressed and indexed (x10.2 for traces, x21-34 for performance counters) | |
// Compressed data and index are persisted to blob and cached on SSD |
This file contains 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
#connect cluster('demo12.westus.kusto.windows.net').database('GitHub') | |
// Basics | |
// 1.2 Billions records | |
GithubEvent | |
| count | |
// Sample | |
GithubEvent | |
| take 10 |
This file contains 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
//txt on svrs, common dbo gen log, atlasbridge, bogaboo proc info, | |
#connect cluster('demo12.westus.kusto.windows.net').database('sqlbi') | |
print ("Welcome") | |
print now() | |
// 8 machines in Azure | |
.show cluster |
This file contains 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
// 1️⃣🐝🏎️🤿 (1BRC in Kusto 🏁 10.38ms) | |
// ref: https://github.com/gunnarmorling/1brc | |
.execute database script <| | |
.create-merge table 1brc (station:string, measurement:real) | |
.create-or-alter table 1brc ingestion csv mapping '1brc_mapping' '[{"column":"station", "Properties":{"Ordinal":"0"}},{"column":"measurement", "Properties":{"Ordinal":"1"}}]' | |
.ingest async into table 1brc (@'https://iotmonitoringsa26915.blob.core.windows.net/1brc/splits/measurements_split_aa') with (format='scsv',ignoreSizeLimit=true,ingestionMappingReference='1brc_mapping',ingestionMappingType='csv') | |
.ingest async into table 1brc (@'https://iotmonitoringsa26915.blob.core.windows.net/1brc/splits/measurements_split_ab') with (format='scsv',ignoreSizeLimit=true,ingestionMappingReference='1brc_mapping',ingestionMappingType='csv') | |
.ingest async into table 1brc (@'https://iotmonitoringsa26915.blob.core.windows.net/1brc/splits/measurements_split_ac') with (format='scsv',ignoreSizeLimit=true,ingestionMappingReference='1brc_mapping',ingestionMappin |
This file contains 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
#connect cluster('help').database('Samples') | |
// 👈 We have automatically added the "Samples" database to your connection pane. | |
// It contains sample data sets that you can use to run KQL queries and get a "feel" for the language. | |
// 🏃♂️ You can run a query by placing the cursor anywhere on the query text and clicking the run button (or Shift + Enter). | |
// 📄 KQL overview https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/ | |
// 📃 Quick KQL reference guide can be found here https://docs.microsoft.com/en-us/azure/data-explorer/kql-quick-reference | |
// Start by browsing data in the StormEvents table, and view a small sample of records | |
// - Most queries start with a table name (in this case StormEvents that contains U.S weather data). |