This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Datasets in BigQuery


Overview

The following operations allow you to work with datasets. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with datasets, see Sample configuration

OperationDescription

getDataset

Retrieves a dataset.

listDatasets

Retrieves a dataset list.

Operation details

This section provides further details on the operations related to datasets.

Retrieving a dataset

The getDataset operation retrieves a dataset.

getDataset
<bigquery.getDataset>
    <projectId>{$ctx:projectId}</projectId>
	<datasetId>{$ctx:datasetId}</datasetId>
</bigquery.getDataset>
Properties
  • projectId: The ID of the project which the dataset belongs to.
  • datasetId: The ID of the dataset.
   Sample request

Following is a sample REST/JSON request that can be handled by the getDataset operation.

Sample Request for getDataset
{
  "accessToken": "ya29.BwKYx40Dith1DFQBDjZOHNqhcxmKs9zbkjAWQa1q8mdMFndp2-q8ifG66fwprOigRwKSNw",
  "apiUrl": "https://www.googleapis.com",
  "clientId": "504627865627-kdni8r2s10sjddfgXzqb4bvnba.apps.googleusercontent.com",
  "clientSecret": "ChlbHI_T7zssXXTRYuqj_-TM",
  "refreshToken": "1/uWful-diQNAdk-alDUa6ixxxxxxxx-LpJIikEQ2sqA",
  "registryPath": "connectors/bq",
  "projectId": "publicdata",
  "datasetId": "samples",
  "fields": "id",
  "callback": "callBackFunction",
  "apiKey": "154987fd5h4x6gh4",
  "prettyPrint": "true",
  "quotaUser": "1hx46f5g4h5ghx6h41x54gh6f4hx",
  "userIp": "192.77.88.12",
  "ifNoneMatch":"hnk59tKBkX8cdlePZ8VtzgVzuO4/tS1oqpXxnkU21hZeK5k4lqRrRr8",
  "ifMatch":"hnk59tKBkX8cdlePZ8VtzgVzuO4/tS1oqpXxnkU21hZeK5k4lqRrRr8"
}
Related BigQuery documentation

https://cloud.google.com/bigquery/docs/reference/v2/datasets/get

Retrieving a dataset list

The listDatasets operation retrieves a dataset list.

listDatasets
<bigquery.listDatasets>
    <projectId>{$ctx:projectId}</projectId>
    <maxResults>{$ctx:maxResults}</maxResults>
    <pageToken>{$ctx:pageToken}</pageToken>
	<isAll>{$ctx:isAll}</isAll>
</bigquery.listDatasets>
Properties
  • projectId: The ID of the project which the datasets belongs to.
  • maxResults: The max results per page.
  • pageToken: The page token value.
  • isAll: Boolean value to determine whether to list all datasets, including hidden ones.
   Sample request

Following is a sample REST/JSON request that can be handled by the listDatasets operation.

Sample Request for listDatasets
{
  "accessToken": "ya29.BwKYx40Dith1DFQBDjZOHNqhcxmKs9zbkjAWQa1q8mdMFndp2-q8ifG66fwprOigRwKSNw",
  "apiUrl": "https://www.googleapis.com",
  "clientId": "504627865627-kdni8r2s10sjddfgXzqb4bvnba.apps.googleusercontent.com",
  "clientSecret": "ChlbHI_T7zssXXTRYuqj_-TM",
  "refreshToken": "1/uWful-diQNAdk-alDUa6ixxxxxxxx-LpJIikEQ2sqA",
  "registryPath": "connectors/bq",
  "projectId": "publicdata",
  "maxResults": "1",
  "pageToken": "1",
  "isAll": "true",
  "fields": "datasets/datasetReference",
  "callback": "callBackFunction",
  "apiKey": "154987fd5h4x6gh4",
  "prettyPrint": "true",
  "quotaUser": "1hx46f5g4h5ghx6h41x54gh6f4hx",
  "userIp": "192.77.88.12",
  "ifNoneMatch":"hnk59tKBkX8cdlePZ8VtzgVzuO4/tS1oqpXxnkU21hZeK5k4lqRrRr8",
  "ifMatch":"hnk59tKBkX8cdlePZ8VtzgVzuO4/tS1oqpXxnkU21hZeK5k4lqRrRr8"
}
Related BigQuery documentation

https://cloud.google.com/bigquery/docs/reference/v2/datasets/list

Sample configuration

Following is a sample proxy service that illustrates how to connect to BigQuery with the init operation and use the getDataset operation. The sample request for this proxy can be found in the getDataset sample request.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="bigquery_getDataset" transports="https,http" statistics="disable"
   trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="accessToken" expression="json-eval($.accessToken)" />
         <property name="apiUrl" expression="json-eval($.apiUrl)" />
         <property name="clientId" expression="json-eval($.clientId)"/>
         <property name="refreshToken" expression="json-eval($.refreshToken)"/>
         <property name="clientSecret" expression="json-eval($.clientSecret)"/>
         <property name="registryPath" expression="json-eval($.registryPath)"/>
         <property name="projectId" expression="json-eval($.projectId)" />
         <property name="datasetId" expression="json-eval($.datasetId)" />
         <property name="fields" expression="json-eval($.fields)" />
         <property name="callback" expression="json-eval($.callback)" />
         <property name="apiKey" expression="json-eval($.apiKey)" />
         <property name="prettyPrint" expression="json-eval($.prettyPrint)" />
         <property name="quotaUser" expression="json-eval($.quotaUser)" />
         <property name="userIp" expression="json-eval($.userIp)" />
         <property name="ifMatch" expression="json-eval($.ifMatch)" />
         <property name="ifNoneMatch" expression="json-eval($.ifNoneMatch)" />
         <bigquery.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
            <clientSecret>{$ctx:clientSecret}</clientSecret>
            <clientId>{$ctx:clientId}</clientId>
            <refreshToken>{$ctx:refreshToken}</refreshToken>
            <registryPath>{$ctx:registryPath}</registryPath>
            <fields>{$ctx:fields}</fields>
            <callback>{$ctx:callback}</callback>
            <apiKey>{$ctx:apiKey}</apiKey>
            <prettyPrint>{$ctx:prettyPrint}</prettyPrint>
            <quotaUser>{$ctx:quotaUser}</quotaUser>
            <userIp>{$ctx:userIp}</userIp>
            <ifMatch>{$ctx:ifMatch}</ifMatch>
            <ifNoneMatch>{$ctx:ifNoneMatch}</ifNoneMatch>
         </bigquery.init>
         <bigquery.getDataset>
            <projectId>{$ctx:projectId}</projectId>
            <datasetId>{$ctx:datasetId}</datasetId>
         </bigquery.getDataset>
         <respond />
      </inSequence>
      <outSequence>
         <send />
      </outSequence>
   </target>
   <description />
</proxy>