Google BigQuery is a serverless, highly scalable, and cost-effective data warehouse designed to help organizations turn big data into actionable insights.
The CData SSIS Components enhance SQL Server Integration Services by enabling users to easily import and export data from various sources and destinations.
In this article, we explore the data type mapping considerations when exporting to BigQuery and walk through how to migrate PingOne data to Google BigQuery using the CData SSIS Components for PingOne and BigQuery.
Data Type Mapping
| Google BigQuery Schema |
CData Schema |
|
STRING, GEOGRAPHY, JSON, INTERVAL
|
string
|
|
BYTES
|
binary
|
|
INTEGER
|
long
|
|
FLOAT
|
double
|
|
NUMERIC, BIGNUMERIC
|
decimal
|
|
BOOLEAN
|
bool
|
|
DATE
|
date
|
|
TIME
|
time
|
|
DATETIME, TIMESTAMP
|
datetime
|
|
STRUCT
|
See below
|
|
ARRAY
|
See below
|
STRUCT and ARRAY Types
Google BigQuery supports two kinds of types for storing compound values in a single row, STRUCT and ARRAY. In some places within Google BigQuery, these are also known as RECORD and REPEATED types.
A STRUCT is a fixed-size group of values that are accessed by name and can have different types. The component flattens structs so their fields can be accessed using dotted names. Note that these dotted names must be quoted.
An ARRAY is a group of values with the same type that can have any size. The component treats the array as a single compound value and reports it as a JSON aggregate. These types may be combined such that a STRUCT type contains an ARRAY field, or an ARRAY field is a list of STRUCT values.
Special Considerations
-
Google BigQuery has both DATETIME (no timezone) and TIMESTAMP (with timezone) data types that the CData SSIS Components map to datetime based on the timezone of your local machine.
-
In Google BigQuery, the NUMERIC type supports 38 digits of precision and up to 9 digits after the decimal point, while the BIGNUMERIC type supports 76 digits of precision and up to 38 digits after the decimal point. The CData SSIS Components for Google BigQuery automatically detects the precision/scale, but with the Destination Component users can manually map any high-precision columns.
-
INTERVAL data types:
Prerequisites
Create the project and add components
-
Open Visual Studio and create a new Integration Services Project.
π Create the SSIS project
-
Add a new Data Flow Task to the Control Flow screen and open the Data Flow Task.
-
Add a CData PingOne Source control and a CData GoogleBigQuery Destination control to the data flow task.
π Add the source and destination controls (Salesforce is shown)
Configure the PingOne source
Follow the steps below to specify properties required to connect to PingOne.
-
Double-click the CData PingOne Source to open the source component editor and add a new connection.
π Open the source component editor (Salesforce is shown)
-
In the CData PingOne Connection Manager, configure the connection properties, then test and save the connection.
To connect to PingOne, configure these properties:
- : The region where the data for your PingOne organization is being hosted.
- : The type of authentication to use when connecting to PingOne.
- Either (required when using the default PingOne domain) or , configured as described below.
Configuring WorkerAppEnvironmentId
is the ID of the PingOne environment in which your Worker application resides.
This parameter is used only when the environment is using the default PingOne domain (auth.pingone).
It is configured after you have created the custom OAuth application you will use to authenticate to PingOne, as described in Creating a Custom OAuth Application in the Help documentation.
First, find the value for this property:
- From the home page of your PingOne organization, move to the navigation sidebar and click Environments.
- Find the environment in which you have created your custom OAuth/Worker application (usually Administrators), and click Manage Environment.
The environment's home page displays.
- In the environment's home page navigation sidebar, click Applications.
- Find your OAuth or Worker application details in the list.
-
Copy the value in the Environment ID field.
It should look similar to:
WorkerAppEnvironmentId='11e96fc7-aa4d-4a60-8196-9acf91424eca'
Now set to the value of the Environment ID field.
Configuring AuthorizationServerURL
is the base URL of the PingOne authorization server for the environment where your application is located.
This property is only used when you have set up a custom domain for the environment, as described in the PingOne platform API documentation.
See Custom Domains.
Authenticating to PingOne with OAuth
PingOne supports both OAuth and OAuthClient authentication.
In addition to performing the configuration steps described above, there are two more steps to complete to support OAuth or OAuthCliet authentication:
- Create and configure a custom OAuth application, as described in Creating a Custom OAuth Application in the Help documentation.
- To ensure that the driver can access the entities in Data Model, confirm that you have configured the correct roles for the admin user/worker application you will be using, as described in Administrator Roles in the Help documentation.
- Set the appropriate properties for the authscheme and authflow of your choice, as described in the following subsections.
OAuth (Authorization Code grant)
Set to OAuth.
Desktop Applications
Get and Refresh the OAuth Access Token
After setting the following, you are ready to connect:
- : GETANDREFRESH. To avoid the need to repeat the OAuth exchange and manually setting the each time you connect, use .
- : The Client ID you obtained when you created your custom OAuth application.
- : The Client Secret you obtained when you created your custom OAuth application.
- : The redirect URI you defined when you registered your custom OAuth application. For example: https://localhost:3333
When you connect, the driver opens PingOne's OAuth endpoint in your default browser. Log in and grant permissions to the application.
The driver then completes the OAuth process:
- The driver obtains an access token from PingOne and uses it to request data.
- The OAuth values are saved in the location specified in , to be persisted across connections.
The driver refreshes the access token automatically when it expires.
For other OAuth methods, including Web Applications, Headless Machines, or Client Credentials Grant, refer to the Help documentation.
π Configure the source connection (Salesforce is shown)
-
After saving the connection, select "Table or view" and select the table or view to export into Google BigQuery, then close the CData PingOne Source Editor.
π Select the table to export (Salesforce is shown)
Configure the Google BigQuery destination
With the PingOne Source configured, we can configure the Google BigQuery connection and map the columns.
-
Double-click the CData Google BigQuery Destination to open the destination component editor and add a new connection.
π Open the destination component editor
-
In the CData GoogleBigQuery Connection Manager, configure the connection properties, then test and save the connection.
-
Google uses the OAuth authentication standard. To access Google APIs on behalf of individual users, you can use the embedded credentials or you can register your own OAuth app.
OAuth also enables you to use a service account to connect on behalf of users in a Google Apps domain. To authenticate with a service account, register an application to obtain the OAuth JWT values.
In addition to the OAuth values, specify the DatasetId and ProjectId. See the "Getting Started" chapter of the help documentation for a guide to using OAuth.
Helpful connection properties
-
QueryPassthrough: When this is set to True, queries are passed through directly to Google BigQuery.
-
ConvertDateTimetoGMT: When this is set to True, the components will convert date-time values to GMT, instead of the local time of the machine.
-
FlattenObjects: By default the component reports each field in a STRUCT column as its own column while the STRUCT column itself is hidden. When this is set to False, the top-level STRUCT is not expanded and is left as its own column. The value of this column is reported as a JSON aggregate.
-
SupportCaseSensitiveTables: When this property is set to true, tables with the same name but different casing will be renamed so they are all reported in the metadata. By default, the provider treats table names as case-insensitive, so if multiple tables have the same name but different casing, only one will be reported in the metadata.
π Configure the destination connection
-
After saving the connection, select a table in the Use a Table menu and in the Action menu, select Insert.
π Choose the destination table
-
On the Column Mappings tab, configure the mappings from the input columns to the destination columns.
π Map the columns (Salesforce is shown)
Run the project
You can now run the project. After the SSIS Task has finished executing, data from your SQL table will be exported to the chosen table.