<?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: sync delta table to Nosql in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129927#M48645</link>
    <description>&lt;P&gt;Its not a right way to use spark connector mongo directly. but want to ensure that sync of delta table and mongodb is the same. Someone best pratices to that&lt;/P&gt;</description>
    <pubDate>Wed, 27 Aug 2025 16:09:35 GMT</pubDate>
    <dc:creator>seefoods</dc:creator>
    <dc:date>2025-08-27T16:09:35Z</dc:date>
    <item>
      <title>sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129892#M48623</link>
      <description>&lt;P&gt;Hello Guys,&lt;BR /&gt;&lt;BR /&gt;Whats is best way to build sync process which sync data for two engine database like delta table and Nosql table ( Mongo) ?&lt;BR /&gt;&lt;BR /&gt;Thanx&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cordially,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 11:57:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129892#M48623</guid>
      <dc:creator>seefoods</dc:creator>
      <dc:date>2025-08-27T11:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129902#M48629</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65591"&gt;@seefoods&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Could you provide more deatils, i.e do you need some kind of one way sync? For example from Mongo -&amp;gt; Delta Table?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 13:05:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129902#M48629</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-27T13:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129908#M48632</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I need to write Mongo -&amp;gt; Delta table and Delta table -&amp;gt; to Mongo&lt;BR /&gt;Thanks&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 13:48:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129908#M48632</guid>
      <dc:creator>seefoods</dc:creator>
      <dc:date>2025-08-27T13:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129920#M48639</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65591"&gt;@seefoods&lt;/a&gt;&amp;nbsp;. One more question. Do you need sync in near real-time or once in a day is alright?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 15:17:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129920#M48639</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-27T15:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129922#M48640</link>
      <description>&lt;P&gt;I need once in a day&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 15:22:08 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129922#M48640</guid>
      <dc:creator>seefoods</dc:creator>
      <dc:date>2025-08-27T15:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129924#M48642</link>
      <description>&lt;P&gt;To write a Delta table to MongoDB, you'll need to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Read the Delta table using PySpark or Pandas.&lt;/LI&gt;&lt;LI&gt;Convert the data into a format MongoDB can accept (typically JSON or a dictionary).&lt;/LI&gt;&lt;LI&gt;Use a MongoDB client (like pymongo) to insert the data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Sample code:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pyspark.sql import SparkSession
from pymongo import MongoClient

# Step 1: Initialize Spark session
spark = SparkSession.builder \
    .appName("DeltaToMongo") \
    .config("spark.sql.extensions", "io.delta.sql.DeltaSparkSessionExtension") \
    .config("spark.sql.catalog.spark_catalog", "org.apache.spark.sql.delta.catalog.DeltaCatalog") \
    .getOrCreate()

# Step 2: Read Delta table
delta_df = spark.read.format("delta").load("/path/to/delta/table")

# Step 3: Convert to Pandas DataFrame
pandas_df = delta_df.toPandas()

# Step 4: Connect to MongoDB
client = MongoClient("mongodb://localhost:27017/")
db = client["your_database"]
collection = db["your_collection"]

# Step 5: Insert data into MongoDB
collection.insert_many(pandas_df.to_dict("records"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 15:59:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129924#M48642</guid>
      <dc:creator>nayan_wylde</dc:creator>
      <dc:date>2025-08-27T15:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129927#M48645</link>
      <description>&lt;P&gt;Its not a right way to use spark connector mongo directly. but want to ensure that sync of delta table and mongodb is the same. Someone best pratices to that&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 16:09:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129927#M48645</guid>
      <dc:creator>seefoods</dc:creator>
      <dc:date>2025-08-27T16:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129929#M48646</link>
      <description>&lt;P&gt;There is a mongo spark connector maven package.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;!-- ScriptorStartFragment --&gt;org.mongodb.spark:mongo-spark-connector_2.12:10.1.1(link: &lt;A href="https://mvnrepository.com/artifact/org.mongodb.spark/mongo-spark-connector_2.12/10.1.1)" target="_blank"&gt;https://mvnrepository.com/artifact/org.mongodb.spark/mongo-spark-connector_2.12/10.1.1)&lt;/A&gt;&lt;!-- ScriptorEndFragment --&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;spark.conf.set("spark.mongodb.write.connection.uri", "mongodb://&amp;lt;username&amp;gt;:&amp;lt;password&amp;gt;@&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/&amp;lt;database&amp;gt;")
spark.conf.set("spark.mongodb.write.database", "your_database")
spark.conf.set("spark.mongodb.write.collection", "your_collection")

##read table
delta_df = spark.table("your_database.your_table")

##write to mongo.
delta_df.write \
    .format("mongodb") \
    .mode("append") \
    .save()
&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Aug 2025 16:14:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129929#M48646</guid>
      <dc:creator>nayan_wylde</dc:creator>
      <dc:date>2025-08-27T16:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129930#M48647</link>
      <description>&lt;P&gt;i want to do the same thing but reversely &amp;lt;&amp;gt; read collection in order to update the delta table&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 16:18:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129930#M48647</guid>
      <dc:creator>seefoods</dc:creator>
      <dc:date>2025-08-27T16:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129933#M48649</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65591"&gt;@seefoods&lt;/a&gt;&amp;nbsp;, you can use Databricks to perform synchronization in both directions with the Spark MongoDB connector. This connector supports both streaming and batch modes.&lt;BR /&gt;The most straightforward approach would be to create a pipeline that, once a day, reads from MongoDB and writes the data to a Delta table.&lt;BR /&gt;Then, you would need to create a similar pipeline in the opposite direction, where once a day the pipeline reads from the Delta table and writes the data back to MongoDB.&lt;/P&gt;&lt;P&gt;But if you want, you can take a more ambitious approach. Since the connector supports streaming, you could set up a job that once in a day reads the changes applied to your MongoDB database.&lt;BR /&gt;Similarly, you can enable Change Data Feed (CDF) on your Delta table and use streaming to read only the changes applied there, then write those incremental updates back to your MongoDB collection.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For further reading - batch mode:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-read" target="_blank" rel="noopener"&gt;https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-read&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-write" target="_blank" rel="noopener"&gt;https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-write&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For further reading - streaming mode:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mongodb.com/docs/spark-connector/current/streaming-mode/streaming-read/#std-label-streaming-read-from-mongodb" target="_blank" rel="noopener"&gt;https://www.mongodb.com/docs/spark-connector/current/streaming-mode/streaming-read/#std-label-streaming-read-from-mongodb&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-write" target="_blank" rel="noopener"&gt;https://www.mongodb.com/docs/spark-connector/current/batch-mode/batch-write&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://contact-rajeshvinayagam.medium.com/mongodb-changestream-spark-delta-table-an-alliance-a70962133b95" target="_blank" rel="noopener"&gt;MongoDB ChangeStream &amp;amp; Spark Delta Table : An Alliance | by Rajesh Vinayagam | Medium&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 17:07:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129933#M48649</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-08-27T17:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: sync delta table to Nosql</title>
      <link>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129934#M48650</link>
      <description>&lt;P&gt;The other option I can think of is change streams. Here is a blogpost on it.&lt;/P&gt;&lt;P&gt;&lt;A href="https://contact-rajeshvinayagam.medium.com/mongodb-changestream-spark-delta-table-an-alliance-a70962133b95" target="_blank"&gt;https://contact-rajeshvinayagam.medium.com/mongodb-changestream-spark-delta-table-an-alliance-a70962133b95&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 17:00:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sync-delta-table-to-nosql/m-p/129934#M48650</guid>
      <dc:creator>nayan_wylde</dc:creator>
      <dc:date>2025-08-27T17:00:22Z</dc:date>
    </item>
  </channel>
</rss>

