# tCosmosDBSQLAPIInput

Retrieves data from a Cosmos database collection through SQL API.

## tCosmosDBSQLAPIInput Standard properties

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

The Standard tCosmosDBSQLAPIInput component belongs to the Databases NoSQL family.

The component in this framework is available in all Talend products.

## Basic settings

| Properties | Description |
| --- | --- |
| Property type | Either Built-in or Repository.<br><br><ul> <li> <span>Built-in</span>: No property data is stored                      centrally.</li> <li> <span>Repository</span>: Select the repository file                        in which the properties are stored. The fields that follow are completed                        automatically using the data retrieved.</li> </ul> |
| Edit Schema | A schema is a row description. It defines the number of fields (columns) to be<br>processed and passed on to the next component. When you create a Spark Job,<br>avoid the reserved word line when naming the fields.<br><br>Click Edit<br>schema to make changes to the schema. If the current schema is of the Repository type, three options are available:<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>If you want to read all columns as an entire JSON document, put an asterisk (\*)<br>in the DB column column, without quotation marks<br>around.<br><br>The dynamic schema feature is available only when you have installed the<br>8.0.1-R2024-04 Talend Studio Monthly update or a later one delivered by Talend. For more information, check with your administrator. |
| Guess schema | Click this button to retrieve the schema from the document. |
| URI | Enter the URI of your Cosmos user account. As the field prompts, the URI of a<br>Cosmos DB user account is in the format of https://{your\_account}.document.azure.com:443. You can obtain the URI<br>on the Keys pane of Azure portal. Click [Create an Azure Cosmos DB account](https://docs.microsoft.com/en-us/azure/cosmos-db/create-cosmosdb-resources-portal) for<br>related information. |
| Primary key | Enter the primary key of your CosmosDB user account. You can obtain the primary<br>key on the Keys pane of Azure portal.<br>Click [Create an Azure Cosmos DB account](https://docs.microsoft.com/en-us/azure/cosmos-db/create-cosmosdb-resources-portal) for related<br>information.<br><br>To enter the primary key, click the [...] button<br>next to the Primary key field to bring out the Enter a new<br>password dialog box, enter the primary key in the text field, and click<br>OK. Note that you can enter the primary key either in a JSON string<br>in the pure password mode or as a Java expression in the Java<br>mode. You can toggle between the two modes by clicking switch to<br>Java mode or switch to pure password mode on the top<br>of the text field.<br><br>Information noteNote:<br><br><ul> <li>The two password modes are available only when you have installed the                  8.0.1-R2022-05 <span>Talend Studio</span>                  monthly update or a later one delivered by <span>Talend</span>. For more information, check with your administrator.</li> <li>If the 8.0.1-R2022-05 <span>Talend Studio</span>                  monthly update or a later one delivered by <span>Talend</span>                  is not installed, you can enter primary keys in the <span>Java mode</span>                  only. </li> </ul> |
| Database ID | Enter the database name. |
| Collection ID | Enter the collection name. |
| Use query | Select this option to retrieve data using query statements. You can enter the query<br>statement in the Query field. |

## Advanced settings

| Properties | Description |
| --- | --- |
| tStatCatcher Statistics | Select this check box to collect the log data at the component level. |
| Connection mode | Specify the connection mode to be used. Two options are available: Gateway and DirectHttps. Click [ConnectionMode](https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.cosmosdb.connectionmode?view=azure-java-legacy) for related information. |
| Max connection pool size | Set the maximum connection pool size. The default is 1000. |
| Consistency level | Set the consistency level. Click [Consistency levels](https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels) for related<br>information. |

## Global Variables

| Variables | Description |
| --- | --- |
| ERROR\_MESSAGE | The error message generated by the component when an error<br>occurs. This is an After variable and it returns a string. |
| NB\_LINE | The number of rows processed. This is an After variable and<br>it returns an integer. |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | As a start component, tCosmosDBSQLAPIInput allows you to retrieve data from a collection in a Cosmos database through SQL API and transfer the data to the following component for display or storage. |
| **Cosmos DB limitation for HTTPS proxies with authentication** | HTTP proxies and HTTPS proxies work with the tSetProxy<br>component, however:<br><br><ul> <li>HTTPS proxies with authentication do not work with the <span>Use                              authorization</span> option in <span>tSetProxy</span>                           for this component. This is because the Cosmos DB SDK does not use Java’s                              <span>Authenticator</span> for HTTPS proxy tunneling and instead                           relies on JVM system properties.</li> <li>For this component to work with an authenticated HTTPS proxy, you must                           manually configure proxy credentials as JVM arguments in <span><span>Run</span><abbr> &gt; </abbr><span>Advanced Settings</span><abbr> &gt; </abbr><span>JVM arguments</span></span>: <pre><code><pre><code><code>-Dhttps.proxyUser=&lt;username&gt;-Dhttps.proxyPassword=&lt;password&gt;</code></code></pre></code></pre></li> </ul><br><br>Additional limitation: Proxy configuration is managed through global JVM system<br>properties, so using multiple, different proxy settings for different<br>components in the same Job is not recommended, as the configuration will not<br>work as intended. |