Mode Analytics
Prerequisites
Follow installation instructions here
Get
admin
credentials on yourMode 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.
-w
,--workspace
: The name of your workspace. More information here-t
,--token
: TheToken
value from the API token created in Mode.-s
,--secret
: ThePassword
value from the API token created in Mode.
Other arguments
-o
,--output
: target folder to store the extracted files
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?