Learn how to easily replicate your data from MySQL to BigQuery, where it can be combined with data from other sources to get a holistic view of your business.
According to DB-engines Rankings, MySQL is the second most popular database. On the other hand, BigQuery is Google’s cost-effective, serverless, multi cloud enterprise data warehouse. Copying data from MySQL to BigQuery may be part of your overall data integration strategy, that will provide you with the following benefits:
This tutorial will show you how to use Airbyte cloud, which is a data integration platform, to set up a data replication pipeline from MySQL to BigQuery.
Let's get started!
To follow the steps provided in this tutorial article you will make use of the following tools.
In this tutorial, you will set up the MySQL database on Microsoft Azure cloud. This is because the Airbyte cloud will make use of a public (not local) IP address to access MySQL. On the other hand, If you want to connect Airbyte to a local instance of MySQL, you may consider downloading and running Airbyte open-source.
Create a MySQL server on the Azure cloud platform, and follow the Quickstart: Create an Azure Database for MySQL server by using the Azure portal.
ℹ️ We use the Azure cloud platform for this tutorial, but you can set up MySQL on any cloud platform you prefer.
Once the server set-up process is complete, open the server dashboard. On the side panel, click the connect button to open up the connection settings and copy the details. We will use them to connect with MySQL workbench, which will serve as the client from which we will build a test database with sample data.
Open your MySQL workbench and follow the steps to connect it to MySQL server, as instructed in: Quickstart: Use MySQL Workbench to connect and query data in Azure Database for MySQL.
If the above configuration is successful, your MySQL workbench is connected to your instance of MySQL. You can create and access some test data, which will be used to demonstrate Airbyte replication to BigQuery.
Log in to your airbyte cloud account, click on the sources tab, and then the +new source button to create a new source. On the Source type, select MySQL, then complete the details to match the settings you defined when you set up MySQL. This should look similar to the image shown below:
To set up BigQuery, access your account on the google developer console and create a new project. In your newly created project dashboard, click on the navigation menu on the right side and select “IAM & ADMIN” - Service Accounts.
Click on Create Service Account to create a service account. In the setup window, define your service account name, ID and click create to complete the setup process.
Setup the storage object admin role. On the Roles’ setup prompt that follows, search for cloud storage service and then select Storage Object Admin role. Click on done to finish the setup process.
Create a Cloud Storage bucket that will hold your data on BigQuery. Follow the steps below to create a storage bucket. On your project dashboard, search for Cloud Storage on the search bar and select it. Next, click the Create Bucket button to set up your storage bucket. Then provide the following information:
Finally, click on create to finish the setup process. Follow the steps below to create an HMAC key access ID and Secret, which will be used later in Airbyte. After creating your storage bucket, navigate to the bucket dashboard and click on the settings option followed by Interoperability.
Click on create a key for a service account to select the service account initially created.
Finally, click on Create key to create your HMAC Access Key and Secret.
Copy the HMAC access key and secret. You will use it in the last step of setting up a connection between Airbyte cloud and BigQuery.
Log in to your Airbyte cloud account to set up the connection to the destination. Click Destinations and then click + New destination and select BigQuery as the destination to start the destination setup prompt. Configure the following details to set up the destination on airbyte:
This should look similar to the following:
Click on the setup connection button, at which point the connection to the BigQuery destination will be verified.
The last step in this process is establishing a connection between the source and destination. Click on Connections on the left tab, and then click on + New connection. Then select the MySQL source that you just created, followed by the new BigQuery destination. At this point you should see a screen similar to the following:
Give the new connection a name, and define the replication frequency. At the bottom of the above screen, you will see a list of the tables (not shown) that are available in your source, and can select the Sync mode for each one. If you are not sure which Sync mode (a.k.a. replication mode) to choose, you may wish to read our blog on replication modes.
Once you start the first sync, your data from MySQL will be replicated to BigQuery
Log in to your Google developer console and navigate to your project to see the results of the first sync. In the image below, data has been replicated from a vehicles table into BigQuery – but the data you see will depend on your MySQL source data, and the tables that you have chosen to replicate.
In this step to step tutorial, you have learned how to:
Airbyte’s data integration platform makes it easy to move data from across your enterprise into a single source of truth that is optimized for analytics! This has several benefits including: improved analytics, a single source of truth, improved security, and better data insights. If you have enjoyed this tutorial, you may check out Airbyte's tutorials and Airbyte’s blog to learn more about the platform. You can also join the conversation on our community Slack Channel, participate in discussions on Airbyte’s discourse, or sign up for our newsletter.
Learn how to replicate data from Salesforce and Zendesk to Keen to gain a 360-degree view of your business using Airbyte.
Learn how to visualize how much time your team is spending in Zoom calls with the Airbyte Zoom connector and Tableau.
Learn how to use a data integration tool (Airbyte) and a data transformation tool (dbt) to create a single customer view on a data warehouse (BigQuery).