Publishing enrichments with Datagrok plugins
Overview
Datagrok plugins can include enrichments that let users join additional database fields to a table with one click.
Enrichments are defined as JSON files and can be bundled with plugins.
Note: PowerPack plugin should be installed to use the Enrichments feature.
Where to put enrichments
Place enrichment JSON files in the plugin’s enrichments/ folder:
my-plugin/
└─ enrichments/
└─ my-enrichment.json
Datagrok loads these files automatically when the plugin is published.
Enrichment JSON Format
Each file defines one enrichment:
{
"name": "Company info",
"connection": "Dbtests:Northwind",
"keySchema": "public",
"keyTable": "orders",
"keyColumn": "customerid",
"fields": [
"public.customers.companyname",
"public.customers.contacttitle"
],
"joins": [
{
"leftTableName": "public.orders",
"rightTableName": "public.customers",
"joinType": "left",
"leftTableKeys": ["customerid"],
"rightTableKeys": ["customerid"]
}
]
}
Fields
| Field | Description |
|---|---|
name | Display name shown to users |
connection | Database connection nqName |
keySchema | Schema of the key table |
keyTable | Key table |
keyColumn | Key column |
fields | Columns to retrieve (schema.table.column) |
joins | Table join definitions |
The connection can be one that the plugin ships or any existing connection that the user who publishes the plugin can see. If Datagrok can't find it, the publish fails.
Joins
Each join specifies how tables are connected:
leftTableName,rightTableName: fully qualified table namesjoinType: left, inner, rightleftTableKeys,rightTableKeys: join columns
Conclusion
After publishing, the enrichment appears in the column context panel and can be applied with one click.
See also: