July 30, 2023

tCosmosDBOutput – Docs for ESB 7.x

tCosmosDBOutput

Inserts, updates, upserts or deletes documents in a Cosmos database collection
based on the incoming flow from the preceding component in the Job.

tCosmosDBOutput Standard properties

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

The Standard
tCosmosDBOutput component belongs to
the Cloud and the Databases families.

The component in this framework is available in all Talend products with Big Data
and in Talend Data Fabric.

Basic settings

Use existing connection

Select this check box and in the Component List click the relevant connection component to
reuse the connection details you already defined.

API

Select the database API to be used. Then the corresponding parameters to be defined are displayed in the Component view.

In the current version of this component, only the MongoDB API is supported. For this reason, MongoDB database is often mentioned in the documentation of the CosmosDB components.

Use replica set address or multiple query routers

Select this check box to show the Server
addresses
table.

In the Server addresses
table, define the sharded MongoDB databases or the MongoDB replica sets
you want to connect to.

Server and Port

Enter the IP address and listening port of the database
server.

Available when the Use replica set
address or multiple query routers
check box is not
selected.

Database

Enter the name of the MongoDB database to be connected to.

Set write concern

Select this check box to set the level of acknowledgement requested from for write
operations. Then you need to select the level of this operation.

For further information, see the related MongoDB documentation on http://docs.mongodb.org/manual/core/write-concern/.

Bulk write

Select this check box to insert, update or remove data in bulk. Note this feature is available only when the version of MongoDB you are using is 2.6+.

Then you need to select Ordered or Unordered to define how the MongoDB database processes the data
sent by the Studio.

  • If you select Ordered,
    MongoDB processes the queries sequentially.

  • If you select Unordered,
    MongoDB optimizes the bulk write operations without keeping the order in which
    the individual operations were inserted in the bulk write.

In the Bulk write size field, enter the size of each
query group to be processed by MongoDB. In the documentation of MongoDB, some restrictions
and expected behaviors as to this size are explained. You can find the details on http://docs.mongodb.org/manual/core/bulk-write-operations/.

Authentication mechanism

Among the mechanisms listed on the Authentication mechanism
drop-down list, the NEGOTIATE one is recommended if
you are not using Kerberos, because it automatically select the authentication mechanism
the most adapted to the MongoDB version you are using.

For details about the other mechanisms in this list, see MongoDB Authentication from the MongoDB
documentation.

Set Authentication database

If the username to be used to connect to MongoDB has been created in a specific
Authentication database of MongoDB, select this check box to enter the name of this
Authentication database in the Authentication database
field that is displayed.

For further information about the MongoDB Authentication database, see User Authentication database.

Username and Password

DB user authentication data.

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

Available when the Use
authentication
check box is selected.

If the security system you have selected from the Authentication mechanism drop-down list is Kerberos, you need to
enter the User principal, the Realm and the KDC
server
fields instead of the Username and the Password
fields.

Collection

Name of the collection in the database.

Drop collection if exist

Select this check box to drop the collection if it already
exists.

Action on data

The following operations are available:

  • Insert: insert documents.

  • Set: modifies the existing fields of an existing
    document and appends a field if it does not exist in this document.

    If you need to apply this action on all the documents in the collection to be
    used, select the Update all document check box that
    is displayed; otherwise, only the first document is updated.

  • Update: replaces the existing documents with the
    incoming data but keeps the technical ID of these documents.

  • Upsert: inserts a document if it does not exist
    otherwise it applies the same rules as Update.

  • Upsert with set: inserts a document if it does
    not exist otherwise it applies the same rules as Set

    If you need to apply this action on all the documents in the collection to be
    used, select the Update all document check box that
    is displayed; otherwise, only the first document is updated.

  • Delete: delete documents.

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. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

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.

Click Sync columns to retrieve the
schema from the previous component connected in the Job.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

When the schema to be reused has default values that are
integers or functions, ensure that these default values are not enclosed within
quotation marks. If they are, you must remove the quotation marks manually.

You can find more details about how to
verify default values in retrieved schema in Talend Help Center (https://help.talend.com).

Mapping

Each column of the schema defined for this component represents a field of the documents
to be read. In this table, you need to specify the parent nodes of these fields, if
any.

For example, in the document reading as
follows
The
first and the last
fields have person as their parent node but the _id field does not have any parent node. So once completed, this
Mapping table should read as
follows:

Not available when the Generate JSON
Document
check box is selected in Advanced settings.

Die on error

This check box is cleared by default, meaning to skip the row on error
and to complete the process for error-free rows.

Advanced settings

Generate JSON Document

Select this check box for JSON configuration:

Configure JSON Tree: click the
[…] button to open the interface
for JSON tree configuration. For more information, see Configuring a JSON Tree.

Group by: click the [+] button to add lines and choose the input
columns for grouping the records.

Remove root node: select this check
box to remove the root node.

Data node and Query node (available for update and upsert actions):
type in the name of data node and query node configured on the JSON
tree.

These nodes are mandatory for update and upsert actions. They are
intended to enable the update and upsert actions though will not be
stored in the database.

No query timeout

Select this check box to prevent MongoDB servers from stopping idle
cursors at the end of 10-minute inactivity of these cursors. In this
situation, an idle cursor will stay open until either the results of
this cursor are exhausted or you manually close it using the
cursor.close() method.

A cursor for MongoDB is a pointer to the result set of a query. By
default, that is to say, with this check box being clear, a MongoDB
server automatically stops idle cursors after a given inactivity period
to avoid excess memory use. For further information about MongoDB
cursors, see https://docs.mongodb.org/manual/core/cursors/.

tStatCatcher Statistics

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

Usage

Usage rule

tCosmosDBOutput executes the action
defined on the collection in the database based on the flow
incoming from the preceding component in the Job.

Limitation

  • The “multi” parameter, which allows to update multiple
    documents at a time, is not supported. Therefore, if two
    documents have the same key, the first is always updated,
    but the second never will.

  • For the update operation, the key cannot be a JSON
    array.


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