<?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: Load multiple delta tables at once from Sql server in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/load-multiple-delta-tables-at-once-from-sql-server/m-p/37860#M26485</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/84053"&gt;@Data4&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To enable parallel read and write operations, the ThreadPool functionality can be leveraged. This process involves specifying a list of tables that need to be read, creating a method for reading these tables from the JDBC source and saving them in DELTA format, and subsequently employing the ThreadPool for parallel processing.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Prepare the List of Tables for Reading: Before proceeding with parallel read and write operations, you must first assemble a list of tables to be read. The list should be defined as follows:&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;PRE&gt;&amp;nbsp;iterationList = [&lt;SPAN class=""&gt;"table1", "table2", "table3"]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;In this step, a method named "transformation" will be implemented to handle the reading of tables from the JDBC source and saving them in DELTA format. The transformation method will be structured as follows:&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;PRE&gt;&lt;SPAN class=""&gt;def transformation(table): &lt;BR /&gt;   print(f"Thread for: {table} starts") &lt;BR /&gt;   spark.read.format("jdbc").load(table).write.saveAsTable(table) &lt;BR /&gt;   print(f"Thread for: {table} completed")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;To achieve parallel processing, the ThreadPool with an appropriate number of threads can be initialized. In this example, we will create a ThreadPool with 3 threads. The "map" function of the ThreadPool is then employed to execute the "transformation" method in parallel for each table in the "iterationList".&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;from multiprocessing.pool &lt;BR /&gt;import ThreadPool &lt;BR /&gt;&lt;BR /&gt;# Initialize ThreadPool with 3 threads &lt;BR /&gt;pool = ThreadPool(3) &lt;BR /&gt;&lt;BR /&gt;# Execute the transformation method in parallel for each table in iterationList &lt;BR /&gt;pool.map(transformation, iterationList)&lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 18 Jul 2023 11:50:39 GMT</pubDate>
    <dc:creator>Tharun-Kumar</dc:creator>
    <dc:date>2023-07-18T11:50:39Z</dc:date>
    <item>
      <title>Load multiple delta tables at once from Sql server</title>
      <link>https://community.databricks.com/t5/data-engineering/load-multiple-delta-tables-at-once-from-sql-server/m-p/36343#M26101</link>
      <description>&lt;P&gt;What’s the best way to efficiently move multiple sql tables in parallel into delta tables&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 20:33:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/load-multiple-delta-tables-at-once-from-sql-server/m-p/36343#M26101</guid>
      <dc:creator>Data4</dc:creator>
      <dc:date>2023-06-29T20:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Load multiple delta tables at once from Sql server</title>
      <link>https://community.databricks.com/t5/data-engineering/load-multiple-delta-tables-at-once-from-sql-server/m-p/37860#M26485</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/84053"&gt;@Data4&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To enable parallel read and write operations, the ThreadPool functionality can be leveraged. This process involves specifying a list of tables that need to be read, creating a method for reading these tables from the JDBC source and saving them in DELTA format, and subsequently employing the ThreadPool for parallel processing.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Prepare the List of Tables for Reading: Before proceeding with parallel read and write operations, you must first assemble a list of tables to be read. The list should be defined as follows:&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;PRE&gt;&amp;nbsp;iterationList = [&lt;SPAN class=""&gt;"table1", "table2", "table3"]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;In this step, a method named "transformation" will be implemented to handle the reading of tables from the JDBC source and saving them in DELTA format. The transformation method will be structured as follows:&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;PRE&gt;&lt;SPAN class=""&gt;def transformation(table): &lt;BR /&gt;   print(f"Thread for: {table} starts") &lt;BR /&gt;   spark.read.format("jdbc").load(table).write.saveAsTable(table) &lt;BR /&gt;   print(f"Thread for: {table} completed")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;To achieve parallel processing, the ThreadPool with an appropriate number of threads can be initialized. In this example, we will create a ThreadPool with 3 threads. The "map" function of the ThreadPool is then employed to execute the "transformation" method in parallel for each table in the "iterationList".&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;from multiprocessing.pool &lt;BR /&gt;import ThreadPool &lt;BR /&gt;&lt;BR /&gt;# Initialize ThreadPool with 3 threads &lt;BR /&gt;pool = ThreadPool(3) &lt;BR /&gt;&lt;BR /&gt;# Execute the transformation method in parallel for each table in iterationList &lt;BR /&gt;pool.map(transformation, iterationList)&lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Jul 2023 11:50:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/load-multiple-delta-tables-at-once-from-sql-server/m-p/37860#M26485</guid>
      <dc:creator>Tharun-Kumar</dc:creator>
      <dc:date>2023-07-18T11:50:39Z</dc:date>
    </item>
  </channel>
</rss>

