> For the complete documentation index, see [llms.txt](https://developer.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.collibra.com/tutorials/collibra-connect-upsert-operation.md).

# Collibra Connect upsert operation

{% hint style="warning" %}
Collibra Connect is End of Life and therefore no longer supported. This documentation is no longer maintained and is likely out of date, but it remains available for reference purposes.
{% endhint %}

This tutorial contains instructions on how to add data from a CSV file to Collibra Data Governance Center (Collibra DGC) by performing an upsert operation using Collibra Connect. An upsert is an operation where a resource is either updated if it already exists in Collibra DGC or created if it does not exist.

### Prerequisites

* Access to a Collibra DGC environment
* You have [installed](/tutorials/getting-started-with-collibra-connect.md#installation) MuleSoft Anypoint Studio with the CollibraDGC connector.

### Prepare the CSV file

The source of the upsert operation is a CSV file. We are using a short list of acronyms in this example as sample data.

For the operation to succeed you have to provide the following mandatory elements.

To create a new business term:

* The business term name.
* The domain the business terms belongs to.

  <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>The domain can be identified by name or the universally unique identifier (UUID).</p></div>

If the specified domain does not exit, it will be created and you have to provide the following mandatory elements.

To create a new domain:

* The domain name.
* The domain type.
* The community the domain belongs to.

  <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>The domain can be identified by name or UUID.</p></div>

If the specified community does not exist, it will be created and you have to provide:

* The community name.

The following table and text show the structure of the sample file:

| Name | Domain             | Domain Type | Community               |
| ---- | ------------------ | ----------- | ----------------------- |
| DGC  | New Business Terms | Glossary    | Data Governance Council |
| FAQ  | New Business Terms | Glossary    | Data Governance Council |
| GDPR | New Business Terms | Glossary    | Data Governance Council |

```
Name,Domain,Domain Type,Community
FAQ,New Business Terms,Glossary,Data Governance Council
DGC,New Business Terms,Glossary,Data Governance Council
GDPR,New Business Terms,Glossary,Data Governance Council
```

{% hint style="success" %}
Save the above as a CSV file to use later in the project
{% endhint %}

### Create a MuleSoft project

Open Anypoint Studio and create a new project:

{% stepper %}
{% step %}
Click **File** → **New** → **Mule Project**.

<img src="/files/QIlQpE3bPoIMl7hLPa82" alt="" width="50%">
{% endstep %}

{% step %}
Enter a name for your project and click **Next**. We are using *csv\_upsert* in this example.

<img src="/files/ocdhrl6mG5Dh1Ej27k4H" alt="" width="375">

{% hint style="info" %}
Blank spaces are not supported as part of the project name.
{% endhint %}
{% endstep %}

{% step %}
Leave all the default values and click **Next**.

<img src="/files/etwmhY73AGTWf0NVbte1" alt="" width="375">
{% endstep %}

{% step %}
Click **Finish**.

<img src="/files/iRhIGf1FaC2sm2LjIp71" alt="" width="375">
{% endstep %}
{% endstepper %}

<i class="fa-chevrons-right">:chevrons-right:</i> The project is created. The **Package Explorer**, **Palette** and **Connections Explorer** are populated.

### Create the connect flow

{% stepper %}
{% step %}
From the **Palette**, drag the **File** connector to the **Canvas**.

<img src="/files/f9K1S1aJkA6T3oCuqmmK" alt="" width="375">
{% endstep %}

{% step %}
From the **Palette**, drag the **Transform Message** component to the **Canvas**.

<img src="/files/eYzS6dhhil764Mb3MASk" alt="" width="375">
{% endstep %}

{% step %}
From the **Palette**, drag the **CollibraDGC** connector to the **Canvas**.

<img src="/files/XERHBpdTw30VY53962o6" alt="" width="375">
{% endstep %}
{% endstepper %}

### Configure the components

#### File connector configuration

A **File** connector placed at the beginning of a flow is set to behave like an inbound endpoint.

To configure the **File** connector:

{% stepper %}
{% step %}
Select the **File** connector on the **Canvas**.
{% endstep %}

{% step %}
In the **General** section, specify the path to the CSV file. We are using *src/main/resources/input* in this example.

<img src="/files/VbtHw3icribqquLrCocT" alt="" width="75%">

{% hint style="success" %}
To create the input folder:

1. In the **Package Explorer**, right click the resources folder and select **New Folder**.
2. Type the name of the folder you wish to create and click Finish.
   {% endhint %}
   {% endstep %}

{% step %}
In the **General** section click the green **+** sign to create a new **Connector Configuration**.

<img src="/files/AeA3VyUsujlY2TmwXKLQ" alt="" width="75%">
{% endstep %}

{% step %}
In the **Global Element Properties** window, click **OK**.

<img src="/files/X5cFLBpof76pNx9MpqxU" alt="" width="303">
{% endstep %}

{% step %}
In the **Metadata** section, click **Add metadata** and then click the edit icon to add a new metadata type.

<img src="/files/YXmPFsTRZJnvEOTxUvtm" alt="" width="375">
{% endstep %}

{% step %}
In the **Select metadata type** window, click **Add**.
{% endstep %}

{% step %}
Type the name of the metadata type and click **Create type**. We are using *Asset\_by\_name* in this example.

<img src="/files/4LldyDS7ZngWZikgocw0" alt="" width="365">
{% endstep %}

{% step %}
From the **Type** drop-down select **CSV**.

<img src="/files/mJmdfRFg7nefZzOhlCNL" alt="" width="365">
{% endstep %}

{% step %}
In the **Sample File** field, select the file you have created.

<img src="/files/aXRLHWrOSW3bl01Y9Zon" alt="" width="365">

<i class="fa-chevrons-right">:chevrons-right:</i> The metadata is retrieved from the file.
{% endstep %}

{% step %}
In the **Select metadata type** window, click **Select**.
{% endstep %}
{% endstepper %}

#### CollibraDGC connector configuration

The CollibraDGC connector is used to establish a direct connection to the Collibra Data Governance Center.

To configure the CollibraDGC connector:

{% stepper %}
{% step %}
Select the CollibraDGC connector on the **Canvas**.
{% endstep %}

{% step %}
In the **General** section click the green **+** sign to create a new **Connector Configuration**.
{% endstep %}

{% step %}
In the **Global Element Properties** window, in the **General** tab, enter the connection details of your Collibra DGC environment:

* **Username**
* **Password**
* **Base Application Url**

<img src="/files/FRATDwLK4YnlBCIdSJfU" alt="" width="303">

{% hint style="success" %}
Use the **Test Connection...** feature to test the connection to Collibra DGC.
{% endhint %}
{% endstep %}

{% step %}
Click **OK** to save the configuration.
{% endstep %}

{% step %}
In the **General** section, from the **Operation** drop-down list select **Upsert assets by name**.

<img src="/files/S4LW2ZqrlNoeFmho0E5I" alt="" width="75%">
{% endstep %}

{% step %}
From the **Asset Type Id** drop-down list, select **Acronym**.

<img src="/files/NSRJ0wH4YZsKNGF3QEBs" alt="" width="75%">
{% endstep %}
{% endstepper %}

The **Transform Message** component takes the output of the **File** connector and transforms it into the expected input for the CollibraDGC connector. Since you configured both connectors, their metadata is already loaded into the **Transform Message** component. To configure it, drag the fields from the input section over the corespondent fields in the output section:

<img src="/files/Hm4OdtTOnZmhUYJnKl2w" alt="" width="75%">

<i class="fa-chevrons-right">:chevrons-right:</i> As you create the connections, the **Transform Message** component builds the required code.

<img src="/files/npG3NVO8NWapMXSLjRCZ" alt="" width="364">

Save your project.

### Run the application

To start the application in your development environment, right-click on the **Canvas** and select **Run project csv\_upsert**.

<img src="/files/11LyCfVT1zZBoibLa0p4" alt="" width="25%">

<i class="fa-chevrons-right">:chevrons-right:</i> If there are no errors, the console will show that the application has started.

<img src="/files/SkhSXUD3qMICQ8cmZaO0" alt="" width="75%">

To perform the upsert operation, copy the CSV file to the *src/main/resources/input* folder.

{% hint style="success" %}
You can use the **Package Explorer** to paste or drop the file.
{% endhint %}

If there are no errors, the contents of the CSV file are upserted to Collibra DGC, in the Business Glossary application, under the **All Business Assets** view.

![](/files/DtXiBjOxU7usYkevARWa)

In case of errors, check the console output as it contains details about what went wrong.

To stop the application, right click on the **Canvas** and select **Stop project csv\_upsert**.

<img src="/files/a0qVfm52KTa2vD2hV7xj" alt="" width="25%">

### Next Steps

Add a definition to the CSV file, reload the CSV metadata and map the new column to the corresponding field fort the CollibraDGC connector input.

```
Name,Definition,Domain,Domain Type,Community
FAQ,Frequently Asked Questions,New Business Terms,Glossary,Data Governance Council
DGC,Data Governance Center,New Business Terms,Glossary,Data Governance Council
GDPR,General Data Protection Regulation,New Business Terms,Glossary,Data Governance Council
```

![](/files/9FqFp0YGhbqvhvFWfQqf)
