Mode Analytics

Prerequisites

  • Get admin credentials on your Mode Analytics instance.

  • Generate an API token by following these 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/IP of the host where your instance of Mode Analytics in installed.

If you're using a managed instance, the host is https://modeanalytics.com

  • -w, --workspace: The name of your workspace. More information here

  • -t, --token: The Token value from the API token created in Mode.

  • -s, --secret: The Password value from the API token created in Mode.

Other arguments

  • -o, --output: target folder to store the extracted files

You can also get help with argument --help

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

Last updated

Was this helpful?