<@U04S8PLJWMT> can i update config when i run the ...
# ask-ai
a
@kapa.ai can i update config when i run the connector
k
Yes, you can update the configuration when running a connector in Airbyte, but how you do this depends on your use case and the context: - For standard Airbyte usage (UI/API): You can modify the connector configuration before running a sync by editing the connection settings in the Airbyte UI or via the Airbyte API. Once you update the configuration and save it, the next sync will use the new configuration. This is the standard way to update connector configs for production or managed connections. - For config-based connectors (YAML): If you are developing a config-based connector, you can use dynamic mapping in the YAML file to update or add fields in a record or configuration at runtime. The
ComponentMappingDefinition
allows you to interpolate values into the template based on provided contexts (such as config, stream_slice, etc.), enabling dynamic updates to the config as the connector runs. This is an experimental feature and should be used with caution. For example:
Copy code
yaml     field_path:       - "retriever"       - "requester"       - "url"     value: "{{ config['api_url'] }}"
This would dynamically set the URL based on the current config value at runtime. You can also use variables like
stream_slice
or
components_values
for more advanced dynamic behavior. Note that this is primarily for connector developers, not for end users updating configs during a sync via the UI or API [ComponentMappingDefinition (Next)](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/ComponentMappingDefinition). - Live config changes during a running sync: The knowledge sources do not mention the ability to change the configuration of a connector while a sync is already in progress. Configuration changes are applied before the sync starts and are used for the duration of that sync. In summary: you can update the config before running the connector, and for config-based connectors, you can use dynamic mappings to adjust config values at runtime within the connector logic. However, you cannot change the config in the middle of an already running sync based on the available documentation.
a
@kapa.ai I mean is it possible during the running of the connector to update some parameter from false to true in the source spec?
k
A message from kapa.ai
Yes, it is possible for a connector to update its configuration during a sync by emitting an
AirbyteControlMessage
of type
CONNECTOR_CONFIG
. This mechanism allows the connector to signal to the Airbyte platform that it wants to update its configuration (for example, changing a parameter from
false
to
true
) while the sync is running. Here’s how it works: - The connector emits an
AirbyteControlMessage
with a
connectorConfig
payload containing the updated configuration. - The Airbyte orchestrator will merge the new config with the existing one, as long as the updated config conforms to the connector's specification schema. - If the config does not conform to the schema, the orchestrator will raise an exception and terminate the sync. Example: If your current config is
{"feature_enabled": false}
and you emit the following message during the sync:
Copy code
json {   "type": "CONNECTOR_CONFIG",   "emitted_at": <current_time>,   "connectorConfig": {     "config": {       "feature_enabled": true     }   } }
The persisted configuration will be updated to
{"feature_enabled": true}
for the remainder of the sync and future runs, provided it matches the spec schema [AirbyteControlMessage documentation](https://docs.airbyte.com/platform/understanding-airbyte/airbyte-protocol#airbytecontrolmessage). Note: This feature is particularly useful for scenarios like refreshing short-lived credentials, but it can be used for any config parameter defined in the connector spec. For more details, see the official documentation on [AirbyteControlMessage](https://docs.airbyte.com/platform/understanding-airbyte/airbyte-protocol#airbytecontrolmessage).