Custom source
Easily plug in your own data integration sources and destinations with Mage Pro.
Try our fully managed solution to access this advanced feature.
Mage Pro makes it easy to integrate your own custom data integration sources and destinations.
To get started, follow the adapt an existing source guide or the add a new source guide to create your custom integration.
Once your custom source or destination is ready, simply include it in your Mage Pro project by adding it to the appropriate folder as shown below.
Folder structure
To register custom sources and destinations in your Mage Pro project, organize your project directory as follows:
Instructions
- Create a
data_integrations
folder inside your project directory. - Inside data_integrations, create two subfolders:
sources
: for your custom data source integrationsdestinations
: for your custom data destination integrations
- Each source/destination should have its own folder (e.g.,
custom_source_1
) containing:- An
__init__.py
file with the integration class - A
README.md
for documentation - A
templates/
directory with aconfig.json
file for default configuration
- An
- Define a
metadata.yaml
file in each of the sources/ and destinations/ folders to register the integrations with Mage Pro.
This structure allows Mage Pro to discover and load your custom integrations dynamically.
Register custom sources and destinations
To register your custom sources or destinations, create or update the metadata.yaml
file inside the
respective sources/
or destinations/
subfolders under data_integrations
.
📘 Example: sources/metadata.yaml
📘 Example: destinations/metadata.yaml
Field descriptions
name
: Display name shown in the Mage UI dropdown.module_name
(optional): The class name defined in the source’s__init__.py
file. Defaults to thename
field with spaces removed.uuid
(optional): Folder name of the source. Defaults to the lowercasedname
, with spaces replaced by underscores.
Code modification
Unlike the add a new source guide (which adds sources to the Mage core), using custom sources in your project requires updating import paths to point to your project-level modules.
Update any imports from mage_integrations
to data_integrations
like so:
This change ensures that Mage loads and uses your custom integration from the project folder instead of the built-in Mage package.
Testing Your Custom Source
To test your custom data source integration:
- Create a new data integration pipeline.
- Select your custom source from the source dropdown.
- Custom sources appear at the bottom of the list in the UI.
- Enter your source configuration.
- Click “Test connection” if your custom source class implements the test_connection method.
- Click “View and select stream” to verify that the expected streams are returned.
- Add a destination and run the pipeline using a trigger to test end-to-end data flow.
Troubleshooting: Source Not Appearing in UI?
If your custom source isn’t showing up in the Data Integration source dropdown, follow these steps to debug:
- Create a pipeline and add a scratchpad block.
- Run the following code in the block to inspect the custom sources:
- Try importing your custom module manually to ensure it’s discoverable and error-free:
Replace source_uuid
and SourceModuleName
with the actual folder name and class name of your custom source.
Troubleshooting: “View and select stream” Not Working?
If clicking “View and select stream” in the UI doesn’t return any streams, you can manually debug the discovery step using a scratchpad block in your pipeline.
Run the following code to test your custom source’s discover_streams
method:
What to check
- Ensure the
config
you provide contains all required fields expected by your source class. - If
discover_streams()
returns an empty list or raises an error, check your source implementation or credentials.