# Retrieve Information from Event Tables

To retrieve content from an event table, create a new fetch task by following these steps. The connector runs fetch tasks automatically, based on the schedule that is configured in the configuration file.

To retrieve information from an event table

1. Stop the connector.
2. Open the configuration file in a text editor.

3. In the `[FetchTasks]` section of the configuration file, specify the number of fetch tasks using the `Number` parameter. If you are configuring the first fetch task, type `Number=1`. If one or more fetch tasks have already been configured, increase the value of the `Number` parameter by one (1). Below the `Number` parameter, specify the names of the fetch tasks, starting from zero (0). For example:

       [FetchTasks]
       Number=3
       0=EventTableAdd
       1=EventTableUpdate
       2=EventTableRemove

4. Below the `[FetchTasks]` section, create a new TaskName section. The name of the section must match the name of the new fetch task.

5. In the new section, set the following parameters:

   `ConnectionString` | The connection string to use to connect to the database.
   `EventTableType` | The type of operation to perform for each document that is returned by the query. To configure all three types of ingest operation, configure three separate fetch tasks. `add` - add a new document to the index. `update` - update an existing document. This option supports both metadata and content changes. If the content has changed the connector performs an ingest-replace. `remove` - delete an existing document.
   `SQL` | The SQL query to use to return data from the event table.
   `DeleteEventSql` | The SQL query to use to delete information from the event table after it has been ingested. The connector replaces the placeholder `@Clause` with a clause that identifies the rows that have been ingested. If you use the same table for storing adds, updates, and deletes, ensure that your `DeleteEventSql` queries do not delete rows corresponding to other operations/tasks.
   `PrimaryKeys` | The column, or combination of columns, to use as the primary key for the table. The value of this parameter is case-sensitive.
   `Template` | (Optional) The template file used to form the documents that are ingested. For information about how to create a template file, see Construct Template Files. Micro Focus recommends that you use the same template for `EventTableType=add` and `EventTableType=update`. You can also use the same template with `EventTableType=remove`, but this template only needs to include the `DREREFERENCE` document field.

   For example:

       [FetchTasks]
       Number=3
       0=EventTableAdd
       1=EventTableUpdate
       2=EventTableRemove

       [EventTableAdd]
       ConnectionString=...
       EventTableType=add
       SQL=SELECT id, content FROM event_adds
       DeleteEventSql=DELETE FROM event_adds WHERE @Clause
       PrimaryKeys=id
       Template=document.tmpl

       [EventTableUpdate]
       ConnectionString=...
       EventTableType=update
       SQL=SELECT id, content FROM event_updates
       DeleteEventSql=DELETE FROM event_updates WHERE @Clause
       PrimaryKeys=id
       Template=document.tmpl

       [EventTableRemove]
       ConnectionString=...
       EventTableType=remove
       SQL=SELECT id FROM event_deletes
       DeleteEventSql=DELETE FROM event_deletes WHERE @Clause
       PrimaryKeys=id
       Template=remove.tmpl

6. Save and close the configuration file. You can now start the connector.

_FT_HTML5_bannerTitle.htm