<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Writing to KQL db from notebook - Error in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4055660#M3207</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/681676"&gt;@VenDaFabricator&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that you have gotten a solution. Could you please mark the helpful post as Answered?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will help the others in the community find the solution easily if they face the same problem as yours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jul 2024 07:09:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-07-23T07:09:48Z</dc:date>
    <item>
      <title>Writing to KQL db from notebook - Error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4050039#M3144</link>
      <description>&lt;P&gt;Am following this link =&amp;gt;&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/fabric/real-time-intelligence/notebooks" target="_blank" rel="noopener"&gt;Use Fabric notebooks with data from a KQL database - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&amp;nbsp;to write directly from notebook to KQL db, but gettting below error;&lt;BR /&gt;&lt;BR /&gt;&lt;U&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Py4JJavaError&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/U&gt;&lt;SPAN&gt;: An error occurred while calling o4856.save. : kusto_connector_shaded.com.microsoft.azure.kusto.data.exceptions.DataServiceException: IOException when trying to retrieve cluster metadata:xxxxxxxx.kusto.windows.net&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my code:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from pyspark.sql import SparkSession
from pyspark.sql.functions import col, lit, round
from datetime import datetime

# Welcome to your new notebook
# Type here in the cell editor to add code!
# The Kusto cluster uri to write the data. The query Uri is of the form https://&amp;lt;&amp;gt;.kusto.data.microsoft.com 
kustoUri = "https://xxxxxx.kusto.data.microsoft.com"
# The database to write the data
database = "BRDS"
# The table to write the data 
table    = "Metrics"
# The access credentials for the write
accessToken = mssparkutils.credentials.getToken(kustoUri)
print(accessToken)
# Generate a range of 5 rows with Id's 5 to 9
data = spark.range(5, 10).withColumnRenamed("id", "Id")

# Add columns for ProcessName, CpuUsage, MemoryUsage, and Timestamp
data = data.withColumn("ProcessName", lit("Process_") + col("Id").cast("string")) \
           .withColumn("CpuUsage", round(lit(10.0) * col("Id") / 10, 2)) \
           .withColumn("MemoryUsage", round(lit(20.0) * col("Id") / 10, 2)) \
           .withColumn("Timestamp", lit(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
data.show()
# Write data to a Kusto table
data.write.\
    format("com.microsoft.kusto.spark.synapse.datasource").\
    option("kustoCluster",kustoUri).\
    option("kustoDatabase",database).\
    option("kustoTable", table).\
    option("accessToken", accessToken ).\
    option("tableCreateOptions", "CreateIfNotExist").mode("Append").save()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any clues!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 07:19:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4050039#M3144</guid>
      <dc:creator>VenDaFabricator</dc:creator>
      <dc:date>2024-07-19T07:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to KQL db from notebook - Error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4050366#M3150</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/681676"&gt;@VenDaFabricator&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error message indicates a problem retrieving cluster metadata from the Kusto database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider the following to resolve the problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There seems to be a problem with your kustoUri:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vhuijieymsft_0-1721379817034.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1135206i5EFC45371D401EEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vhuijieymsft_0-1721379817034.png" alt="vhuijieymsft_0-1721379817034.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After checking this, please verify that the access token was retrieved correctly and is valid. You have done a good job. this statement prints the token to ensure that it is not empty or expired.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vhuijieymsft_1-1721379817034.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1135205iB8DC84D298677F0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vhuijieymsft_1-1721379817034.png" alt="vhuijieymsft_1-1721379817034.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 09:03:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4050366#M3150</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-19T09:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to KQL db from notebook - Error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4051450#M3165</link>
      <description>&lt;P&gt;HI Yang,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, there is no issue with URI, i changed it to 'xxxx' while posting in the forum, actual uri in code is from KQL db in Fabric, which was copied from (see below)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VenDaFabricator_1-1721431666961.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1135523i528D43D6A49831E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VenDaFabricator_1-1721431666961.png" alt="VenDaFabricator_1-1721431666961.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;other thing is when you copy url from above:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;clusteruri is "https:&amp;lt;KQLdatabaseURI&amp;gt;&lt;/SPAN&gt;&lt;STRONG&gt;z1.kusto.fabric.microsoft.com&lt;/STRONG&gt;&lt;SPAN&gt;", whereas the codebase (from MS) say's&amp;nbsp; to specify clusteruri as "https://&amp;lt;yourKQLdatabaseURI&amp;gt;&lt;/SPAN&gt;&lt;STRONG&gt;.z0.kusto.data.microsoft.com&lt;/STRONG&gt;&lt;SPAN&gt;", but the error message says it can't find "&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;KQLdatabaseURI&amp;gt;&lt;/SPAN&gt;&lt;STRONG&gt;.z1.kusto.windows.net&lt;/STRONG&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 23:37:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4051450#M3165</guid>
      <dc:creator>VenDaFabricator</dc:creator>
      <dc:date>2024-07-19T23:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to KQL db from notebook - Error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4053381#M3188</link>
      <description>&lt;P&gt;Instead of using Ingest URI, when i used Query URI&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/" target="_blank"&gt;https://&amp;lt;clusterid&amp;gt;kusto.fabric.microsoft.com&lt;/A&gt;&amp;nbsp;and it works.&amp;nbsp; Documentation is bit mis-leading.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VenDaFabricator_0-1721634681366.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1136241iB85F511E7B3D6E31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VenDaFabricator_0-1721634681366.png" alt="VenDaFabricator_0-1721634681366.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 07:51:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4053381#M3188</guid>
      <dc:creator>VenDaFabricator</dc:creator>
      <dc:date>2024-07-22T07:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to KQL db from notebook - Error</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4055660#M3207</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/681676"&gt;@VenDaFabricator&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that you have gotten a solution. Could you please mark the helpful post as Answered?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will help the others in the community find the solution easily if they face the same problem as yours.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 07:09:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Writing-to-KQL-db-from-notebook-Error/m-p/4055660#M3207</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-23T07:09:48Z</dc:date>
    </item>
  </channel>
</rss>

