Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a Data Fusion instance.

  2. Ensure that you have the following roles in IAM for the service account, service-<project-number>@gcp-sa-datafusion.iam.gserviceaccount.com:

    • Cloud SQL Admin

    • Cloud Data Fusion Admin

    • Cloud Data Fusion API Service Agent

  3. Create a CloudSQL (MySQL) instance, test database, and user.

  4. In the Google Cloud Console, navigate to APIs and Services.

    1. Click Enable APIS and Services.

    2. Search for Cloud SQL Admin API.

    3. Choose the Cloud SQL Admin API. Click Enable.

If you are connecting to a Private Cloud SQL instance, please follow additional steps at Connect to private cloudsql-mysql instance from private Cloud Data Fusion instance to set up a proxy VM to establish the connection.

Instructions

  1. Obtain the JDBC Driver JAR file by building it using the instructions at https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory (or you can get a downloading the pre-built jar-with-driver-and-dependencies from the releases page).

  2. You would have to use Alternatively, you can build it using:

    Code Block
    mvn -P jar-with-driver-and-dependencies clean package -DskipTests

    to build the JAR instead of the command in README from the above git repo.

  3. Go to Cloud Data Fusion Wrangler.

...

34. If this is the first time you are configuring CloudSQL for MySQL, click on the Add Connection button from the Wrangler screen and choose Database.

...

45. Click “Google Cloud SQL for MySQL.”

...

56. Upload the previously built JAR as illustrated, and click Next.

67. Click Finish to complete the upload.

...

78. Once the driver has been uploaded, you will see a green check mark indicating that your driver has been installed.

...

Info

Cloud SQL instances with Private IP cannot currently be accessed using Wrangler. So the following instructions will not work for Private IP instances. However, Private IP Cloud SQL instances can still be accessed by creating a pipeline, which will run using Cloud Dataproc. See Accessing Cloud SQL in pipelines for instructions.

89. Click the Google Cloud SQL for MySQL to create a new connection. Once the connection modal opens, click on the Advanced link if present.

...

910. Enter your connection string as:

...

where <database> represents the database you created in the prerequisites section, and <instance-connection-name> refers to your instance connection name as displayed in the overview Overview tab of of the instance details Details page.

...

1011. Enter the username and the password you configured for this CloudSQL instance.

1112. Click Test Connection to verify that the connection can successfully be established with the database.

1213. Click Add Connection to complete the task.

Tip

Once you’ve completed all the steps, you will be able to click on the newly defined database connection and see the list of tables for that database.

Building the MySQL Socket Factory Driver

...

.

Accessing CloudSQL in pipelines

...