> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Choreo

> This page outlines the steps to connect Choreo to your Connect AI account.

## Prerequisites

Before you connect, you must first do the following:

* Connect a data source to your Connect AI account. See [Sources](/en/Sources) for more information.
* Generate a Personal Access Token (PAT) on the [Settings](/en/Settings#personal-access-tokens) page. Copy this down, as it acts as your password during authentication.

## Connect to Connect AI in Choreo

<Steps>
  <Step>
    Sign in to the [Choreo platform](https://console.choreo.dev/).
  </Step>

  <Step>
    Click **Manual Trigger** to create a program that you can execute manually.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_manualtrigger.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=683cc4b3508a9d522a52dc995ce0dbea" alt="" width="2052" height="1002" data-path="en/images/choreo_manualtrigger.png" />
    </Frame>
  </Step>

  <Step>
    Enter a **Name** and **Description** for the manual trigger and click **Create**.

    <Frame>
      <img src="https://mintcdn.com/cdata/dLO4dOBGO5Ysdj01/en/images/choreo_create.png?fit=max&auto=format&n=dLO4dOBGO5Ysdj01&q=85&s=f12f82f34f63709441f85b2ef157e9ff" alt="" width="2052" height="1000" data-path="en/images/choreo_create.png" />
    </Frame>
  </Step>

  <Step>
    The manual trigger opens in the **Develop** view.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_developview.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=4298a012a7ad5b2d358ed5ea5f983c80" alt="" width="2052" height="998" data-path="en/images/choreo_developview.png" />
    </Frame>
  </Step>

  <Step>
    Click **Edit Code** to open the low-code diagram view.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_editcode.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=9c193b7b5946e88ae8ac2f727476366b" alt="" width="968" height="591" data-path="en/images/choreo_editcode.png" />
    </Frame>
  </Step>

  <Step>
    Choreo automatically generates a construct in the low-code diagram view. Delete this construct by highlighting it and clicking the delete icon.

    <Frame>
      <img src="https://mintcdn.com/cdata/dLO4dOBGO5Ysdj01/en/images/choreo_deleteconstruct.png?fit=max&auto=format&n=dLO4dOBGO5Ysdj01&q=85&s=32b781b0102397729027089be6f2ce3a" alt="" width="1280" height="769" data-path="en/images/choreo_deleteconstruct.png" />
    </Frame>
  </Step>

  <Step>
    Choreo prompts you to create a new construct. Click the indicated button to open a list of options, then select **Main**.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_main.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=b9be8bae5ad4af158a7bb35525518b58" alt="" width="742" height="710" data-path="en/images/choreo_main.png" />
    </Frame>
  </Step>

  <Step>
    Click **Save** in the settings pane that appears.
  </Step>

  <Step>
    The main construct appears in the diagram view. In the menu that appears under **Start**, click **Connector**.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_startconnector.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=5d6850e514b5e2c3f6e502134ab4dd23" alt="" width="1076" height="1083" data-path="en/images/choreo_startconnector.png" />
    </Frame>
  </Step>

  <Step>
    In the **Connectors** dialog, search for *CData*. Click **CData Connect** to open the **Connector** settings pane.

    <Frame>
      <img src="https://mintcdn.com/cdata/dLO4dOBGO5Ysdj01/en/images/choreo_cdataconnect.png?fit=max&auto=format&n=dLO4dOBGO5Ysdj01&q=85&s=6677479ca91eee48142d49331bddb3ba" alt="" width="1729" height="844" data-path="en/images/choreo_cdataconnect.png" />
    </Frame>
  </Step>

  <Step>
    In the **Connector** settings pane, enter the configuration settings:

    * Enter an **Endpoint Name** for your use.
    * In the **User** field, enter the email address of the Connect AI user, wrapped in quotation marks (for example, *"[user@cdata.com](mailto:user@cdata.com)"*).
    * In the **Password** field, enter the [PAT you generated earlier](#prerequisites), wrapped in quotation marks (for example, *"SampleToken"*).

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_logincredentials.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=a395dfa3d88723eac2f29140dbc337cb" alt="" width="1724" height="1128" data-path="en/images/choreo_logincredentials.png" />
    </Frame>
  </Step>

  <Step>
    Click **Save Connection** to save your settings.
  </Step>
</Steps>

The Connect AI connector appears in both the low-code diagram view and the source code view of the code editor.

<Frame>
  <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_dualview.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=7032b496b556d1a35f16f994c87a46d3" alt="" width="1694" height="812" data-path="en/images/choreo_dualview.png" />
</Frame>

You can now add connector Actions to your application logic.

## Use Connector Actions in Choreo

To add an Action to your application logic, click the **+** icon between the **new** and **End** nodes.

<Frame>
  <img src="https://mintcdn.com/cdata/dLO4dOBGO5Ysdj01/en/images/choreo_addbetween.png?fit=max&auto=format&n=dLO4dOBGO5Ysdj01&q=85&s=b48f9c416dc2a19e0e34940856cabca7" alt="" width="857" height="776" data-path="en/images/choreo_addbetween.png" />
</Frame>

In the menu that appears, click **Action**.

<Frame>
  <img src="https://mintcdn.com/cdata/dLO4dOBGO5Ysdj01/en/images/choreo_addaction.png?fit=max&auto=format&n=dLO4dOBGO5Ysdj01&q=85&s=7a1522e3f16b9de0bedf56a8c1cff38d" alt="" width="1266" height="770" data-path="en/images/choreo_addaction.png" />
</Frame>

The Connect AI connector supports the following operations:

* **query**—[query data](#query-action) from your data sources
* **queryRow**—query data from a single row of a data source
* **execute**—perform DML and DDL operations
* **batchExecute**—perform a batch of DML and DDL operations
* **call**—execute a stored procedure

For more information about working with these operations, see the [CData Connect Ballerina Guide](https://github.com/ballerina-platform/module-ballerinax-cdata.connect/blob/main/ballerina/Module.md#quickstart).

### Query Action

Follow these steps to configure a query action:

<Steps>
  <Step>
    Select **query** for the connector **Operation**.
  </Step>

  <Step>
    Enter your query in the **SqlQuery** box.

    * When writing the query, be sure to specify the **Connection Name** and **Data Source Name** of the data source you want to query. For example, `Salesforce1.Salesforce`.
    * These parameters appear on the [Sources](/en/Sources) page of your Connect AI dashboard.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_sqlquery.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=72b8083efa186f588c8eeeb049e20b08" alt="" width="453" height="1005" data-path="en/images/choreo_sqlquery.png" />
    </Frame>
  </Step>

  <Step>
    Click **Save** to save the action.
  </Step>
</Steps>

## Deploy the Program

Once you have added all of your desired actions to your program, follow these steps:

<Steps>
  <Step>
    Commit and push your final source code in the web editor and sync those changes with the Choreo platform.
  </Step>

  <Step>
    Click **Deploy** in the left navigation bar of the Choreo Console.
  </Step>

  <Step>
    Under **Build Area**, click **Configure & Deploy** to deploy your program.
  </Step>

  <Step>
    When prompted, enter the same Connect AI username and password that you used earlier and click **Deploy**.

    <Frame>
      <img src="https://mintcdn.com/cdata/dJhcR4yZCQgD8aFQ/en/images/choreo_deploy.png?fit=max&auto=format&n=dJhcR4yZCQgD8aFQ&q=85&s=5c834bc36c97c54405cc88556bc1a49f" alt="" width="2052" height="885" data-path="en/images/choreo_deploy.png" />
    </Frame>
  </Step>
</Steps>

## More Information

For more information about using Choreo with Connect AI, see the [CData Connect Ballerina Guide](https://github.com/ballerina-platform/module-ballerinax-cdata.connect/blob/main/ballerina/Module.md#quickstart).
