Skip to content

Instantly share code, notes, and snippets.

View hfleitas's full-sized avatar
👔
working

Hiram Fleitas hfleitas

👔
working
View GitHub Profile
@hfleitas
hfleitas / tryone.ipynb
Last active October 15, 2019 01:36
tryone.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hfleitas
hfleitas / Script1.sql
Last active October 15, 2019 01:56
Script1.sql
select database_id, name, physical_name, state_desc from sys.master_files where database_id <= 4;
@hfleitas
hfleitas / geoTraining
Last active November 1, 2022 17:22 — forked from cosh/geoTraining
#connect cluster('demo12.westus.kusto.windows.net').database('Datasets')
https://demo12.westus.kusto.windows.net
// 1. Count of events, ~165M
nyc_taxi
| count
// 2. Show random pickups
@hfleitas
hfleitas / IPv4-Any.kql
Created January 19, 2024 17:05
IPv4-Any.kql
#connect cluster('help').database('Samples')
let LocalNetworks=dynamic([
"0.0.0.0/0"
]);
let IPs=datatable(IP:string) [
"10.1.2.3",
"192.168.1.5",
"123.1.11.21",
"1.1.1.1"
@hfleitas
hfleitas / ADB1.kql
Created January 19, 2024 17:07
ADB1.kql
#connect cluster('mypersonalcluster').database('mydb')
// ingested blob by cloning repo & used oneclick
// this is a sample from git url
.drop table stores ifexists;
.create table stores (id:string, name:string, email:string, city:string, hq_address:string, phone_number:string)
.create table stores ingestion csv mapping 'stores_mapping' '[{"column":"id", "Properties":{"Ordinal":"0"}},{"column":"name", "Properties":{"Ordinal":"1"}},{"column":"email", "Properties":{"Ordinal":"2"}},{"column":"city", "Properties":{"Ordinal":"3"}},{"column":"hq_address", "Properties":{"Ordinal":"4"}},{"column":"phone_number", "Properties":{"Ordinal":"5"}}]'
@hfleitas
hfleitas / GeoTraining.kql
Created January 19, 2024 17:08
GeoTraining.kql
// geotraining
#connect cluster('demo12.westus').database('Datasets')
// 1. Count of events, ~165M
nyc_taxi
| count
// 2. Show random pickups
@hfleitas
hfleitas / AADay1.kql
Created January 19, 2024 17:29
AADay1.kql
https://github.com/Azure/ADX-in-a-Day-Lab2
// Create table command
////////////////////////////////////////////////////////////
.create table ['Logistics'] (['deviceId']:string, ['messageSource']:string, ['telemetry']:dynamic, ['schema']:string, ['enrichments']:dynamic, ['templateId']:string, ['applicationId']:guid, ['enqueuedTime']:datetime, ['messageProperties']:dynamic, ['NumOfTagsCalculated']:int, ['Shock']:real, ['Temp']:real, ['TransportationMode']:string, ['Status']:string, ['Location_alt']:real, ['Location_lon']:real, ['Location_lat']:real)
// Create mapping command
////////////////////////////////////////////////////////////
.create table ['Logistics'] ingestion json mapping 'Logistics_mapping' '[{"column":"deviceId", "Properties":{"Path":"$[\'deviceId\']"}},{"column":"messageSource", "Properties":{"Path":"$[\'messageSource\']"}},{"column":"telemetry", "Properties":{"Path":"$[\'telemetry\']"}},{"column":"schema", "Properties":{"Path":"$[\'schema\']"}},{"column":"enrichments", "Properties":{"Path":
@hfleitas
hfleitas / AADay2.kql
Created January 19, 2024 17:40
AADay2.kql
// https://github.com/Azure/ADX-in-a-Day-Lab2
//5.2
.show database policies
.show table target details | project RetentionPolicy
.alter table target policy retention
```
@hfleitas
hfleitas / Updates.kql
Last active February 15, 2024 01:57
Updates.kql
// How to update data, try on https://aka.ms/adx.free.
// 1. sample table
.drop table MyTable ifexists
.set MyTable <|
datatable (id:int, fname:string, lname:string, age:int) [
01,'John','Doe',21,
02,'Jim','Brown',23
]
@hfleitas
hfleitas / Trender.kql
Created January 19, 2024 17:41
Trender.kql
// https://aka.ms/kusto.trender
#connect cluster('kvc43f0ee6600e24ef2b0e.southcentralus').database('Trender')
.show database Trender principals
.add database Trender viewers ('aadapp=aa7e9f10-1035-4684-b10a-097bb4948f95') 'kustotrender1appreg'
.add database Trender viewers ('aadapp=b5f3b2a2-0ec3-4c9d-adfd-447e528f24ac') 'Kusto Trender Sample App'