Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When query against Log Analytics workspaces, dynamic are not converted to list #491

Open
yssrku opened this issue Aug 9, 2023 · 2 comments
Assignees

Comments

@yssrku
Copy link

yssrku commented Aug 9, 2023

Code Sample, a copy-pastable example if possible

from azure.kusto.data import KustoClient, KustoConnectionStringBuilder


kcsb = KustoConnectionStringBuilder.with_aad_application_key_authentication(
    "https://ade.loganalytics.io/subscriptions/.../resourcegroups/.../providers/microsoft.operationalinsights/workspaces/...",
    "...",
    "...",
    "..."
)
client = KustoClient(kcsb)

results = client.execute(
    "...",
    "print x = dynamic(['a', 'b'])"
)

print(type(results.primary_results[0][0]['x']))

Problem description

The data type should be a list, just like when querying against ADX.
Instead, I got a str.

This is also inconsistent with the ADX Web UI.

If query related, does it happen on other platforms (Kusto Web UI, Kusto Explorer)?

No

Output of pip freeze

attrs==23.1.0 autoflake==2.2.0 autoimport==1.3.3 autopep8==2.0.2 azure-core==1.28.0 azure-functions==1.15.0 azure-identity==1.13.0 azure-kusto-data==4.2.0 azure-kusto-ingest==4.2.0 azure-storage-blob==12.17.0 azure-storage-queue==12.6.0 beautifulsoup4==4.12.2 certifi==2023.7.22 cffi==1.15.1 charset-normalizer==3.2.0 click==8.1.6 cryptography==41.0.2 easydict==1.10 h11==0.14.0 idna==3.4 ijson==3.2.3 isodate==0.6.1 libtaxii==1.1.119 lxml==4.9.3 maison==1.4.0 maxminddb==2.4.0 mintotp==0.3.0 msal==1.23.0 msal-extensions==1.0.0 netaddr==0.8.0 outcome==1.2.0 pandas==2.0.3 portalocker==2.7.0 psycopg==3.1.9 psycopg-pool==3.1.7 pycodestyle==2.11.0 pycparser==2.21 pydantic==1.10.12 pyflakes==3.1.0 pyhumps==3.8.0 PyJWT==2.8.0 PyMuPDF==1.22.5 pyprojroot==0.3.0 PySocks==1.7.1 python-dateutil==2.8.2 pytz==2023.3 PyYAML==6.0.1 requests==2.31.0 selenium==4.10.0 sh==2.0.4 six==1.16.0 sniffio==1.3.0 sortedcontainers==2.4.0 soupsieve==2.4.1 taxii2-client==2.3.0 tenacity==8.2.2 toml==0.10.2 trio==0.22.2 trio-websocket==0.10.3 typing_extensions==4.7.1 tzdata==2023.3 undetected-chromedriver==3.5.0 urllib3==2.0.4 websockets==11.0.3 wsproto==1.2.0 xattr==0.10.1 xdg==6.0.0
@yogilad
Copy link
Contributor

yogilad commented Aug 20, 2023

We'll consider if an API is missing here.
In the meantime you can do one of the following:

  1. Change you line to json.loads(results.primary_results[0][0]['x'])
  2. Add a convertor to automatically create json object like this
    KustoResultRow.conversion_funcs["dynamic"] = json.loads

@yogilad
Copy link
Contributor

yogilad commented Sep 3, 2023

Decided to add docs on advanced parsing handling.

@yogilad yogilad self-assigned this Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants