<?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: Azure Databrick SQL bulk insert to AZ SQL in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21598#M14741</link>
    <description>&lt;P&gt;I would avoid repartition as it is additionally not necessary cost, and you usually already have data partitioned.  (check that with df.rdd.getNumParitions() ). &lt;/P&gt;&lt;P&gt;2.2 GB is not so extensive so I would go with a basic machine, one driver, and auto-scaling between 1 to 2 workers.&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2022 14:34:08 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2022-05-03T14:34:08Z</dc:date>
    <item>
      <title>Azure Databrick SQL bulk insert to AZ SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21597#M14740</link>
      <description>&lt;P&gt;Env: Azure Databrick :&lt;/P&gt;&lt;P&gt;version : 9.1 LTS (includes Apache Spark 3.1.2, Scala 2.12)&lt;/P&gt;&lt;P&gt;Work Type : 56 GB Memory 2-8 node ( standard D13_V2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No of rows : 2470350 and 115 Column &lt;/P&gt;&lt;P&gt;Size : 2.2 GB&lt;/P&gt;&lt;P&gt;Time taken approx. 9 min &lt;/P&gt;&lt;P&gt;Python Code .&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;B&gt;What will be best approach for bulk load ?&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;&lt;B&gt;What is best partition size you consider?&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;&lt;B&gt;optimal batch size ?&lt;/B&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;df_gl_repartitioned = f5.repartition(10)&amp;nbsp;&lt;/P&gt;&lt;P&gt;write_data_to_db(df_gl_repartitioned,"&lt;A href="https://myserver.database.windows.net" alt="https://myserver.database.windows.net" target="_blank"&gt;myserver.database.windows.net&lt;/A&gt;", "&lt;A href="https://XXXX.onmicrosoft.com" alt="https://XXXX.onmicrosoft.com" target="_blank"&gt;XXXX.onmicrosoft.com&lt;/A&gt;", "DBNAME" , "dbo.stag",&amp;nbsp;dbutils,"1004857" ,"overwrite")&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;try:
        df.write.format("com.microsoft.sqlserver.jdbc.spark").mode(mode).option("url", f"jdbc:sqlserver://{server}").option("databaseName", database).option("dbtable", dbtable).option("accessToken", access_token).option("encrypt", "true").option("hostNameInCertificate", "*.database.windows.net").option("schemaCheckEnabled", "false").save()
        print(f"Successfully wrote df to {dbtable} ")
except ValueError as error:
        print(error)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I check below link &lt;/P&gt;&lt;P&gt;&lt;A href="https://techcommunity.microsoft.com/t5/azure-sql-blog/considerations-of-data-partitioning-on-spark-during-data-loading/ba-p/2184461" alt="https://techcommunity.microsoft.com/t5/azure-sql-blog/considerations-of-data-partitioning-on-spark-during-data-loading/ba-p/2184461" target="_blank"&gt;https://techcommunity.microsoft.com/t5/azure-sql-blog/considerations-of-data-partitioning-on-spark-during-data-loading/ba-p/2184461&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://techcommunity.microsoft.com/t5/datacat/data-loading-performance-considerations-with-clustered/ba-p/305223" alt="https://techcommunity.microsoft.com/t5/datacat/data-loading-performance-considerations-with-clustered/ba-p/305223" target="_blank"&gt;https://techcommunity.microsoft.com/t5/datacat/data-loading-performance-considerations-with-clustered/ba-p/305223&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 18:35:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21597#M14740</guid>
      <dc:creator>AvijitDey</dc:creator>
      <dc:date>2022-05-02T18:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Databrick SQL bulk insert to AZ SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21598#M14741</link>
      <description>&lt;P&gt;I would avoid repartition as it is additionally not necessary cost, and you usually already have data partitioned.  (check that with df.rdd.getNumParitions() ). &lt;/P&gt;&lt;P&gt;2.2 GB is not so extensive so I would go with a basic machine, one driver, and auto-scaling between 1 to 2 workers.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 14:34:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21598#M14741</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-05-03T14:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Databrick SQL bulk insert to AZ SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21599#M14742</link>
      <description>&lt;P&gt;Thanks for your response .&lt;/P&gt;&lt;P&gt;What the time line you expect to insert 2.2 GB data into SQL DB ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any time line ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now with repartition 5-10 - Time taken 9 min &lt;/P&gt;&lt;P&gt;With out repartition - Time took&amp;nbsp;13.16 minutes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking Process less than 9 min &lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 15:40:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21599#M14742</guid>
      <dc:creator>AvijitDey</dc:creator>
      <dc:date>2022-05-03T15:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Azure Databrick SQL bulk insert to AZ SQL</title>
      <link>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21600#M14743</link>
      <description>&lt;P&gt;Any further suggestion &lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 13:59:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/azure-databrick-sql-bulk-insert-to-az-sql/m-p/21600#M14743</guid>
      <dc:creator>AvijitDey</dc:creator>
      <dc:date>2022-05-09T13:59:22Z</dc:date>
    </item>
  </channel>
</rss>

