<?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: Can we use spark-stream to read/write data from mysql? I can't find an example. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34770#M25489</link>
    <description>&lt;P&gt;Regarding writing (sink) is possible without problem via foreachBatch .&lt;/P&gt;&lt;P&gt;I use it in production - stream autoload csvs from data lake and writing foreachBatch to SQL (inside foreachBatch function you have temporary dataframe with records and just use write to any jdbc or odbc).&lt;/P&gt;&lt;P&gt;Here is more deltails:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/spark/latest/structured-streaming/foreach.html" target="test_blank"&gt;https://docs.databricks.com/spark/latest/structured-streaming/foreach.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading stream from mysql is not the best architecture and officialy is not possible. Theoretically you could create custom reciver but better idea is just put what you save to mysql to kafka or some other broker/queue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Easy way around (but it make sense only if you have less new records than 1 per second) is to use Azure logic apps - new record in Mysql is trigger and append data to Event hub which is then read as a stream by Databricks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 20 Nov 2021 16:01:52 GMT</pubDate>
    <dc:creator>Hubert-Dudek</dc:creator>
    <dc:date>2021-11-20T16:01:52Z</dc:date>
    <item>
      <title>Can we use spark-stream to read/write data from mysql? I can't find an example.</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34767#M25486</link>
      <description>&lt;P&gt;If someone can link me an example where stream is used to read or write to mysql please do.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 08:08:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34767#M25486</guid>
      <dc:creator>sarvesh</dc:creator>
      <dc:date>2021-11-19T08:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can we use spark-stream to read/write data from mysql? I can't find an example.</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34769#M25488</link>
      <description>&lt;P&gt;Thank you for taking sometime out to reply, as of now i have not found a structured way.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 11:04:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34769#M25488</guid>
      <dc:creator>sarvesh</dc:creator>
      <dc:date>2021-11-19T11:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can we use spark-stream to read/write data from mysql? I can't find an example.</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34770#M25489</link>
      <description>&lt;P&gt;Regarding writing (sink) is possible without problem via foreachBatch .&lt;/P&gt;&lt;P&gt;I use it in production - stream autoload csvs from data lake and writing foreachBatch to SQL (inside foreachBatch function you have temporary dataframe with records and just use write to any jdbc or odbc).&lt;/P&gt;&lt;P&gt;Here is more deltails:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/spark/latest/structured-streaming/foreach.html" target="test_blank"&gt;https://docs.databricks.com/spark/latest/structured-streaming/foreach.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading stream from mysql is not the best architecture and officialy is not possible. Theoretically you could create custom reciver but better idea is just put what you save to mysql to kafka or some other broker/queue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Easy way around (but it make sense only if you have less new records than 1 per second) is to use Azure logic apps - new record in Mysql is trigger and append data to Event hub which is then read as a stream by Databricks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Nov 2021 16:01:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34770#M25489</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2021-11-20T16:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can we use spark-stream to read/write data from mysql? I can't find an example.</title>
      <link>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34771#M25490</link>
      <description>&lt;P&gt;Great example of your use case @Hubert Dudek​&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 20:02:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/can-we-use-spark-stream-to-read-write-data-from-mysql-i-can-t/m-p/34771#M25490</guid>
      <dc:creator>jose_gonzalez</dc:creator>
      <dc:date>2021-11-22T20:02:08Z</dc:date>
    </item>
  </channel>
</rss>

