microsoft / jupyter-Kqlmagic

Extension (Magic) to Jupyter notebook and Jupyter lab, that enable notebook experience working with Kusto, ApplicationInsights, and LogAnalytics data.
Other
85 stars 31 forks source link

Cannot map connection string #75

Closed seank-com closed 3 years ago

seank-com commented 3 years ago

Kusto quick start does not provide a way to map my connection string to Kqlmagic.

Using Azure Data Explorer or Kusto.Explorer I connect to my cluster using a connection string with the following parts

Data Source=https://foobar.westeurope.kusto.windows.net:443;Initial Catalog=NetDefaultDB;AAD Federated Security=True;Authority Id=BIGLONG0-GUID-WITH-LOTS-ONUMBERYBITS

While I can guess what the database name might be from Kusto.Explorer, nothing hints at how to map the rest of the values.

I tried the following

%kql azure_data-Explorer://code;cluster='foobar.westeurope';database='dbname';tenant='BIGLONG0-GUID-WITH-LOTS-ONUMBERYBITS'

but after copying the device code and logging in I received the following error

FileNotFoundError: [Errno 2] No such file or directory: '/mnt/c/repos/log-tools/kqlmagic/temp_files/7786fe28-07e9-4b53-a830-c8ff435900e5/_dbname_at_foobar_westeurope_schema.html'
mbnshtck commented 3 years ago

pls provide me more details: if you run latest version of Kqlmagic 0.1.114.post2, after you get the error execute: %kql --bugreport and submit it to github

seank-com commented 3 years ago

I don't know what changed but I repeated the following in a notebook in VSCode and it worked

import sys
!{sys.executable} -m pip install Kqlmagic --no-cache-dir --upgrade
import sys
!{sys.executable} -m pip list
%reload_ext Kqlmagic
%kql azure_data-Explorer://code;cluster='foobar.westeurope';database='dbname';tenant='guid from Authority Id'
%%kql
Dependencies
| where Tag == "2AA849A4-866A-40CE-AEE8-948543EC39CA"
| where Timestamp > ago(48h)
| where DependencyData contains "/api/ExtensionHostManager/Execute/"
| extend ServiceName = extract("fabric:/VehicleCommandProcessor/(.+)", 1, tostring(Properties["ServiceName"]))
| where ServiceName == "TelemetryProcessor"
| project Success
| summarize Total=count() by Success