Mode Analytics
Extract Mode Analytics metadata into Catalog using the castor-extractor package.
Prerequisites
Installation Required
Follow the castor-extractor installation instructions before running the extraction.
- Get
admincredentials on your Mode Analytics instance. - Generate an API token by following the Mode API token instructions
Run Extraction Script
Once the package has been installed, you should be able to run the following command in your terminal:
castor-extract-mode [arguments]
The script will run and display logs as following:
INFO - Authentication succeeded.
INFO - Starting extraction for DATASOURCE...
INFO - Calling https://modeanalytics.com/api/...
INFO - 1 rows extracted
INFO - Wrote output file: /tmp/catalog/1649080890-datasource.json
INFO - Starting extraction for COLLECTION...
...
INFO - Wrote output file: /tmp/catalog/1649080890-member.json
INFO - Wrote output file: /tmp/catalog/1649080890-summary.json
Credentials
-H,--host: The name or IP of the host where your Mode Analytics instance is installed.
Managed Instance
If you are using a managed instance, the host is https://modeanalytics.com.
-w,--workspace: The name of your workspace. See Mode organizations documentation for more information.-t,--token: TheTokenvalue from the API token created in Mode.-s,--secret: ThePasswordvalue from the API token created in Mode.
Other Arguments
-o,--output: Target folder to store the extracted files
Help
You can also get help with the --help argument.
Use ENV Variables
If you don't want to specify arguments every time, you can set the following ENV in your .bashrc:
CASTOR_MODE_ANALYTICS_HOST
CASTOR_MODE_ANALYTICS_WORKSPACE
CASTOR_MODE_ANALYTICS_TOKEN
CASTOR_MODE_ANALYTICS_SECRET
CASTOR_OUTPUT_DIRECTORY
Then the script can be executed without any arguments:
castor-extract-mode
It can also be executed with partial arguments (the script looks in your ENV as a fallback):
castor-extract-mode --output /tmp/catalog