# put\_task\_table\_selection

Overrides the list of tables selected for inclusion in a specific Replicate task.

## Required user role

See [Required Enterprise Manager permissions](https://help.qlik.com/en-US/enterprise-manager/November2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Introduction/AEMPermissions.htm).

## Syntax

`def set_task_table_selection(
` `self,
` `payload,
` `server,
` `task
` `)`

## Call parameters

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| payload | TableSelectionDefinition | The table selection definitions. |
| server | string | The Replicate Server name as defined on Qlik Enterprise Manager.<br><br>Example: myrepsrv1 |
| task | string | The Replicate task for which to change the selected tables. |

## Payload attributes

The following attributes can be included in the payload:

* List&lt;TableSelection&gt; IncludedPattern: Tables matching this pattern will be included
* List&lt;TableSelection&gt; ExcludedPattern: Tables matching this pattern will be excluded
* List&lt;TableSelection&gt; ExplicitIncludedTables: Tables matching this name will be included

## Payload class

The following are part of the TableSelection class:

* Owner (string): The table schema or owner
* Name (string): Tables to include or exclude according to the attribute: IncludedPattern, ExcludedPattern, or ExplicitIncludedTables
* LoadOrder (int): The order in which the tables will be loaded to the target. "0" means random order. See [Load order](https://help.qlik.com/en-US/enterprise-manager/November2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/Shared/aem_rest_api_response_params.htm#Load_order) for additional enums that can be used to define the load order. You can also use StandardLoadOrder.priority.value where priority should be replaced with one of the following: LOWEST, LOW, NORMAL, HIGH, HIGHEST.
* TableType (TableType enum): The entity type. Can be view or table.

## Example payload

```
table_selection_definition = TableSelectionDefinition()
table = TableSelection()
table.owner = 'schema%'
table.name = 'ab%yz%'
table.load_order = StandardLoadOrder.LOWER.value
table_selection_definition.included_pattern.append(table)
			
table = TableSelection()
table.owner = 'schema3'
table.name = 'abcd%'
table_selection_definition.excluded_pattern.append(table)
			
table = TableSelection()
table.owner = 'schema1'
table.name = 'tbl1'
table_selection_definition.explicit_included_tables.append(table)
			
table = TableSelection()
table.owner = 'schema1'
table.name = 'view1'
table.load_order = StandardLoadOrder.HIGH.value
table.table_type = TableType.VIEW
table_selection_definition.explicit_included_tables.append(table)
			
self.aem_client.put_task_table_selection(table_selection_definition, 'server1', 'task1')
```

## Errors

All of the [general errors](https://help.qlik.com/en-US/enterprise-manager/November2025/Content/EnterpriseManager/EnterpriseManager_APIGuide/PythonAPI/error_handling.htm) as well as the errors listed in the table below.

Error responses

| HTTP Code | Enterprise Manager Code | Text | Description |
| --- | --- | --- | --- |
| 500 | AEM\_TASK\_NOT\_FOUND | Replicate task {task} on server {server} could not be found. | The task name is unknown to Enterprise Manager. |