Skip to main content

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​

FieldDescription
nameDisplay name shown to users
connectionDatabase connection nqName
keySchemaSchema of the key table
keyTableKey table
keyColumnKey column
fieldsColumns to retrieve (schema.table.column)
joinsTable 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 names
  • joinType: left, inner, right
  • leftTableKeys, rightTableKeys: join columns

Conclusion​

After publishing, the enrichment appears in the column context panel and can be applied with one click.

See also: