<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Prachi Mishra on Medium]]></title>
        <description><![CDATA[Stories by Prachi Mishra on Medium]]></description>
        <link>https://medium.com/@prachi.mishra_4707?source=rss-4d42a194a1b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YSRnPknjOPIx8Nfa</url>
            <title>Stories by Prachi Mishra on Medium</title>
            <link>https://medium.com/@prachi.mishra_4707?source=rss-4d42a194a1b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:39:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prachi.mishra_4707/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Real-Time Streaming | MySQL & Oracle to Cloud Spanner]]></title>
            <link>https://blog.searce.com/real-time-streaming-mysql-oracle-to-cloud-spanner-f866ca489d00?source=rss-4d42a194a1b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f866ca489d00</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[spanner]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[oracle]]></category>
            <dc:creator><![CDATA[Prachi Mishra]]></dc:creator>
            <pubDate>Thu, 05 May 2022 06:00:10 GMT</pubDate>
            <atom:updated>2022-05-05T09:49:41.778Z</atom:updated>
            <content:encoded><![CDATA[<p>Our Business needs to outgrow the datacenter and gain more scale. The goal was to lift and shift our machines as quickly as possible with minimal changes and then use cloud databases to modernise those workloads while reducing our SQL Server footprint post migration. To move to the cloud successfully, we needed to migrate the databases quickly while preserving the ability to continue to serve production traffic at scale.</p><h4>What to use ? Cloud Spanner is the Solution.</h4><p>Cloud Spanner is a fully managed database service offered by Google Cloud Platform. It is a <strong>globally distributed, strongly consistent, and the only enterprise-grade service </strong>that combines SQL queries, transactions, and relational structure. It provides excellent data consistency, scalability and eliminates management overhead. Cloud Spanner is specially designed for handling a massive amount of data in banks, gaming industries, retailing, etc.</p><p>Features:</p><ul><li>Relational Database</li><li>Predefined Schema</li><li>Data Structures</li><li>ACID Transactions</li><li>Strong Consistency</li></ul><p>If you need a multi-regional and global solution,</p><p>Cloud Spanner is a globally distributed, high availability cluster. We can horizontally scale the cluster and each node can store upto 2 TB of data. Its fully managed GCP service, GCP assures auto replicates and maintenance of the cluster. Basically Zero downtime.</p><p><strong>Differences between Cloud SQL and Cloud Spanner</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qJCaslfs_b-UcfZq9W0WKQ.png" /></figure><h3><strong>Streaming Data from MySQL to Cloud Spanner</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iiJlUkyfTAXYiizH" /></figure><p>This document covers the real-time data streaming from MySQL to Cloud Spanner</p><ol><li>Datastream to Cloud Spanner template is a streaming pipeline which reads events data from Cloud Storage and writes to Cloud Spanner databases. Currently, offering two sources mysql and oracle.</li><li>Table structure must exist in the destination Cloud Spanner database prior to template execution.</li><li>Schema migration from source to destination must be completed prior to data migration.</li><li>Data can exist at the destination before migration. Any new data streamed will be appended in the table.</li><li>Data consistency is confirmed once all the data is migrated to the destination. The dataflow template creates a shadow table for each table in the spanner database. This is used to confirm the consistency at the end of migration.</li><li>Any error that occurs during operation, such as schema mismatches, malformed JSON files, or errors resulting from executing transforms, are recorded in an error queue. The error queue is a Cloud Storage folder which stores all the Datastream events that have encountered errors along with the error reason in text format.</li></ol><p><strong>Prerequisites:</strong></p><ul><li>A Datastream stream with validation test passed.</li><li>A Cloud Storage bucket where Datastream events are replicated.</li><li>A Cloud Spanner database with existing tables. These tables can be empty or with data.</li></ul><blockquote><strong>Steps to create Datastream</strong></blockquote><p><em>a. Stream name can be any logical name. Our source will be MySQL and destination will be cloud storage</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8iK9Qt9sBbS_vLNe" /></figure><p><em>b. Define Source connections.</em></p><p><em>MySQL server details required like hostname, username, password and database-name.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CObFkb8mbjP9ZVV1BetxEA.png" /></figure><p><em>c. Define Destination connections</em></p><p><em>Bucket name selected must exist in Cloud Storage.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BbA9dH3r-yt3IeNE" /></figure><p><em>d. Ask Source to whitelist your regional IP’s at their end, this you can find under source connection profile.</em></p><p><em>e. Test Source connection</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/0*5YTQiluNJQVbIumM" /></figure><p><em>f. Select the specific Schema, you can select specific columns by editing the table from the EDIT button.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_iXiItWOJxpux0N4" /></figure><p><em>g. Select Destination connection and prefix where you want to store the files.</em></p><p><strong>We have two file formats supported as of now -json/avro. Please select your desired file format.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A5RL1P2-q4uQECCD" /></figure><p><em>h. Run the validation and create a stream, no need to start it now.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9sQuu8imki5BCZ-I" /></figure><blockquote><strong>Creating Spanner instance and replicating schema</strong></blockquote><p>As per the requirement, the database and schema should already exist in Spanner, so this step is mandatory.</p><p>Provide a logical instance name and select the region, we have the stream running in the Oregon region so selecting the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NM-Hog8GlFjM58Z4" /></figure><p>Once the instance is up, create database and define table schema in Google SQL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-oB-SP5k9GCy4DSK" /></figure><p>Currently, we don’t have any data in the Spanner database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BTw2cj-wztpYJsSA" /></figure><blockquote><strong>Steps to create Dataflow</strong></blockquote><ol><li>Jobname: datastream-to-spanner</li></ol><p>2. Dataflow template: select datastream to spanner</p><p>3. Provide a region name.</p><p>4. Required Parameters -</p><ul><li><em>Provide GCS bucket local where datastream is dropping the file</em></li><li><em>Spanner instance id</em></li><li><em>Spanner database name which we created above.</em></li><li><em>Datastream stream name</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QVaAjMTmRmpeJicY" /></figure><p>Datastream name should be the full path of the stream.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MMDcSsA9Kl-WHluL" /></figure><p><strong>There are few optional parameters which you need to provide for smooth execution of dataflow.</strong></p><ul><li>File format : json</li><li>Cloud spanner project id — where our spanner instance is running</li><li>Staging location — bucket location where you want staging file to be kept</li><li>Also you can define min and max worker nodes.</li><li>Define tmp location and enable streaming</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*udT_U7rpaxTgHFz_" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SoTfpM_wKIR_J9hM" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1WFzJnepVICo8T4G" /></figure><p><em>Now click on Run job at the end of the page.</em></p><p><em>You can see your job is queued and it will take some time to launch.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_wM2wpQRYkCjWxlV" /></figure><p><strong>We can check Job logs and Worker logs to see what all is happening in the background.</strong></p><p><em>After a few minutes you will see the dataflow stream is running.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_Nd7S7Af5h057iJS" /></figure><p><em>We will now start the data stream and see data flowing into Spanner.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r1Jxoy_ZlVZB1kOs" /></figure><p><em>After a few minutes it will be in running state.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FiOOmYfP4HPm-whb" /></figure><p><strong>You will observe that the shadow table is created automatically.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TnPLhk7foHXQILmK" /></figure><p><strong>We can now see data populating in the Spanner database.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TW0KxwT_V-Am24W-" /></figure><p><strong>As it’s streaming, all operations like insert, update and alter will be captured.</strong></p><p><em>Data in Spanner is stored lexicographically. Now we will insert, update and alter while the stream is running.</em></p><p><em>Inserting two rows here, record count now is 101.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qccT9E-3o14nBOiX" /></figure><p><em>Let’s check the Spanner Dashboard. The new values have been added. Data with id 100 and 101.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yc_srm771R0C-14F" /></figure><p><em>Deleting a record with id =101</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/0*AdTkBlp42ahwAr84" /></figure><p><em>Let’s check the Spanner dashboard.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qHTZnlaPtWwDcqd8" /></figure><blockquote><strong>Limitations</strong></blockquote><p>With Cloud Spanner as the destination database, if the target schema is not created before replication, the historical data will not be extracted in an existing Datastream. Example, if you have a Datastream running already without replicating the target schema in Cloud Spanner, no data will be captured at the destination till this point. After the target schema creation, records changed post that will only be loaded into the destination.</p><blockquote><strong>Streaming Data from Oracle to Cloud Spanner</strong></blockquote><p>All the above steps followed are the same for Oracle server also. Only one thing to be made sure that in Oracle, schema name will be your user name. So while selecting the source you might find your table under the username.</p><p>If while defining the table and inserting data the user has not used the schema name. Then data is by default pushed to the SYS database.</p><blockquote><strong>Conclusion</strong></blockquote><ul><li>Before migrating your data you must migrate the schema first.</li><li>Understand the use case and logically design the schema at the Cloud Spanner end.</li><li>Go through migration constraints before migration <a href="https://cloud.google.com/architecture/migrating-mysql-to-spanner">https://cloud.google.com/architecture/migrating-mysql-to-spanner</a></li><li>Datastreams can be paused and resumed when needed</li><li>Real time streaming will need to run till the cutover, post which the data will feed in from the frontend applications.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f866ca489d00" width="1" height="1" alt=""><hr><p><a href="https://blog.searce.com/real-time-streaming-mysql-oracle-to-cloud-spanner-f866ca489d00">Real-Time Streaming | MySQL &amp; Oracle to Cloud Spanner</a> was originally published in <a href="https://blog.searce.com/">Searce</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>