With its Command Line Interface (CLI), Hackolade truly supports an agile development approach leveraging the flexibility of NoSQL dynamic schemas.  Some Hackolade customers use this capability nightly in a batch process to identify attributes and structures that may have appeared in the data since the last run.  During a nightly run of the reverse-engineering function, a much larger dataset can be queried as a basis for document sampling, hence making schema inference more precise. Such capability can be useful in a data governance context to properly document the semantics and publish a thorough data dictionary for end users.  It can also be used in the context of compliance with privacy laws to make sure that the company does not store data that it is not supposed to store.  There are many more examples of how to use this functionality.


You can use the Hackolade CLI from a terminal program:

  • Windows:
    • cmd command line: all commands below should be preceded by start /wait
    • PowerShell: all commands below should be preceded by Start-Process -wait
  • Mac and Linux: terminal emulator or common shell programs: all commands below should be preceded by .\


To take full advantage of the capability, you may run the CLI from scheduled batch files.  


Note: a properly licensed copy of Hackolade is required to run the CLI.  The CLI functionality is only available in the Professional and Trial editions of Hackolade.


Below is the current list of Hackolade CLI commands.  Additional commands may be added at a later date.

Command

Purpose

genDoc

Generate documentation for a Hackolade model, either in HTML or PDF format

revEng

Reverse-engineer a database instance to infer the schema of the selected collections/tables

compMod

Compare two Hackolade models to detect differences, and optionally merge them

help

Display commands and their arguments

version

Display application version



Usage:        hackolade command [--arguments]


1) genDoc

The genDoc command lets you invoke the generation of a documentation file, either in HTML or PDF format, for a specified existing Hackolade model.


Usage:        hackolade genDoc [--arguments]


Argument

Required

Purpose

--format=<HTML | PDF>

Y

Specify format, currently either HTML or PDF

--model=<file>*

Y

Full path and file name for source Hackolade model for which documentation is being generated.  Extension .json is optional

--doc=<file>*

Y

Full path and file name for documentation.  Extension .html or .pdf is optional

--logo=<file>*

N

Full path and file name for custom logo file.  If omitted, Hackolade logo is used

--modelDiagram=<true | false>

N

Include model diagram [default: true]

--sepContDiag=<true | false>

N

Include separate container diagrams (database, region, buckets, keyspaces...)  [default: true]

--entityDiagrams=<true | false>

N

Include entity tree diagrams [default: true]

--attribTree=<all | complex | none>

N

Include individual tree view for all attributes [all], for complex attributes only [complex], or for no attributes [none]. [default: all]

--properties=<all | notNull | none>

N

Include all field properties [all], only field properties with information [notnull], or no field properties [none]. [default: all]

--relationships=<true | false>

N

Include Relationships [default: true]

--JSONSchema=<true | false>

N

Include JSON Schema code [default: true]

--JSONData=<true | false>

N

Include JSON Data sample [default: true]

--entities="<containerName>: [<entity1>,<entity2>,…]"

N

Specify container(s) to include in documentation [default: all] and an array of entities [default: all]

- MongoDB: container = dbs; entity = collection

- DynamoDB: container = not applicable; entity = table

- Couchbase: container = bucket; entity = document kind

- Cosmos DB: container = collection; entity = document type

- plain JSON: container = group; entity = document

The value is a string surrounded by double quotes (").  Entities are represented as an array surrounded by square brackets ([]), and are separated by a comma (,).  The entities array is separated from the container name by a colon (:).   Containers are separated by semi-colons (;).

--views="[<view1>, <view2>, ...]"

N

In MongoDB only, specify view(s) to include in documentation [default: all]

The value is a string surrounded by double quotes (").  Views are represented as an array surrounded by square brackets ([]), and are separated by a comma (,).

--openDoc=<true | false>

N

Specify whether to open the generated document or not upon completion of generation. [default: false]

--logLevel=< 1 | 2 | 3 | 4 >

N

1 = no spinner, no info, no error messages

2 = no spinner, no info

3 = no spinner

4 = full output

[default: 4]

*: If path and/or file name contains blanks, the value must be surrounded by double quotes (“)  Path can be ignored if file is in local directory.


Simple example: using all default options:  

hackolade genDoc --format=HTML --model=C:\Users\Public\Bitbucket\hackolade\schemas\MongoDB\noaa.json
--doc=C:\Users\Public\Documents\Hackolade\Documentation\noaa.html


More complex example:

"C:\Program Files\Hackolade\hackolade" genDoc --format=HTML --model=C:\Users\Public\Bitbucket\hackolade\schemas\Couchbase\travel-sample.json
--doc=C\Users\Public\Documents\Hackolade\Documentation\travel-sample.html --logo="C\Users\Public\Documents\Hackolade\Documentation\couchbase logo.png"
--attribTree=complex --JSONSchema=false --JSONData=false --properties=notNull --entities="travel-sample: airport, airline, route"


2) revEng

The revEng command allows to trigger a reverse-engineering process of a database instance, as described in this page.


Usage:        hackolade revEng [--arguments]


Argument

Required

Purpose

--target=<target>

Y

Database target for model: MONGODB, DYNAMODB, COUCHBASE, or target value in plugin, like COSMOSDB-DOC, COSMOSDB-MONGO, ELASTICSEARCH, HBASE

--connectName=<connection>

Y

Name of connection settings saved in the Hackolade instance where CLI is invoked.

--model=<file>*

Y

Full path and file name for target Hackolade model into which reverse-engineering process has to be converted.  Extension .json is optional

--samplingMethod=<abs | rel>

N

Specify sampling method, either absolute number of documents or relative percentage.  [default: abs]

--samplingValue=<x>

N

If samplingMethod=abs: positive integer between 1 and 100000 [default: 1000]

If samplingMethod=rel: positive integer between 1 and 100 [default: 1]

Warning: for obvious performance and response time reasons, be reasonable with these parameters when used on large entities!  What's the point of sampling 10% of 1B+ identical documents?...

--fieldOrder=<keep | alpha>

N

Specify whether to preserve order of fields in sampled document or rearrange in alpha order
[default: keep]

--selectedObjects=
"<containerName>: [<entity1>,<entity2>,…]"

N

Specify container(s) to include in documentation [default: all] and an array of entities [default: all]

- MongoDB: container = dbs; entity = collection

- DynamoDB: container = not applicable; entity = table

- Couchbase: container = bucket; entity = document kind

- Cosmos DB: container = collection; entity = document type

- Elasticsearch: container = index: entity = type

- HBase: container =  namespace; entity = table

The value is a string surrounded by double quotes (").  Entities are represented as an array surrounded by square brackets ([]), and are separated by a comma (,).  The entities array is separated from the container name by a colon (:).  Containers are separated by semi-colons (;).

--documentKinds=
"<bucketName>: <docKindField>"

N

In Couchbase only, for each bucket, you must specidfy the field used to distinguish the different objects stored in the same bucket.

--includeEmpty=<true | false>

N

In MongoDB only, specify whether to include empty collections [default: false]

--includeSystem=<true | false>

N

In MongoDB only, specify whether to include system collections [default: false]

--includeViews=<true | false>

N

In MongoDB only, specify whether to include views [default: true]

--logLevel=< 1 | 2 | 3 | 4 >

N

1 = no spinner, no info, no error messages

2 = no spinner, no info

3 = no spinner

4 = full output

[default: 4]

*: If path and/or file name contains blanks, the value must be surrounded by double quotes (“)  Path can be ignored if file is in local directory.


MongoDB example:  

hackolade revEng --connectName=local --target=MONGODB --samplingMethod=abs --samplingValue=1000
--model=C:\Users\Public\Bitbucket\hackolade\schemas\MongoDB\yelp.json --includeEmpty=true --selectedObjects="yelp" --fieldOrder=keep


DynamoDB example:  

"C:\Program Files\Hackolade\hackolade" revEng --connectName=local --target=DYNAMODB --samplingMethod=abs --samplingValue=1000
--model=C:\Users\Public\Bitbucket\hackolade\schemas\DynamoDB\entertainment.json --includeEmpty=false --selectedObjects="[Movies, Music]" --fieldOrder=alpha


Couchbase example:  

"C:\Program Files\Hackolade\hackolade" revEng --connectName=local --target=COUCHBASE --samplingMethod=abs --samplingValue=2500
--model=C:\Users\Public\Bitbucket\hackolade\schemas\Couchbase\travel-sample.json --includeEmpty=false --selectedObjects="travel-sample: [airline, airport]"  
--documentKinds="travel-sample: type" --fieldOrder=keep


Cosmos DB example:

start /wait hackolade reveng --target=COSMOSDB-DOC --connectName=azure --model=travel.json --selectedObjects="travel" --documentKinds="travel:type"

3) compMod

The compMod command lets you compare two (2) Hackolade models and derive a delta model file with additions, deletions, and modifications of fields and structures.


Usage:        hackolade revEng [--arguments]


Argument

Required

Purpose

--model1=<file>*

Y

Full path and file name for baseline Hackolade model with which comparison will be performed.  Extension .json is optional

--model2=<file>*

Y

Full path and file name for comparison Hackolade model.  Extension .json is optional.  Both models need to be of the same DB target.  Extension .json is optional

--deltaModel=<file>*

Y

Full path and file name for differences in model comparisons.  The resulting file is a Hackolade model.  Extension .json is optional

--ignoreGUIDs=<true | false>

N

Specify whether to include GUIDs in comparison.  [default: true]

--ignoreExtraProperties=

<true | false>

N

Specify whether to include in comparison the Hackolade properties that cannot typically be derived from the data, such as descriptions, comments, samples, defaults, and foreign key-related infos.  [default: true]

--ignoreOrder=<true | false>

N

Specify whether to detect changes in order of fields [default: true]

--targetModel=<file>*

N

Full path and file name for the Hackolade model resulting from the merge of model1 and model2.  If specified, a new Hackolade model is created with a merge of the 2 original models.

Extension .json is optional

*: If path and/or file name contains blanks, the value must be surrounded by double quotes (“)  Path can be ignored if file is in local directory.


Note: unless GUID’s are used for the comparison, a change in a field name will result in an addition plus a deletion.  Same for a change in an entity name.


Example:

"C:\Program Files\Hackolade\hackolade" compMod --model1=yesterdaysModel --model2=todaysModel --deltaModel=todaysDeltaModel --ignoreGUIDs=true
--ignoreExtraProperties=true --ignoreOrder=true


Structure of resulting delta model file:

A delta model file may contain any combination of multiple additions, deletions, and modifications.  Deeply nested fields are referenced through their structure.  To merge newly added fields, open your baseline model in Hackolade, then either copy/paste from the delta model, or reference the new field via an external reference to the delta model, then convert the reference into attributes.


4) help

The help command displays the version number of Hackolade being invoked.


Usage:        hackolade help

5) version

The version command displays the version number of Hackolade being invoked.


Usage:        hackolade version