Example: Connecting to Google Cloud BigQuery via a JSON Connection
This topic presents an example about how you can set up a JSON connection to connect a catalog to Google Cloud BigQuery.
In this example, we create two parameters in the catalog and use them to provide values for the two tokens access_token and maxResults in the URL of the JSON instance file used to access Google Cloud BigQuery. The token access_token is for authorizing a Google API request, and maxResults represents the maximum record number to return. You can change the parameter values to provide dynamic values for the two tokens at runtime.
- Make sure SampleReports.cat is the currently open catalog file. If not, select File > Open Catalog to open it from
<install_root>\Demo\Reports\SampleReports
. - Right-click the Parameters node in Data Source 1 of the catalog and select New Parameter from the shortcut menu.
- In the New Parameter dialog box, type pAccessToken in the Name text box.
- Select String from the Value Type drop-down list.
- Select to add a value line, double-click in it and then type in the valid token value to access Google Cloud BigQuery, for example, ya29.Ci9dA2sA8J_wM8e5FnY9rJg551153GQWGbleO-y9aeZOky9V36Tz497HY1chApjLFg.
- Select OK to create the parameter.
- Repeat the above steps to create another parameter pMaxResults of Integer type with the prompt value 2 in the Value List.
For more information about creating parameters, see Creating a Parameter.
- Right-click the Data Source 1 node and select New JSON Connection from the shortcut menu. Designer displays the JSON Connection Wizard.
- In the Extract JSON Schema screen, select Extract Schema from Instance Data from the Schema Source drop-down list.
- Type the following URL in the Instance text box:
https://www.googleapis.com/bigquery/v2/projects/bigquery-public-data/datasets/samples/tables/gsod/data?maxResults=@pMaxResults&access_token=@pAccessToken
- Select Next three times to go to the Add Table screen. Select f in the Tables box and select to add it to the Added Tables box.
- Select Finish to set up the connection.