Read from multiple Microsoft SQL Server tables

Stay organized with collections Save and categorize content based on your preferences.

This guide shows you how to read multiple tables from a Microsoft SQL Server database, using the Multi Table source. Use the Multi Table source when you want your pipeline to read from multiple tables. If you want your pipeline to read from a single table, see Reading from a Microsoft SQL Server table.

The Multi Table source outputs data with multiple schemas and includes a table name field that indicates the table from which the data came from. When using the Multi Table source, use one of the multi-table sinks, BigQuery Multi Table or GCS Multi File.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.

  6. Enable the Cloud Data Fusion, Cloud Storage, BigQuery, and Cloud Dataproc APIs.

    Enable the APIs

  7. Create a Cloud Data Fusion instance.
  8. Ensure that your SQL Server database can accept connections from Cloud Data Fusion. To do this securely, we recommend that you create a private Cloud Data Fusion instance.

View your Cloud Data Fusion instance

When using Cloud Data Fusion, you use both the Google Cloud console and the separate Cloud Data Fusion UI. In the Google Cloud console, you can create a Google Cloud project, and create and delete Cloud Data Fusion instances. In the Cloud Data Fusion UI, you can use the various pages, such as Studio or Wrangler, to use Cloud Data Fusion features.

  1. In the Google Cloud console, go to the Cloud Data Fusion page.

  2. Click Instances, and then click View instance to open the instance in the Cloud Data Fusion web interface.

    Go to Instances

Store your SQL Server password as a secure key

Add your SQL Server password as a secure key to encrypt on your Cloud Data Fusion instance. Later in this guide, you will ensure that your password is retrieved using Cloud KMS.

  1. In the top-right corner of any Cloud Data Fusion page, click System Admin.

  2. Click the Configuration tab.

  3. Click Make HTTP Calls.

    Configuration.

  4. In the dropdown menu, choose PUT.

  5. In the path field, enter namespaces/namespace-id/securekeys/password.

  6. In the Body field, enter {"data":"your_password"}. Replace your_password with your SQL Server password.

  7. Click Send.

    Password.

Ensure that the Response you get is status code 200.

Get the JDBC driver for SQL Server

using the Hub

  1. In the Cloud Data Fusion UI, click Hub in the upper right.

  2. In the search bar, type "Microsoft SQL Server JDBC Driver".

  3. Click Microsoft SQL Server JDBC Driver.

  4. Click Download. Follow the download steps shown.

  5. Click Deploy. Upload the Jar file from the previous step.

  6. Click Finish.

using Studio

  1. Visit Microsoft.com.

  2. Choose your download and click Download.

  3. In the Cloud Data Fusion UI, click the menu and navigate to the Studio page.

  4. Click the + button.

  5. Under Driver, click Upload.

  6. Click to select the JAR file, located in the "jre7" folder.

  7. Click Next.

  8. Configure the driver by typing a Name and Class name.

  9. Click Finish.

Deploy the Multiple Table Plugins

  1. In the Cloud Data Fusion web UI, click Hub in the upper right.

  2. In the search bar, type "Multiple table plugins".

  3. Click Multiple Table Plugins.

    Password.
  4. Click Deploy.

  5. Click Finish.

  6. Click Create a Pipeline.

Connect to SQL Server

  1. In the Cloud Data Fusion UI, click the menu and navigate to the Studio page.

  2. In Studio, click to expand the Source menu.

  3. Click Multiple Database Tables.

    Multiple tables.
  4. Hold the pointer over the Multiple Database Tables node and click Properties.

    Properties.
  5. Under Reference name, provide a reference name that will be used to identify your SQL Server source.

  6. Under JDBC Connection String, provide the JDBC connection string. For example, jdbc:sqlserver://mydbhost:1433. Learn more.

  7. Click Validate.

  8. Click the X button.

What's next