# 🪄KQLMagic Is Now In Fabric Runtime 1.3

I wrote a [blog last year](https://fabric.guru/building-insightful-analytical-solutions-using-kqlmagic) on the usefulness of [KQLMagic](https://learn.microsoft.com/en-us/azure-data-studio/notebooks/notebooks-kqlmagic) command in Fabric notebook and [made a suggestion](https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=0226c783-6217-ee11-a81c-000d3a0ec312) that it should be part of the default runtime. Well, guess what - it’s now in the Fabric Runtime 1.3. No installation necessary and authentication is handled automatically.

Here is how you use it:

* Load the extension : `%reload_ext Kqlmagic` in a Fabric notebook.
    
* Create a Python cell to define Kusto URI & database name:
    
    ```python
    kusto_uri = 'https://xxxx.xx.kusto.fabric.microsoft.com'
    kusto_dbname = '<eventhouse_name>'
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1730235279402/ff65b679-09cc-476e-b63b-b68d01a0b2a9.png align="center")
    
* Create connection to the Eventhouse:
    
    * ```python
        %kql kusto://code;cluster=kusto_uri;database=kusto_dbname
        ```
        
* Query using Kqlmagic:
    
    * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1730138069909/e5bd3d2f-2358-4d23-a865-da74433db19c.png align="center")
        
        The result is a Kqlrowset and not a pandas dataframe. To create a pandas dataframe, you can first assign the result to a variable and then convert to a dataframe which then can be used with any other data from Onelake.
        
    * ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1730236091334/f434a493-5f3b-43c2-aa48-a0de33a95a5f.png align="center")
        
    * This is great for ad-hoc analysis and exploration. If your result set is a large, I recommend using the Kusto spark connector instead as [I showed here](https://fabric.guru/building-insightful-analytical-solutions-using-kqlmagic#heading-using-spark).
        
    * Configure Kqlmagic as required: Use `%configure Kqlmagic` to see the available configuration options. e.g. To limit the number of rows displayed, use `Kqlmagic.display_limit`. In the below example, the display is limited to 50 rows.
        
        ```python
        %config Kqlmagic.display_limit=50
        ```
        
        If you have long, multi-line queries, use `%%kql` cell magic instead.
        
    
    <div data-node-type="callout">
    <div data-node-type="callout-emoji">💡</div>
    <div data-node-type="callout-text">Hopefully in the future there will be a KQL kernel in the notebook to connect to an Evenhouse and execute KQL queries. Azure Data Studio notebook <a target="_self" rel="noopener noreferrer nofollow" href="https://learn.microsoft.com/en-us/azure-data-studio/notebooks/notebooks-kusto-kernel" style="pointer-events: none">already supports</a> a KQL kernel.</div>
    </div>
