<?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 Cosmos Spark Connector keep loading in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/cosmos-spark-connector-keep-loading/m-p/125559#M47475</link>
    <description>&lt;P&gt;I am try to connect to cosmos using spark cosmos connector following this instruction:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/tutorial-spark-connector?pivots=programming-language-python" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/tutorial-spark-connector?pivots=programming-language-python&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The problem is the all spark cosmos operation keep loading and never populate any result. And I could confirm that this problem is not related to incorrect key, since I can use the same key query data from Cosmos using cosmos client python SDK.&lt;/P&gt;&lt;P&gt;Note: All the cloud resource including databricks workspace and cosmos are in private VNET that peers together.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cfg = {
  "spark.cosmos.accountEndpoint" : cosmosEndpoint,
  "spark.cosmos.accountKey" : cosmosMasterKey,
  "spark.cosmos.database" : cosmosDatabaseName,
  "spark.cosmos.container" : cosmosContainerName
}

df = spark.read.format("cosmos.oltp").options(**cfg)\
 .option("spark.cosmos.read.inferSchema.enabled", "true")\
 .load()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my cluster config:&lt;/P&gt;&lt;P&gt;- Databrick runtime:&amp;nbsp;13.3 LTS (includes Apache Spark 3.4.1, Scala 2.12)&lt;/P&gt;&lt;P&gt;- Access mode:&amp;nbsp;[Legacy] Single user standard (I try using other access mode already but not working)&lt;/P&gt;&lt;P&gt;- Installed libs:&amp;nbsp;&lt;A target="_blank"&gt;com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12:4.37.2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jul 2025 09:34:11 GMT</pubDate>
    <dc:creator>sopon</dc:creator>
    <dc:date>2025-07-17T09:34:11Z</dc:date>
    <item>
      <title>Cosmos Spark Connector keep loading</title>
      <link>https://community.databricks.com/t5/data-engineering/cosmos-spark-connector-keep-loading/m-p/125559#M47475</link>
      <description>&lt;P&gt;I am try to connect to cosmos using spark cosmos connector following this instruction:&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/tutorial-spark-connector?pivots=programming-language-python" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/tutorial-spark-connector?pivots=programming-language-python&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The problem is the all spark cosmos operation keep loading and never populate any result. And I could confirm that this problem is not related to incorrect key, since I can use the same key query data from Cosmos using cosmos client python SDK.&lt;/P&gt;&lt;P&gt;Note: All the cloud resource including databricks workspace and cosmos are in private VNET that peers together.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cfg = {
  "spark.cosmos.accountEndpoint" : cosmosEndpoint,
  "spark.cosmos.accountKey" : cosmosMasterKey,
  "spark.cosmos.database" : cosmosDatabaseName,
  "spark.cosmos.container" : cosmosContainerName
}

df = spark.read.format("cosmos.oltp").options(**cfg)\
 .option("spark.cosmos.read.inferSchema.enabled", "true")\
 .load()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my cluster config:&lt;/P&gt;&lt;P&gt;- Databrick runtime:&amp;nbsp;13.3 LTS (includes Apache Spark 3.4.1, Scala 2.12)&lt;/P&gt;&lt;P&gt;- Access mode:&amp;nbsp;[Legacy] Single user standard (I try using other access mode already but not working)&lt;/P&gt;&lt;P&gt;- Installed libs:&amp;nbsp;&lt;A target="_blank"&gt;com.azure.cosmos.spark:azure-cosmos-spark_3-4_2-12:4.37.2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 09:34:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cosmos-spark-connector-keep-loading/m-p/125559#M47475</guid>
      <dc:creator>sopon</dc:creator>
      <dc:date>2025-07-17T09:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cosmos Spark Connector keep loading</title>
      <link>https://community.databricks.com/t5/data-engineering/cosmos-spark-connector-keep-loading/m-p/125569#M47484</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/175537"&gt;@sopon&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Could you check drivers logs? Maybe we will find some useful information that will help us pinpoint root cause?&lt;BR /&gt;Also, you can check if you can resolve private endpoint of Comos DB from databricks workspace&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;$sh
telnet comos_db_fqdn 433&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 17 Jul 2025 11:33:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cosmos-spark-connector-keep-loading/m-p/125569#M47484</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-07-17T11:33:34Z</dc:date>
    </item>
  </channel>
</rss>

