Folder structure
To register custom sources and destinations in your Mage Pro project, organize your project directory as follows:- Create a
data_integrationsfolder 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__.pyfile with the integration class - A
README.mdfor documentation - A
templates/directory with aconfig.jsonfile for default configuration
- An
- Define a
metadata.yamlfile in each of the sources/ and destinations/ folders to register the integrations with Mage Pro.
Register custom sources and destinations
To register your custom sources or destinations, create or update themetadata.yaml file inside the
respective sources/ or destinations/ subfolders under data_integrations.
📘 Example: sources/metadata.yaml
destinations/metadata.yaml
name: Display name shown in the Mage UI dropdown.module_name(optional): The class name defined in the source’s__init__.pyfile. Defaults to thenamefield 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 frommage_integrations to data_integrations like so:
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:
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’sdiscover_streams method:
- Ensure the
configyou 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.