What are custom plugins?
Custom plugins let you change what a unified schema connector exports without replacing its transformation script. A plugin is a Python file that receives one unified table as a pandas DataFrame just before hotglue exports it. It returns the DataFrame, with any changes you made. Common uses include:- Adding a column, such as a tenant-specific label
- Removing rows that a tenant does not want to sync
- Filling in a default value from the connector’s configuration
- Changing the primary keys sent with the exported table
The Custom Plugins tab is only shown for connectors that use the unified schema, and only when custom plugins are enabled for your organization. Contact hotglue support if you don’t see the tab.
How plugins run
When a job runs, hotglue downloads the connector’s plugins into aplugins folder beside the transformation script. Each time the unified script exports a table, it looks for a plugin named after that table and calls the plugin’s main function:
- A plugin runs after the source data has been mapped to the unified model, and before the table is written to
etl-output. - A table without a matching plugin is exported unchanged.
- If a plugin raises an error, the export stops and the job fails with
ETL_FAILED. The error appears in the job logs.
Name the plugin file
Name each plugin{Table}_post_process.py, where {Table} is the unified table name, such as Accounts, Vendors, or Bills. One file handles one table.
Write the main function
Each plugin must define a top-level main function with exactly this signature:
tenant_config={} default must match.
Arguments
Return value
main must return a tuple of three values: (df, model, key_properties).
dfmust be a pandas DataFrame. ReturningNoneor a DataFrame on its own fails the job.- Return
modelandkey_propertiesunchanged unless you want to change them. The values you return are used for the export. - If you add columns to
df, hotglue adds them to the exported schema as optional fields. You don’t need to changemodel.
Context
Read configuration files
A plugin can read the same configuration files as a transformation script. Build paths fromcontext["ROOT_DIR"] and context["SNAPSHOT_DIR"]:
These files can contain credentials. Don’t print or log their values.
Always check that a file exists before you read it. This lets the same plugin run in both read and write jobs.
Examples
Return the table unchanged
The smallest valid plugin.Accounts_post_process.py
Add a column from the tenant config
This plugin readsregion from the tenant config and adds it to every account as a new tenantRegion column. The new column is added to the exported schema automatically.
Accounts_post_process.py
{"region": "EMEA"}, every exported account has "tenantRegion": "EMEA".
Read the tenant config file from snapshots
tenant_config contains the same data as tenant-config.json. You can also read the file directly, which is useful when you reuse code from your transformation scripts:
Accounts_post_process.py
Use config.json and change the primary keys
config.json is always the connector’s own config, in both read and write jobs. This plugin adds the connector’s company_id setting as a column and makes it part of the primary key:
Accounts_post_process.py
Upload and manage plugins
In the dashboard
- Open your flow and select the connector.
- Select the Custom Plugins tab.
- Click Upload, or drag
.pyfiles into the tab, then click Upload again to save them.
With the API
The plugin endpoints use your environment’s API key in thex-api-key header. Use default as the tenant to manage the plugins shared by every tenant. Use connectors as the entity type for v2 flows, and taps for v1 flows.
DELETE with an empty body ({}) deletes all plugins for the connector and tenant.