# tMapROjaiOutput

Inserts, replaces or deletes documents in a MapR-DB database to be used as document database, based on the incoming flow from the preceding component in the Job.

You must have properly installed and configured your MapR Client before using this component. A \opt\mapr\conf\mapr-clusters.conf file is automatically generated out of the Client configuration process to store the connection information to your MapR cluster and your MapR-DB database. At runtime, this OJAI component reads this connection information by itself to connect to the MapR-DB database to be used.

For further information about how to install and configure your MapR client, see [Setting up the Client](http://doc.mapr.com/display/MapR/Setting+Up+the+Client) from the MapR documentation.

This component is not shipped with your Talend Studio by default. You need to install it using the Feature Manager. For more information, see [Installing features using the Feature Manager](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/install-features-to-talend-studio).

## tMapROjaiOutput Standard properties

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

The Standard tMapROjaiOutput component belongs to the Databases NoSQL family.

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

## Basic settings

| Properties | Description |
| --- | --- |
| Schema and Edit schema | A schema is a row description. It defines the number of fields<br>(columns) to be processed and passed on to the next component. When you create a Spark<br>Job, avoid the reserved word line when naming the<br>fields.<br><br><ul> <li> <p> <span>Built-In</span>: You create and store the schema locally for this component                only.</p> </li> <li> <p> <span>Repository</span>: You have already created the schema and stored it in the                Repository. You can reuse it in various projects and Job designs.</p> </li> </ul><br><br>Click Edit schema to make changes to<br>the schema. If you make changes, the schema automatically becomes built-in.<br><br><ul> <li> <p> <span>View schema</span>: choose this                option to view the schema only.</p> </li> <li> <p> <span>Change to built-in property</span>:                choose this option to change the schema to <span>Built-in</span> for local changes.</p> </li> <li> <p> <span>Update repository connection</span>:                choose this option to change the schema stored in the repository and decide whether                to propagate the changes to all the Jobs upon completion.</p> <p>If you just want to                propagate the changes to the current Job, you can select <span>No</span> upon completion and choose this schema metadata                again in the <span>Repository Content</span>                window.</p> </li> </ul><br><br>This component supports the Document type. If a field is for entire<br>documents, select Document in the Type column for this field in the schema editor.<br><br>Click Sync<br>columns to retrieve the schema from the previous component connected in the<br>Job. |
| Use kerberos authentication | If you are accessing a MapR-DB as-OJAI database<br>running with Kerberos security, select this checkbox, then, enter the Kerberos<br>principal name and password in the displayed fields.<br><br>Every time when you launch your Job, the<br>component submits this authentication information to Kerberos for a new kinit<br>ticket. |
| Use a keytab to authenticate | Select the Use a keytab to authenticate<br>checkbox to log into a Kerberos-enabled system using a given keytab file. A keytab<br>file contains pairs of Kerberos principals and encrypted keys. You need to enter the<br>principal to be used in the Principal field and<br>the access path to the keytab file itself in the Keytab field. This keytab file must be stored in the machine in<br>which your Job actually runs, for example, on a Talend JobServer.<br><br>Note that the user that executes a keytab-enabled Job is not necessarily<br>the one a principal designates but must have the right to read the keytab file being<br>used. For example, the username you are using to execute a Job is *user1* and the principal to be used is *guest*; in this<br>situation, ensure that *user1* has the right to read the keytab<br>file to be used. |
| Table | Enter the name of the table to be processed. |
| Action on table | Select an operation to be performed on the table defined.<br><br><ul> <li> <p> <span>None</span>: No operation is carried out.</p> </li> <li> <p> <span>Drop and create table</span>: The table is removed            and created again.</p> </li> <li> <p> <span>Create table</span>: The table does not exist and            gets created.</p> </li> <li> <p> <span>Create table if does not exist</span>: The table is            created if it does not exist.</p> </li> <li> <p> <span>Drop table if exist and create</span>: The table is            removed if it already exists and created again.</p> </li> <li> <p> <span>Truncate</span>: The table content            is deleted.</p> </li> </ul> |
| Action on data | Select an action to be performed on data of the<br>table defined.<br><br><ul> <li> <p> <span>Insert</span>: Add            new entries to the table. If duplicates are found, the Job stops.</p> </li> <li> <p> <span>Replace</span>:            if the table already contains data, delete all the existing data and insert the new            data. If the table is empty, insert the new data.</p> </li> <li> <p> <span>Insert or                Replace</span>: it looks at the document IDs, replaces the documents whose IDs            exist in both the database and the data to be written, and inserts the documents whose            IDs do not exist in the database.</p> </li> <li> <p> <span>Delete</span>:            Remove entries corresponding to the input flow.</p> </li> </ul> |
| Bulk write | Select this check box to insert, update or remove data in bulk.<br><br>In the Bulk write size field, enter the size<br>of each query group to be processed by MapR-DB. |
| Mapping | Each column of the schema defined for this component represents a field of the documents<br>to be read. In this table, you need to specify the parent nodes of these fields, if<br>any.<br><br>For example, in the document reading as<br>follows<br><br>```<br>{<br>_id: ObjectId("5099803df3f4948bd2f98391"),<br>person: { first: "Joe", last: "Walker" }<br>}<br>```<br><br><br>The<br>*first* and the *last*<br>fields have *person* as their parent node but the *\_id* field does not have any parent node. So once completed, this<br>Mapping table should read as<br>follows:<br><br>```<br>Column     Parent node path<br>_id<br>first       "person"<br>last        "person"<br>``` |
| Die on error | This check box is cleared by default, meaning to skip the row on error<br>and to complete the process for error-free rows. |

## Advanced settings

| Properties | Description |
| --- | --- |
| tStatCatcher Statistics | Select this checkbox to gather the Job processing metadata at the Job level<br>as well as at each component level. |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br><br>NB\_LINE: the number<br>of rows read by an input component or transferred to an output component. This is an<br>After variable and it returns an integer.<br><br><br>NB\_LINE\_REJECTED: the number of rows rejected. This is an After<br>variable and it returns an integer.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>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<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | tMapROjaiOutput<br>executes the action defined on the documents in a given MapR-DB database<br>based on the flow incoming from the preceding component in your Job. |

**Related concepts**

* [Writing candidate data in a MapR-DB OJAI database](https://help.qlik.com/talend/en-US/components/8.0/maprdb/tmaprojaioutput-tfixedflowinput-writing-candidate-data-in-mapr-db-ojai-database-standard-component-bigdata "This scenario uses tMapROjaiOutput to write data about some candidates in a MapR-DB OJAI database.")