Run a Custom Connector Without Building an Image
A custom connector is a Python class that the ingestion process imports by name. Instead of building a new ingestion image that contains your code, keep the published ingestion image and mount your connector code into it:- Kubernetes with Argo Workflows: store the code in a ConfigMap. Collate adds it to every ingestion pod it runs.
- Docker Compose: mount a local directory into the
ingestion(Airflow) container.
How It Works
The ingestion framework imports the class set in Source Python Class Name (sourcePythonClass) with a
regular Python import. Any module on the Python path of the ingestion process can be imported, so two settings
are enough:
- A volume that mounts your connector code into the ingestion container.
- A
PYTHONPATHenvironment variable that points at the mounted directory.
The mount only adds your code. If the connector needs a Python library that isn’t in the ingestion image, install
it in the image, for example with a custom ingestion image.
Kubernetes with Argo Workflows
This applies to Collate deployments that you manage with Helm on Kubernetes, where ingestion runs on Argo Workflows. For each pipeline, Collate creates an Argo workflow. You give Collate two YAML files that it merges into every workflow it creates:- A workflow spec file that adds a volume with your connector code.
- A container spec file that mounts the volume in the ingestion container and sets
PYTHONPATH.
1
Store the Connector Code in a ConfigMap
Create a ConfigMap with your connector modules in the namespace where Argo runs the ingestion workflows, which is
the Each file in
ARGO_NAMESPACE of your deployment (argo by default):connectors/ becomes a module at the top level of the mount, for example my_database.py defines
the my_database module. A ConfigMap holds the files of a single directory and up to 1 MiB of data. For packages
with subdirectories or larger code, use another volume type in the next step, such as a PersistentVolumeClaim.To try this out, use the Custom Database connector example,
a single self-contained file.2
Create the Workflow and Container Spec Files
Create a Create a Collate adds these settings to every ingestion workflow, not only to the ones for your custom connector.
workflow-spec.yaml file that adds the ConfigMap as a volume:container-spec.yaml file that mounts the volume and puts it on the Python path:optional: true keeps the other pipelines running if the custom-connectors ConfigMap doesn’t exist. Without
it, every ingestion pod waits for the missing ConfigMap and never starts.Store both files in a ConfigMap in the namespace where Collate runs:3
Point Collate at the Spec Files
Add the following to your Helm values. It mounts the files in the Collate pods and sets the
The chart applies these values to the Collate server, to the database migrations container, and to the
scheduled deploy and reindex jobs. All of them read the files, so set the environment variables and the mount
together. If a process has the environment variables but not the files, it fails with
For the other Helm values, see Kubernetes Helm Values.
ARGO_INGESTION_WORKFLOW_SPEC_FILE_PATH and ARGO_INGESTION_CONTAINER_SPEC_FILE_PATH environment variables:Failed to load ingestion workflow spec config file.Then upgrade the release:4
Redeploy Existing Pipelines
Collate builds the Argo workflow of a pipeline when it deploys the pipeline. Pipelines deployed before you added
the spec files don’t have the mount until you redeploy them. New pipelines get it when you create them.
Update the Connector Code
Replace the ConfigMap content:Docker Compose
This applies to Docker Compose deployments where ingestion runs in theingestion (Airflow) container. Airflow
passes the container environment to every task, so pipelines triggered from the UI can import the connector.
1
Place the Connector Code in a Directory
Put your connector modules in a directory next to your To organize the code as a package, add a subdirectory with an
docker-compose.yml, for example connectors/:__init__.py file, for example
connectors/my_package/__init__.py.2
Mount the Directory in the Ingestion Container
Create a Then start the stack, or recreate the
docker-compose.override.yml file next to docker-compose.yml. Docker Compose merges it with the main
file automatically:ingestion container if it’s already running:3
Verify the Module Can Be Imported
Check that Python inside the container imports the module from the mounted directory:The output should be
/opt/airflow/custom_connectors/my_database.py.Update the Connector Code
Each pipeline run imports the connector again, so changes to files inconnectors/ are used by the next run.
You don’t need to restart the container or redeploy the pipeline.
Configure the Service
Create a Custom Database service that points to your connector class:- In the left navigation, click Connections.
- Click Add New Service.
-
From the service type dropdown, select Database Services, then click the Custom Database connector card.

- Enter a unique Service Name.
- Select an Ingestion Runner.
-
In Source Python Class Name, enter the module and class name relative to the mounted directory:
my_database.MyDatabaseSourceformy_database.py.my_package.my_database.MyDatabaseSourceformy_package/my_database.py.

- Configure What to Ingest, then click Create & Deploy to run it.