Documentation

gitHub

Pre-populate new entities using snippets

To avoid the repetitive task of adding the same set of attributes to new entities as you create a model, you may leverage reusable definitions.  But there's another option to pre-populate new entities with the same structure, through JSON configuration, using the concept of snippets.

 

A good example use case would be if your governance standards require to separate metadata header information about a document/record, from data intended for consumption by external processes.  Metadata header information may include: schema version, provenance, transformation rules, etc.

Image

 

Another example could be the creation of a section for canonical data, separate from the idiomatic data coming from the source.  Say that you have multiple systems feeding a collection, using different labels for the same type of information: zip, zipcode, postcode, postal code.  You wish to keep the source of data as-is, yet be able to query or index the data despite the different labels across documents.  You could store the canonical data in a separate section such as:

Snippet canonical

 

The configuration is done for each target in the folder:

  • Windows: C:\Users\%username%\.hackolade\options\<target>\customProperties
  • Mac/Linux: ~/.hackolade/options/<target>/customProperties

 

This folder can be access via Help > Plugin Manager > Installed and clicking on the ling "Show plugin customization directory" or via the operating system explorer/finder.

 

 

Create snippets

You may create many snippets, but only one can be active, per target, at any time.  If you don't have one already, you should create a snippets folder below  \customProperties\

 

Snippets folder structure

 

 

 

A snippet is a simple JSON file with a .json extension. You may download this example and use it as a basis for adjustments to your specific needs.

 

Snippet metadata JSON

 

 

Or you may download this example as well.

 

Snippet canonical JSON

 

Activate a snippet

For your snippet to be used when you create a new entity in your model, you must first activate it.  Only a single snippet, if any, can be active at a given time.

 

The activation is done in a file that should already exist in your \customProperties\properties_pane folder: defaultData.json

 

Simply replace the empty object {} by an object such as this one:

 

Snippets activation

 

You may download an example for this file.

 

If you wish to use a different snippet, just change the value in defaultData.json.  If you wish to cancel the use of snippets, you should comment the lines.

 

Snippets deactivation