How to Enable Syncs Only for the Columns You Need
Use Case
You have a source with multiple columns.
You have disabled syncs for a single column, column_1
:
Request
GET https://api.fivetran.com/v1/connectors/connector_id_1/schemas/schema_1/tables/table_1/columns
Response
HTTP 200 OK
{
"code": "Success",
"columns": {
"column_1": {
"name_in_destination": "column_1",
"enabled": false,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
}
}
}
Syncing is enabled for every other columns by default, they will be synced in the next connector sync cycle.
You want to enable syncs only for one column, column_3
.
Recommendation
Retrieve source table columns config
First, you must know all column names of your table. Use the Retrieve source table columns config endpoint to fetch all the column names.
Request
GET https://api.fivetran.com/v1/connectors/connector_id_1/schemas/schema_1/tables/table_1/columns
Response
HTTP 200 OK
{
"code": "Success",
"columns": {
"column_1": {
"name_in_destination": "column_1",
"enabled": false,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
},
"column_2": {
"name_in_destination": "column_2",
"enabled": true,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
},
"column_3": {
"name_in_destination": "column_3",
"enabled": true,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
}
}
}
Modify connector table config
Once we know column names, we can explicitly exclude from the sync the columns we do not want to be synced and include the ones we need through the Modify a connector table config endpoint.
Request
PATCH https://api.fivetran.com/v1/connectors/connector_id_1/schemas/schema_1/tables/table_1
{
"enabled": true,
"columns": {
"column_1": {
"enabled": false,
"hashed": false
},
"column_2": {
"enabled": false,
"hashed": false
},
"column_3": {
"enabled": true,
"hashed": false
}
}
}
Response
HTTP 200 OK
{
"code": "Success",
"data": {
"enable_new_by_default": true,
"schema_change_handling": "ALLOW_ALL",
"schemas": {
"schema_1": {
"name_in_destination": "schema_1",
"enabled": true,
"tables": {
"table_1": {
"name_in_destination": "table_1",
"enabled": true,
"enabled_patch_settings": {
"allowed": true
},
"columns": {
"column_1": {
"name_in_destination": "column_1",
"enabled": false,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
},
"column_2": {
"name_in_destination": "column_2",
"enabled": false,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
},
"column_3": {
"name_in_destination": "column_3",
"enabled": true,
"hashed": false,
"enabled_patch_settings": {
"allowed": true
}
}
}
}
}
}
}
}
}