August 15, 2023

tBigQueryInput – Docs for ESB 6.x

tBigQueryInput

Performs the queries supported by Google BigQuery.

This component connects to Google BigQuery and performs queries in
it.

tBigQueryInput Standard properties

These properties are used to configure tBigQueryInput running in the Standard Job framework.

The Standard
tBigQueryInput component belongs to the Big Data family.

The component in this framework is generally available.

Basic settings

Schema and Edit Schema

A schema is a row description. It defines the number of fields (columns) to
be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Click Edit schema to make changes to the schema.
If the current schema is of the Repository type, three
options are available:

  • View schema: choose this option to view the
    schema only.

  • Change to built-in property: choose this
    option to change the schema to Built-in for
    local changes.

  • Update repository connection: choose this
    option to change the schema stored in the repository and decide whether to propagate
    the changes to all the Jobs upon completion. If you just want to propagate the
    changes to the current Job, you can select No
    upon completion and choose this schema metadata again in the [Repository Content] window.

 

Built-In: You create and store the
schema locally for this component only. Related topic: see
Talend Studio

User Guide.

 

Repository: You have already created
the schema and stored it in the Repository. You can reuse it in various projects and
Job designs. Related topic: see
Talend Studio

User Guide.

Client ID and Client secret

Paste the client ID and the client secret, both created and viewable on the
API Access tab view of the project hosting the BigQuery service and the Cloud
Storage service you need to use.

To enter the client secret, click the […] button next
to the client secret field, and then in the pop-up dialog box enter the client secret
between double quotes and click OK to save the
settings.

Project ID

Paste the ID of the project hosting the BigQuery service you
need to use.

The ID of your project can be found in the URL of the Google
API Console, or by hovering your mouse pointer over the name of the
project in the BigQuery Browser Tool.

Authorization code

Paste the authorization code provided by Google for the access you are
building.

To obtain the authorization code, you need to execute the Job using this
component and when this Job pauses execution to print out an URL address, you
navigate to this address to copy the authorization code displayed.

Query

Enter the query you need to use.

Result size

Select the option depending on the volume of the query result.

By default, the Small option is used, but when the
query result is larger than the maximum response size, you
need to select the Large option.

If the volume of the result is not certain, select
Auto.

Advanced settings

token properties File Name

Enter the path to, or browse to the refresh token file you need to use.

At the first Job execution using the Authorization
code
you have obtained from Google BigQuery, the value in this field
is the directory and the name of that refresh token file to be created and used; if
that token file has been created and you need to reuse it, you have to specify its
directory and file name in this field.

With only the token file name entered,
Talend Studio
considers the directory of that token file to be the root of the Studio
folder.

For further information about the refresh token, see the manual of Google
BigQuery.

Advanced Separator (for number)

Select this check box to change the separator used for the
numbers.

Encoding

Select the encoding from the list or select Custom and define it manually. This field is compulsory for database
data handling.

tStatCatcher Statistics

Select this check box to collect the log data at the component
level.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This is an input component. It sends the extracted data to the
component that follows it.

Scenario: Performing a query in BigQuery

This scenario uses two components to perform the SELECT query in BigQuery and present
the result in the Studio.

use_case-tbigqueryinput1.png

The following figure shows the schema of the table, UScustomer, we use as example to perform the SELECT query in.

use_case-tbigqueryinput2.png

We will select the State records and count the occurrence of each State among those
records.

Linking the components

  1. In the
    Integration
    perspective
    of Studio, create an empty Job, named BigQueryInput for example, from the
    Job Designs
    node in the Repository tree view.

    For further information about how to create a Job, see the
    Talend Studio
    User
    Guide.
  2. Drop tBigQueryInput and tLogRow onto the workspace.
  3. Connect them using the Row > Main
    link.

Creating the query

Building access to BigQuery

  1. Double-click tBigQueryInput to open its
    Component view.

    use_case-tbigqueryinput3.png

  2. Click Edit schema to open the
    editor

    use_case-tbigqueryinput4.png

  3. Click the

    Button_Plus.png

    button twice to add two rows and enter the names of
    your choice for each of them in the Column
    column. In this scenario, they are: States and Count.

  4. Click OK to validate these changes and
    accept the propagation prompted by the pop-up dialog box.
  5. Navigate to the Google APIs Console in your web browser to access the
    Google project hosting the BigQuery and the Cloud Storage services you need
    to use.
  6. Click the API Access tab to open its view.
  7. In the Component view of the Studio,
    paste Client ID, Client secret and Project ID from the API Access tab view
    to the corresponding fields, respectively.

Getting Authorization code

  1. In the Run view of the Studio, click
    Run to execute this Job. The execution
    will pause at a given moment to print out in the console the URL address
    used to get the authorization code.
  2. Navigate to this address in your web browser and copy the authorization
    code displayed.
  3. In the Component view of tBigQueryInput, paste the authorization code in
    the Authorization Code field.

Writing the query

In the Query field, enter

select States, count (*) as Count from documentation.UScustomer group by States

Executing the Job

The tLogRow component presents the execution
result of the Job. You can configure the presentation mode on its Component view.

To do this, double-click tLogRow to open the
Component view and in the Mode area, select the Table (print values in
cells of a table)
option.

To execute this Job, press F6.

Once done, the Run view is opened automatically,
where you can check the execution result.

use_case-tbigqueryinput-result.png

tBigQueryInput properties for Apache Spark Batch

These properties are used to configure tBigQueryInput running in the Spark Batch Job framework.

The Spark Batch
tBigQueryInput component belongs to the Databases family.

The component in this framework is available only if you have subscribed to one
of the
Talend
solutions with Big Data.

Basic settings

Source type

Select the way you want tBigQueryInput to read data
from BigQuery:

  • Table: copy the whole table.

  • Query: write a query to select data.

Schema and Edit Schema

A schema is a row description. It defines the number of fields (columns) to
be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Click Edit schema to make changes to the schema.
If the current schema is of the Repository type, three
options are available:

  • View schema: choose this option to view the
    schema only.

  • Change to built-in property: choose this
    option to change the schema to Built-in for
    local changes.

  • Update repository connection: choose this
    option to change the schema stored in the repository and decide whether to propagate
    the changes to all the Jobs upon completion. If you just want to propagate the
    changes to the current Job, you can select No
    upon completion and choose this schema metadata again in the [Repository Content] window.

 

Built-In: You create and store the
schema locally for this component only. Related topic: see
Talend Studio

User Guide.

 

Repository: You have already created
the schema and stored it in the Repository. You can reuse it in various projects and
Job designs. Related topic: see
Talend Studio

User Guide.

When the Source type is Table:

Project ID

If your BigQuery service uses the
Google Cloud Platform project ID, keep this check box clear to allow
tBigQueryInput to read this ID from the
Spark configuration tab or the
tBigQueryConfiguration component.

If the BigQuery service uses
a custom ID, select this check box and enter the ID.

The ID of your project can be found in the URL of the Google
API Console, or by hovering your mouse pointer over the name of the
project in the BigQuery Browser Tool.

Dataset

Enter the name of the dataset to which the table to be copied
belongs.

When you use BigQuery with Dataproc, in
Google Cloud Platform, select the same region for your BigQuery dataset
as for the Dataproc cluster to be run.

Table

Enter the name of the table to be copied.

When the Source type is Query:

Query

Enter the query to be used.

When you use BigQuery with Dataproc, in
Google Cloud Platform, select the same region for your BigQuery dataset
as for the Dataproc cluster to be run.

Usage

Usage rule

This is an input component. It sends data extracted from
BigQuery to the component that follows it.

Place a
tBigQueryConfiguration component in the same Job
because it needs to use the BigQuery configuration information provided
by tBigQueryConfiguration.

Spark Connection

You need to use the Spark Configuration tab in
the Run view to define the connection to a given
Spark cluster for the whole Job. In addition, since the Job expects its dependent jar
files for execution, you must specify the directory in the file system to which these
jar files are transferred so that Spark can access these files:

  • Yarn mode: when using Google
    Dataproc, specify a bucket in the Google Storage staging
    bucket
    field in the Spark
    configuration
    tab; when using other distributions, use a
    tHDFSConfiguration
    component to specify the directory.

  • Standalone mode: you need to choose
    the configuration component depending on the file system you are using, such
    as tHDFSConfiguration
    or tS3Configuration.

This connection is effective on a per-Job basis.

tBigQueryInput properties for Apache Spark Streaming

These properties are used to configure tBigQueryInput running in the Spark Streaming Job framework.

The Spark Streaming
tBigQueryInput component belongs to the Databases family.

The component in this framework is available only if you have subscribed to Talend Real-time Big Data Platform or Talend Data
Fabric.

Basic settings

Source type

Select the way you want tBigQueryInput to read data
from BigQuery:

  • Table: copy the whole table.

  • Query: write a query to select data.

Schema and Edit Schema

A schema is a row description. It defines the number of fields (columns) to
be processed and passed on to the next component. The schema is either Built-In or stored remotely in the Repository.

Click Edit schema to make changes to the schema.
If the current schema is of the Repository type, three
options are available:

  • View schema: choose this option to view the
    schema only.

  • Change to built-in property: choose this
    option to change the schema to Built-in for
    local changes.

  • Update repository connection: choose this
    option to change the schema stored in the repository and decide whether to propagate
    the changes to all the Jobs upon completion. If you just want to propagate the
    changes to the current Job, you can select No
    upon completion and choose this schema metadata again in the [Repository Content] window.

 

Built-In: You create and store the
schema locally for this component only. Related topic: see
Talend Studio

User Guide.

 

Repository: You have already created
the schema and stored it in the Repository. You can reuse it in various projects and
Job designs. Related topic: see
Talend Studio

User Guide.

When the Source type is Table:

Project ID

If your BigQuery service uses the
Google Cloud Platform project ID, keep this check box clear to allow
tBigQueryInput to read this ID from the
Spark configuration tab or the
tBigQueryConfiguration component.

If the BigQuery service uses
a custom ID, select this check box and enter the ID.

The ID of your project can be found in the URL of the Google
API Console, or by hovering your mouse pointer over the name of the
project in the BigQuery Browser Tool.

Dataset

Enter the name of the dataset to which the table to be copied
belongs.

When you use BigQuery with Dataproc, in
Google Cloud Platform, select the same region for your BigQuery dataset
as for the Dataproc cluster to be run.

Table

Enter the name of the table to be copied.

When the Source type is Query:

Query

Enter the query to be used.

When you use BigQuery with Dataproc, in
Google Cloud Platform, select the same region for your BigQuery dataset
as for the Dataproc cluster to be run.

Usage

Usage rule

This is an input component. It sends data extracted from
BigQuery to the component that follows it.

Place a
tBigQueryConfiguration component in the same Job
because it needs to use the BigQuery configuration information provided
by tBigQueryConfiguration.

Spark Connection

You need to use the Spark Configuration tab in
the Run view to define the connection to a given
Spark cluster for the whole Job. In addition, since the Job expects its dependent jar
files for execution, you must specify the directory in the file system to which these
jar files are transferred so that Spark can access these files:

  • Yarn mode: when using Google
    Dataproc, specify a bucket in the Google Storage staging
    bucket
    field in the Spark
    configuration
    tab; when using other distributions, use a
    tHDFSConfiguration
    component to specify the directory.

  • Standalone mode: you need to choose
    the configuration component depending on the file system you are using, such
    as tHDFSConfiguration
    or tS3Configuration.

This connection is effective on a per-Job basis.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x